diff options
author | David Garcia Quintas <dgq@google.com> | 2016-01-21 01:04:36 -0800 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2016-01-21 01:04:36 -0800 |
commit | 08a0a3306e1b0d5597a0541624f53ee35bd34463 (patch) | |
tree | 1f961b815469f663ec45888dfebe55bf7fc7361a | |
parent | f3ddb7c55a4b158843fe44183cbf9ce72f4c9355 (diff) |
Made "codedgen" directories closed over #includes
44 files changed, 1311 insertions, 743 deletions
@@ -426,6 +426,9 @@ cc_library( "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", "include/grpc/grpc.h", + "include/grpc/impl/codegen/connectivity_state.h", + "include/grpc/impl/codegen/port_platform.h", + "include/grpc/impl/codegen/time.h", "include/grpc/status.h", "include/grpc/census.h", ], @@ -697,6 +700,9 @@ cc_library( "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", "include/grpc/grpc.h", + "include/grpc/impl/codegen/connectivity_state.h", + "include/grpc/impl/codegen/port_platform.h", + "include/grpc/impl/codegen/time.h", "include/grpc/status.h", "include/grpc/census.h", ], @@ -784,8 +790,14 @@ cc_library( "include/grpc++/grpc++.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", + "include/grpc++/impl/codegen/call_hook.h", "include/grpc++/impl/codegen/channel_interface.h", + "include/grpc++/impl/codegen/completion_queue_tag.h", + "include/grpc++/impl/codegen/config.h", "include/grpc++/impl/codegen/server_interface.h", + "include/grpc++/impl/codegen/status.h", + "include/grpc++/impl/codegen/status_code_enum.h", + "include/grpc++/impl/codegen/time.h", "include/grpc++/impl/grpc_library.h", "include/grpc++/impl/method_handler_impl.h", "include/grpc++/impl/proto_utils.h", @@ -880,8 +892,14 @@ cc_library( "include/grpc++/grpc++.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", + "include/grpc++/impl/codegen/call_hook.h", "include/grpc++/impl/codegen/channel_interface.h", + "include/grpc++/impl/codegen/completion_queue_tag.h", + "include/grpc++/impl/codegen/config.h", "include/grpc++/impl/codegen/server_interface.h", + "include/grpc++/impl/codegen/status.h", + "include/grpc++/impl/codegen/status_code_enum.h", + "include/grpc++/impl/codegen/time.h", "include/grpc++/impl/grpc_library.h", "include/grpc++/impl/method_handler_impl.h", "include/grpc++/impl/proto_utils.h", @@ -1239,6 +1257,9 @@ objc_library( "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", "include/grpc/grpc.h", + "include/grpc/impl/codegen/connectivity_state.h", + "include/grpc/impl/codegen/port_platform.h", + "include/grpc/impl/codegen/time.h", "include/grpc/status.h", "include/grpc/census.h", "src/core/security/auth_filters.h", @@ -2470,6 +2470,9 @@ PUBLIC_HEADERS_C += \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ include/grpc/grpc.h \ + include/grpc/impl/codegen/connectivity_state.h \ + include/grpc/impl/codegen/port_platform.h \ + include/grpc/impl/codegen/time.h \ include/grpc/status.h \ include/grpc/census.h \ @@ -2772,6 +2775,9 @@ PUBLIC_HEADERS_C += \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ include/grpc/grpc.h \ + include/grpc/impl/codegen/connectivity_state.h \ + include/grpc/impl/codegen/port_platform.h \ + include/grpc/impl/codegen/time.h \ include/grpc/status.h \ include/grpc/census.h \ @@ -2990,8 +2996,14 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/grpc++.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ + include/grpc++/impl/codegen/call_hook.h \ include/grpc++/impl/codegen/channel_interface.h \ + include/grpc++/impl/codegen/completion_queue_tag.h \ + include/grpc++/impl/codegen/config.h \ include/grpc++/impl/codegen/server_interface.h \ + include/grpc++/impl/codegen/status.h \ + include/grpc++/impl/codegen/status_code_enum.h \ + include/grpc++/impl/codegen/time.h \ include/grpc++/impl/grpc_library.h \ include/grpc++/impl/method_handler_impl.h \ include/grpc++/impl/proto_utils.h \ @@ -3262,8 +3274,14 @@ PUBLIC_HEADERS_CXX += \ include/grpc++/grpc++.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ + include/grpc++/impl/codegen/call_hook.h \ include/grpc++/impl/codegen/channel_interface.h \ + include/grpc++/impl/codegen/completion_queue_tag.h \ + include/grpc++/impl/codegen/config.h \ include/grpc++/impl/codegen/server_interface.h \ + include/grpc++/impl/codegen/status.h \ + include/grpc++/impl/codegen/status_code_enum.h \ + include/grpc++/impl/codegen/time.h \ include/grpc++/impl/grpc_library.h \ include/grpc++/impl/method_handler_impl.h \ include/grpc++/impl/proto_utils.h \ diff --git a/build.yaml b/build.yaml index 24fa7a1be1..feea528de4 100644 --- a/build.yaml +++ b/build.yaml @@ -32,8 +32,14 @@ filegroups: - include/grpc++/grpc++.h - include/grpc++/impl/call.h - include/grpc++/impl/client_unary_call.h + - include/grpc++/impl/codegen/call_hook.h - include/grpc++/impl/codegen/channel_interface.h + - include/grpc++/impl/codegen/completion_queue_tag.h + - include/grpc++/impl/codegen/config.h - include/grpc++/impl/codegen/server_interface.h + - include/grpc++/impl/codegen/status.h + - include/grpc++/impl/codegen/status_code_enum.h + - include/grpc++/impl/codegen/time.h - include/grpc++/impl/grpc_library.h - include/grpc++/impl/method_handler_impl.h - include/grpc++/impl/proto_utils.h @@ -107,6 +113,9 @@ filegroups: - include/grpc/byte_buffer_reader.h - include/grpc/compression.h - include/grpc/grpc.h + - include/grpc/impl/codegen/connectivity_state.h + - include/grpc/impl/codegen/port_platform.h + - include/grpc/impl/codegen/time.h - include/grpc/status.h headers: - src/core/census/grpc_filter.h diff --git a/gRPC.podspec b/gRPC.podspec index 97e13c0d30..5dfe6add7f 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -277,6 +277,9 @@ Pod::Spec.new do |s| 'include/grpc/byte_buffer_reader.h', 'include/grpc/compression.h', 'include/grpc/grpc.h', + 'include/grpc/impl/codegen/connectivity_state.h', + 'include/grpc/impl/codegen/port_platform.h', + 'include/grpc/impl/codegen/time.h', 'include/grpc/status.h', 'include/grpc/census.h', 'src/core/httpcli/httpcli_security_connector.c', diff --git a/grpc.gemspec b/grpc.gemspec index 4f3a3f2dd9..ab78a42416 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -130,6 +130,9 @@ Gem::Specification.new do |s| s.files += %w( include/grpc/byte_buffer_reader.h ) s.files += %w( include/grpc/compression.h ) s.files += %w( include/grpc/grpc.h ) + s.files += %w( include/grpc/impl/codegen/connectivity_state.h ) + s.files += %w( include/grpc/impl/codegen/port_platform.h ) + s.files += %w( include/grpc/impl/codegen/time.h ) s.files += %w( include/grpc/status.h ) s.files += %w( include/grpc/census.h ) s.files += %w( src/core/security/auth_filters.h ) diff --git a/include/grpc++/completion_queue.h b/include/grpc++/completion_queue.h index c1f4172322..7ed8f59008 100644 --- a/include/grpc++/completion_queue.h +++ b/include/grpc++/completion_queue.h @@ -36,7 +36,6 @@ #ifndef GRPCXX_COMPLETION_QUEUE_H #define GRPCXX_COMPLETION_QUEUE_H -#include <grpc/support/time.h> #include <grpc++/impl/grpc_library.h> #include <grpc++/support/status.h> #include <grpc++/support/time.h> @@ -190,17 +189,6 @@ class CompletionQueue : public GrpcLibrary { grpc_completion_queue* cq_; // owned }; -/// An interface allowing implementors to process and filter event tags. -class CompletionQueueTag { - public: - virtual ~CompletionQueueTag() {} - // Called prior to returning from Next(), return value is the status of the - // operation (return status is the default thing to do). If this function - // returns false, the tag is dropped and not returned from the completion - // queue - virtual bool FinalizeResult(void** tag, bool* status) = 0; -}; - /// A specific type of completion queue used by the processing of notifications /// by servers. Instantiated by \a ServerBuilder. class ServerCompletionQueue : public CompletionQueue { diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index cb7856bfbe..5a8bd0caa6 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -42,6 +42,8 @@ #include <grpc/support/alloc.h> #include <grpc++/client_context.h> #include <grpc++/completion_queue.h> +#include <grpc++/impl/codegen/call_hook.h> +#include <grpc++/impl/codegen/completion_queue_tag.h> #include <grpc++/impl/serialization_traits.h> #include <grpc++/support/config.h> #include <grpc++/support/status.h> @@ -53,6 +55,7 @@ namespace grpc { class ByteBuffer; class Call; +class CallHook; void FillMetadataMap( grpc_metadata_array* arr, @@ -548,13 +551,6 @@ class SneakyCallOpSet : public CallOpSet<Op1, Op2, Op3, Op4, Op5, Op6> { } }; -// Channel and Server implement this to allow them to hook performing ops -class CallHook { - public: - virtual ~CallHook() {} - virtual void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) = 0; -}; - // Straightforward wrapping of the C call object class Call GRPC_FINAL { public: diff --git a/include/grpc++/impl/codegen/call_hook.h b/include/grpc++/impl/codegen/call_hook.h new file mode 100644 index 0000000000..e360636e70 --- /dev/null +++ b/include/grpc++/impl/codegen/call_hook.h @@ -0,0 +1,51 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 COPYRIGHT + * OWNER OR CONTRIBUTORS 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 GRPCXX_IMPL_CODEGEN_CALL_HOOK_H +#define GRPCXX_IMPL_CODEGEN_CALL_HOOK_H + +namespace grpc { + +class CallOpSetInterface; +class Call; + +/// Channel and Server implement this to allow them to hook performing ops +class CallHook { + public: + virtual ~CallHook() {} + virtual void PerformOpsOnCall(CallOpSetInterface* ops, Call* call) = 0; +}; + +} // namespace grpc + +#endif // GRPCXX_IMPL_CODEGEN_CALL_HOOK_H diff --git a/include/grpc++/impl/codegen/channel_interface.h b/include/grpc++/impl/codegen/channel_interface.h index d83b3fadfe..6fcd5c315c 100644 --- a/include/grpc++/impl/codegen/channel_interface.h +++ b/include/grpc++/impl/codegen/channel_interface.h @@ -31,12 +31,12 @@ * */ -#ifndef GRPCXX_CHANNEL_INTERFACE_H -#define GRPCXX_CHANNEL_INTERFACE_H +#ifndef GRPCXX_IMPL_CODEGEN_CHANNEL_INTERFACE_H +#define GRPCXX_IMPL_CODEGEN_CHANNEL_INTERFACE_H -#include <grpc++/impl/grpc_library.h> -#include <grpc++/support/status.h> -#include <grpc++/support/time.h> +#include <grpc++/impl/codegen/status.h> +#include <grpc++/impl/codegen/time.h> +#include <grpc/impl/codegen/connectivity_state.h> namespace grpc { class Call; @@ -120,4 +120,4 @@ class ChannelInterface { } // namespace grpc -#endif // GRPCXX_CHANNEL_INTERFACE_H +#endif // GRPCXX_IMPL_CODEGEN_CHANNEL_INTERFACE_H diff --git a/include/grpc++/impl/codegen/completion_queue_tag.h b/include/grpc++/impl/codegen/completion_queue_tag.h new file mode 100644 index 0000000000..8be2ac36d6 --- /dev/null +++ b/include/grpc++/impl/codegen/completion_queue_tag.h @@ -0,0 +1,52 @@ +/* + * + * Copyright 2015-2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 COPYRIGHT + * OWNER OR CONTRIBUTORS 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 GRPCXX_COMPLETION_QUEUE_TAG_H +#define GRPCXX_COMPLETION_QUEUE_TAG_H + +namespace grpc { + +/// An interface allowing implementors to process and filter event tags. +class CompletionQueueTag { + public: + virtual ~CompletionQueueTag() {} + // Called prior to returning from Next(), return value is the status of the + // operation (return status is the default thing to do). If this function + // returns false, the tag is dropped and not returned from the completion + // queue + virtual bool FinalizeResult(void** tag, bool* status) = 0; +}; + +} // namespace grpc + +#endif // GRPCXX_COMPLETION_QUEUE_TAG_H diff --git a/include/grpc++/impl/codegen/config.h b/include/grpc++/impl/codegen/config.h new file mode 100644 index 0000000000..d782d5f571 --- /dev/null +++ b/include/grpc++/impl/codegen/config.h @@ -0,0 +1,116 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 COPYRIGHT + * OWNER OR CONTRIBUTORS 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 GRPCXX_IMPL_CODEGEN_CONFIG_H +#define GRPCXX_IMPL_CODEGEN_CONFIG_H + +#if !defined(GRPC_NO_AUTODETECT_PLATFORM) + +#ifdef _MSC_VER +// Visual Studio 2010 is 1600. +#if _MSC_VER < 1600 +#error "gRPC is only supported with Visual Studio starting at 2010" +// Visual Studio 2013 is 1800. +#elif _MSC_VER < 1800 +#define GRPC_CXX0X_NO_FINAL 1 +#define GRPC_CXX0X_NO_OVERRIDE 1 +#define GRPC_CXX0X_NO_CHRONO 1 +#define GRPC_CXX0X_NO_THREAD 1 +#endif +#endif // Visual Studio + +#ifndef __clang__ +#ifdef __GNUC__ +// nullptr was added in gcc 4.6 +#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) +#define GRPC_CXX0X_NO_NULLPTR 1 +#endif +// final and override were added in gcc 4.7 +#if (__GNUC__ * 100 + __GNUC_MINOR__ < 407) +#define GRPC_CXX0X_NO_FINAL 1 +#define GRPC_CXX0X_NO_OVERRIDE 1 +#endif +#endif +#endif + +#endif + +#ifdef GRPC_CXX0X_NO_FINAL +#define GRPC_FINAL +#else +#define GRPC_FINAL final +#endif + +#ifdef GRPC_CXX0X_NO_OVERRIDE +#define GRPC_OVERRIDE +#else +#define GRPC_OVERRIDE override +#endif + +#ifdef GRPC_CXX0X_NO_NULLPTR +#include <memory> +namespace grpc { +const class { + public: + template <class T> + operator T *() const { + return static_cast<T *>(0); + } + template <class T> + operator std::unique_ptr<T>() const { + return std::unique_ptr<T>(static_cast<T *>(0)); + } + template <class T> + operator std::shared_ptr<T>() const { + return std::shared_ptr<T>(static_cast<T *>(0)); + } + operator bool() const { return false; } + + private: + void operator&() const = delete; +} nullptr = {}; +} +#endif + +#ifndef GRPC_CUSTOM_STRING +#include <string> +#define GRPC_CUSTOM_STRING std::string +#endif + +namespace grpc { + +typedef GRPC_CUSTOM_STRING string; + +} // namespace grpc + +#endif // GRPCXX_IMPL_CODEGEN_CONFIG_H diff --git a/include/grpc++/impl/codegen/server_interface.h b/include/grpc++/impl/codegen/server_interface.h index 1364bfe20f..2eadcb3428 100644 --- a/include/grpc++/impl/codegen/server_interface.h +++ b/include/grpc++/impl/codegen/server_interface.h @@ -31,12 +31,11 @@ * */ -#ifndef GRPCXX_SERVER_INTERFACE_H -#define GRPCXX_SERVER_INTERFACE_H +#ifndef GRPCXX_IMPL_CODEGEN_SERVER_INTERFACE_H +#define GRPCXX_IMPL_CODEGEN_SERVER_INTERFACE_H -#include <grpc++/completion_queue.h> -#include <grpc++/impl/call.h> -#include <grpc++/impl/rpc_service_method.h> +#include <grpc++/impl/codegen/completion_queue_tag.h> +#include <grpc++/impl/codegen/call_hook.h> namespace grpc { @@ -251,4 +250,4 @@ class ServerInterface : public CallHook { } // namespace grpc -#endif // GRPCXX_SERVER_INTERFACE_H +#endif // GRPCXX_IMPL_CODEGEN_SERVER_INTERFACE_H diff --git a/include/grpc++/impl/codegen/status.h b/include/grpc++/impl/codegen/status.h new file mode 100644 index 0000000000..a509d311d4 --- /dev/null +++ b/include/grpc++/impl/codegen/status.h @@ -0,0 +1,76 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 COPYRIGHT + * OWNER OR CONTRIBUTORS 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 GRPCXX_IMPL_CODEGEN_STATUS_H +#define GRPCXX_IMPL_CODEGEN_STATUS_H + +#include <grpc++/impl/codegen/config.h> +#include <grpc++/impl/codegen/status_code_enum.h> + +namespace grpc { + +/// Did it work? If it didn't, why? +/// +/// See \a grpc::StatusCode for details on the available code and their meaning. +class Status { + public: + /// Construct an OK instance. + Status() : code_(StatusCode::OK) {} + + /// Construct an instance with associated \a code and \a details (also + // referred to as "error_message"). + Status(StatusCode code, const grpc::string& details) + : code_(code), details_(details) {} + + // Pre-defined special status objects. + /// An OK pre-defined instance. + static const Status& OK; + /// A CANCELLED pre-defined instance. + static const Status& CANCELLED; + + /// Return the instance's error code. + StatusCode error_code() const { return code_; } + /// Return the instance's error message. + grpc::string error_message() const { return details_; } + + /// Is the status OK? + bool ok() const { return code_ == StatusCode::OK; } + + private: + StatusCode code_; + grpc::string details_; +}; + +} // namespace grpc + +#endif // GRPCXX_IMPL_CODEGEN_STATUS_H diff --git a/include/grpc++/impl/codegen/status_code_enum.h b/include/grpc++/impl/codegen/status_code_enum.h new file mode 100644 index 0000000000..9a90a18e2a --- /dev/null +++ b/include/grpc++/impl/codegen/status_code_enum.h @@ -0,0 +1,152 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 COPYRIGHT + * OWNER OR CONTRIBUTORS 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 GRPCXX_IMPL_CODEGEN_STATUS_CODE_ENUM_H +#define GRPCXX_IMPL_CODEGEN_STATUS_CODE_ENUM_H + +namespace grpc { + +enum StatusCode { + /// Not an error; returned on success. + OK = 0, + + /// The operation was cancelled (typically by the caller). + CANCELLED = 1, + + /// Unknown error. An example of where this error may be returned is if a + /// Status value received from another address space belongs to an error-space + /// that is not known in this address space. Also errors raised by APIs that + /// do not return enough error information may be converted to this error. + UNKNOWN = 2, + + /// Client specified an invalid argument. Note that this differs from + /// FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are + /// problematic regardless of the state of the system (e.g., a malformed file + /// name). + INVALID_ARGUMENT = 3, + + /// Deadline expired before operation could complete. For operations that + /// change the state of the system, this error may be returned even if the + /// operation has completed successfully. For example, a successful response + /// from a server could have been delayed long enough for the deadline to + /// expire. + DEADLINE_EXCEEDED = 4, + + /// Some requested entity (e.g., file or directory) was not found. + NOT_FOUND = 5, + + /// Some entity that we attempted to create (e.g., file or directory) already + /// exists. + ALREADY_EXISTS = 6, + + /// The caller does not have permission to execute the specified operation. + /// PERMISSION_DENIED must not be used for rejections caused by exhausting + /// some resource (use RESOURCE_EXHAUSTED instead for those errors). + /// PERMISSION_DENIED must not be used if the caller can not be identified + /// (use UNAUTHENTICATED instead for those errors). + PERMISSION_DENIED = 7, + + /// The request does not have valid authentication credentials for the + /// operation. + UNAUTHENTICATED = 16, + + /// Some resource has been exhausted, perhaps a per-user quota, or perhaps the + /// entire file system is out of space. + RESOURCE_EXHAUSTED = 8, + + /// Operation was rejected because the system is not in a state required for + /// the operation's execution. For example, directory to be deleted may be + /// non-empty, an rmdir operation is applied to a non-directory, etc. + /// + /// A litmus test that may help a service implementor in deciding + /// between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: + /// (a) Use UNAVAILABLE if the client can retry just the failing call. + /// (b) Use ABORTED if the client should retry at a higher-level + /// (e.g., restarting a read-modify-write sequence). + /// (c) Use FAILED_PRECONDITION if the client should not retry until + /// the system state has been explicitly fixed. E.g., if an "rmdir" + /// fails because the directory is non-empty, FAILED_PRECONDITION + /// should be returned since the client should not retry unless + /// they have first fixed up the directory by deleting files from it. + /// (d) Use FAILED_PRECONDITION if the client performs conditional + /// REST Get/Update/Delete on a resource and the resource on the + /// server does not match the condition. E.g., conflicting + /// read-modify-write on the same resource. + FAILED_PRECONDITION = 9, + + /// The operation was aborted, typically due to a concurrency issue like + /// sequencer check failures, transaction aborts, etc. + /// + /// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, + /// and UNAVAILABLE. + ABORTED = 10, + + /// Operation was attempted past the valid range. E.g., seeking or reading + /// past end of file. + /// + /// Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed + /// if the system state changes. For example, a 32-bit file system will + /// generate INVALID_ARGUMENT if asked to read at an offset that is not in the + /// range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from + /// an offset past the current file size. + /// + /// There is a fair bit of overlap between FAILED_PRECONDITION and + /// OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error) + /// when it applies so that callers who are iterating through a space can + /// easily look for an OUT_OF_RANGE error to detect when they are done. + OUT_OF_RANGE = 11, + + /// Operation is not implemented or not supported/enabled in this service. + UNIMPLEMENTED = 12, + + /// Internal errors. Means some invariants expected by underlying System has + /// been broken. If you see one of these errors, Something is very broken. + INTERNAL = 13, + + /// The service is currently unavailable. This is a most likely a transient + /// condition and may be corrected by retrying with a backoff. + /// + /// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, + /// and UNAVAILABLE. + UNAVAILABLE = 14, + + /// Unrecoverable data loss or corruption. + DATA_LOSS = 15, + + /// Force users to include a default branch: + DO_NOT_USE = -1 +}; + +} // namespace grpc + +#endif // GRPCXX_IMPL_CODEGEN_STATUS_CODE_ENUM_H diff --git a/include/grpc++/impl/codegen/time.h b/include/grpc++/impl/codegen/time.h new file mode 100644 index 0000000000..41c32dc986 --- /dev/null +++ b/include/grpc++/impl/codegen/time.h @@ -0,0 +1,111 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 COPYRIGHT + * OWNER OR CONTRIBUTORS 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 GRPCXX_IMPL_CODEGEN_TIME_H +#define GRPCXX_IMPL_CODEGEN_TIME_H + +#include <grpc++/impl/codegen/config.h> +#include <grpc/impl/codegen/time.h> + +namespace grpc { + +/* If you are trying to use CompletionQueue::AsyncNext with a time class that + isn't either gpr_timespec or std::chrono::system_clock::time_point, you + will most likely be looking at this comment as your compiler will have + fired an error below. In order to fix this issue, you have two potential + solutions: + + 1. Use gpr_timespec or std::chrono::system_clock::time_point instead + 2. Specialize the TimePoint class with whichever time class that you + want to use here. See below for two examples of how to do this. + */ + +template <typename T> +class TimePoint { + public: + TimePoint(const T& time) { you_need_a_specialization_of_TimePoint(); } + gpr_timespec raw_time() { + gpr_timespec t; + return t; + } + + private: + void you_need_a_specialization_of_TimePoint(); +}; + +template <> +class TimePoint<gpr_timespec> { + public: + TimePoint(const gpr_timespec& time) : time_(time) {} + gpr_timespec raw_time() { return time_; } + + private: + gpr_timespec time_; +}; + +} // namespace grpc + +#ifndef GRPC_CXX0X_NO_CHRONO + +#include <chrono> + +#include <grpc/support/time.h> + +namespace grpc { + +// from and to should be absolute time. +void Timepoint2Timespec(const std::chrono::system_clock::time_point& from, + gpr_timespec* to); +void TimepointHR2Timespec( + const std::chrono::high_resolution_clock::time_point& from, + gpr_timespec* to); + +std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t); + +template <> +class TimePoint<std::chrono::system_clock::time_point> { + public: + TimePoint(const std::chrono::system_clock::time_point& time) { + Timepoint2Timespec(time, &time_); + } + gpr_timespec raw_time() const { return time_; } + + private: + gpr_timespec time_; +}; + +} // namespace grpc + +#endif // !GRPC_CXX0X_NO_CHRONO + +#endif // GRPCXX_IMPL_CODEGEN_TIME_H diff --git a/include/grpc++/support/config.h b/include/grpc++/support/config.h index 836bd47283..be8c89c462 100644 --- a/include/grpc++/support/config.h +++ b/include/grpc++/support/config.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,83 +34,6 @@ #ifndef GRPCXX_SUPPORT_CONFIG_H #define GRPCXX_SUPPORT_CONFIG_H -#if !defined(GRPC_NO_AUTODETECT_PLATFORM) - -#ifdef _MSC_VER -// Visual Studio 2010 is 1600. -#if _MSC_VER < 1600 -#error "gRPC is only supported with Visual Studio starting at 2010" -// Visual Studio 2013 is 1800. -#elif _MSC_VER < 1800 -#define GRPC_CXX0X_NO_FINAL 1 -#define GRPC_CXX0X_NO_OVERRIDE 1 -#define GRPC_CXX0X_NO_CHRONO 1 -#define GRPC_CXX0X_NO_THREAD 1 -#endif -#endif // Visual Studio - -#ifndef __clang__ -#ifdef __GNUC__ -// nullptr was added in gcc 4.6 -#if (__GNUC__ * 100 + __GNUC_MINOR__ < 406) -#define GRPC_CXX0X_NO_NULLPTR 1 -#endif -// final and override were added in gcc 4.7 -#if (__GNUC__ * 100 + __GNUC_MINOR__ < 407) -#define GRPC_CXX0X_NO_FINAL 1 -#define GRPC_CXX0X_NO_OVERRIDE 1 -#endif -#endif -#endif - -#endif - -#ifdef GRPC_CXX0X_NO_FINAL -#define GRPC_FINAL -#else -#define GRPC_FINAL final -#endif - -#ifdef GRPC_CXX0X_NO_OVERRIDE -#define GRPC_OVERRIDE -#else -#define GRPC_OVERRIDE override -#endif - -#ifdef GRPC_CXX0X_NO_NULLPTR -#include <memory> -namespace grpc { -const class { - public: - template <class T> - operator T *() const { - return static_cast<T *>(0); - } - template <class T> - operator std::unique_ptr<T>() const { - return std::unique_ptr<T>(static_cast<T *>(0)); - } - template <class T> - operator std::shared_ptr<T>() const { - return std::shared_ptr<T>(static_cast<T *>(0)); - } - operator bool() const { return false; } - - private: - void operator&() const = delete; -} nullptr = {}; -} -#endif - -#ifndef GRPC_CUSTOM_STRING -#include <string> -#define GRPC_CUSTOM_STRING std::string -#endif - -namespace grpc { - -typedef GRPC_CUSTOM_STRING string; - -} // namespace grpc +#include <grpc++/impl/codegen/config.h> #endif // GRPCXX_SUPPORT_CONFIG_H diff --git a/include/grpc++/support/status.h b/include/grpc++/support/status.h index e59bac92d1..a33fbedf12 100644 --- a/include/grpc++/support/status.h +++ b/include/grpc++/support/status.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,43 +34,6 @@ #ifndef GRPCXX_SUPPORT_STATUS_H #define GRPCXX_SUPPORT_STATUS_H -#include <grpc++/support/config.h> -#include <grpc++/support/status_code_enum.h> - -namespace grpc { - -/// Did it work? If it didn't, why? -/// -/// See \a grpc::StatusCode for details on the available code and their meaning. -class Status { - public: - /// Construct an OK instance. - Status() : code_(StatusCode::OK) {} - - /// Construct an instance with associated \a code and \a details (also - // referred to as "error_message"). - Status(StatusCode code, const grpc::string& details) - : code_(code), details_(details) {} - - // Pre-defined special status objects. - /// An OK pre-defined instance. - static const Status& OK; - /// A CANCELLED pre-defined instance. - static const Status& CANCELLED; - - /// Return the instance's error code. - StatusCode error_code() const { return code_; } - /// Return the instance's error message. - grpc::string error_message() const { return details_; } - - /// Is the status OK? - bool ok() const { return code_ == StatusCode::OK; } - - private: - StatusCode code_; - grpc::string details_; -}; - -} // namespace grpc +#include <grpc++/impl/codegen/status.h> #endif // GRPCXX_SUPPORT_STATUS_H diff --git a/include/grpc++/support/status_code_enum.h b/include/grpc++/support/status_code_enum.h index ee05b40b51..21b9c40d7e 100644 --- a/include/grpc++/support/status_code_enum.h +++ b/include/grpc++/support/status_code_enum.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,119 +34,6 @@ #ifndef GRPCXX_SUPPORT_STATUS_CODE_ENUM_H #define GRPCXX_SUPPORT_STATUS_CODE_ENUM_H -namespace grpc { - -enum StatusCode { - /// Not an error; returned on success. - OK = 0, - - /// The operation was cancelled (typically by the caller). - CANCELLED = 1, - - /// Unknown error. An example of where this error may be returned is if a - /// Status value received from another address space belongs to an error-space - /// that is not known in this address space. Also errors raised by APIs that - /// do not return enough error information may be converted to this error. - UNKNOWN = 2, - - /// Client specified an invalid argument. Note that this differs from - /// FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments that are - /// problematic regardless of the state of the system (e.g., a malformed file - /// name). - INVALID_ARGUMENT = 3, - - /// Deadline expired before operation could complete. For operations that - /// change the state of the system, this error may be returned even if the - /// operation has completed successfully. For example, a successful response - /// from a server could have been delayed long enough for the deadline to - /// expire. - DEADLINE_EXCEEDED = 4, - - /// Some requested entity (e.g., file or directory) was not found. - NOT_FOUND = 5, - - /// Some entity that we attempted to create (e.g., file or directory) already - /// exists. - ALREADY_EXISTS = 6, - - /// The caller does not have permission to execute the specified operation. - /// PERMISSION_DENIED must not be used for rejections caused by exhausting - /// some resource (use RESOURCE_EXHAUSTED instead for those errors). - /// PERMISSION_DENIED must not be used if the caller can not be identified - /// (use UNAUTHENTICATED instead for those errors). - PERMISSION_DENIED = 7, - - /// The request does not have valid authentication credentials for the - /// operation. - UNAUTHENTICATED = 16, - - /// Some resource has been exhausted, perhaps a per-user quota, or perhaps the - /// entire file system is out of space. - RESOURCE_EXHAUSTED = 8, - - /// Operation was rejected because the system is not in a state required for - /// the operation's execution. For example, directory to be deleted may be - /// non-empty, an rmdir operation is applied to a non-directory, etc. - /// - /// A litmus test that may help a service implementor in deciding - /// between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: - /// (a) Use UNAVAILABLE if the client can retry just the failing call. - /// (b) Use ABORTED if the client should retry at a higher-level - /// (e.g., restarting a read-modify-write sequence). - /// (c) Use FAILED_PRECONDITION if the client should not retry until - /// the system state has been explicitly fixed. E.g., if an "rmdir" - /// fails because the directory is non-empty, FAILED_PRECONDITION - /// should be returned since the client should not retry unless - /// they have first fixed up the directory by deleting files from it. - /// (d) Use FAILED_PRECONDITION if the client performs conditional - /// REST Get/Update/Delete on a resource and the resource on the - /// server does not match the condition. E.g., conflicting - /// read-modify-write on the same resource. - FAILED_PRECONDITION = 9, - - /// The operation was aborted, typically due to a concurrency issue like - /// sequencer check failures, transaction aborts, etc. - /// - /// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, - /// and UNAVAILABLE. - ABORTED = 10, - - /// Operation was attempted past the valid range. E.g., seeking or reading - /// past end of file. - /// - /// Unlike INVALID_ARGUMENT, this error indicates a problem that may be fixed - /// if the system state changes. For example, a 32-bit file system will - /// generate INVALID_ARGUMENT if asked to read at an offset that is not in the - /// range [0,2^32-1], but it will generate OUT_OF_RANGE if asked to read from - /// an offset past the current file size. - /// - /// There is a fair bit of overlap between FAILED_PRECONDITION and - /// OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific error) - /// when it applies so that callers who are iterating through a space can - /// easily look for an OUT_OF_RANGE error to detect when they are done. - OUT_OF_RANGE = 11, - - /// Operation is not implemented or not supported/enabled in this service. - UNIMPLEMENTED = 12, - - /// Internal errors. Means some invariants expected by underlying System has - /// been broken. If you see one of these errors, Something is very broken. - INTERNAL = 13, - - /// The service is currently unavailable. This is a most likely a transient - /// condition and may be corrected by retrying with a backoff. - /// - /// See litmus test above for deciding between FAILED_PRECONDITION, ABORTED, - /// and UNAVAILABLE. - UNAVAILABLE = 14, - - /// Unrecoverable data loss or corruption. - DATA_LOSS = 15, - - /// Force users to include a default branch: - DO_NOT_USE = -1 -}; - -} // namespace grpc +#include <grpc++/impl/codegen/status_code_enum.h> #endif // GRPCXX_SUPPORT_STATUS_CODE_ENUM_H diff --git a/include/grpc++/support/time.h b/include/grpc++/support/time.h index e00e0d8e91..1b6fb463c4 100644 --- a/include/grpc++/support/time.h +++ b/include/grpc++/support/time.h @@ -34,78 +34,6 @@ #ifndef GRPCXX_SUPPORT_TIME_H #define GRPCXX_SUPPORT_TIME_H -#include <grpc++/support/config.h> -#include <grpc/support/time.h> - -namespace grpc { - -/* If you are trying to use CompletionQueue::AsyncNext with a time class that - isn't either gpr_timespec or std::chrono::system_clock::time_point, you - will most likely be looking at this comment as your compiler will have - fired an error below. In order to fix this issue, you have two potential - solutions: - - 1. Use gpr_timespec or std::chrono::system_clock::time_point instead - 2. Specialize the TimePoint class with whichever time class that you - want to use here. See below for two examples of how to do this. - */ - -template <typename T> -class TimePoint { - public: - TimePoint(const T& time) { you_need_a_specialization_of_TimePoint(); } - gpr_timespec raw_time() { - gpr_timespec t; - return t; - } - - private: - void you_need_a_specialization_of_TimePoint(); -}; - -template <> -class TimePoint<gpr_timespec> { - public: - TimePoint(const gpr_timespec& time) : time_(time) {} - gpr_timespec raw_time() { return time_; } - - private: - gpr_timespec time_; -}; - -} // namespace grpc - -#ifndef GRPC_CXX0X_NO_CHRONO - -#include <chrono> - -#include <grpc/support/time.h> - -namespace grpc { - -// from and to should be absolute time. -void Timepoint2Timespec(const std::chrono::system_clock::time_point& from, - gpr_timespec* to); -void TimepointHR2Timespec( - const std::chrono::high_resolution_clock::time_point& from, - gpr_timespec* to); - -std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t); - -template <> -class TimePoint<std::chrono::system_clock::time_point> { - public: - TimePoint(const std::chrono::system_clock::time_point& time) { - Timepoint2Timespec(time, &time_); - } - gpr_timespec raw_time() const { return time_; } - - private: - gpr_timespec time_; -}; - -} // namespace grpc - -#endif // !GRPC_CXX0X_NO_CHRONO +#include <grpc++/impl/codegen/time.h> #endif // GRPCXX_SUPPORT_TIME_H diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 952e86ea49..2d012adc00 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -40,6 +40,7 @@ #include <grpc/byte_buffer.h> #include <grpc/support/slice.h> #include <grpc/support/time.h> +#include <grpc/impl/codegen/connectivity_state.h> #ifdef __cplusplus extern "C" { @@ -155,20 +156,6 @@ typedef struct { channel, it will just be ignored. */ #define GRPC_SSL_TARGET_NAME_OVERRIDE_ARG "grpc.ssl_target_name_override" -/** Connectivity state of a channel. */ -typedef enum { - /** channel is idle */ - GRPC_CHANNEL_IDLE, - /** channel is connecting */ - GRPC_CHANNEL_CONNECTING, - /** channel is ready for work */ - GRPC_CHANNEL_READY, - /** channel has seen a failure but expects to recover */ - GRPC_CHANNEL_TRANSIENT_FAILURE, - /** channel has seen a failure that it cannot recover from */ - GRPC_CHANNEL_FATAL_FAILURE -} grpc_connectivity_state; - /** Result of a grpc call. If the caller satisfies the prerequisites of a particular operation, the grpc_call_error returned will be GRPC_CALL_OK. Receiving any other value listed here is an indication of a bug in the diff --git a/include/grpc/impl/codegen/connectivity_state.h b/include/grpc/impl/codegen/connectivity_state.h new file mode 100644 index 0000000000..5bb9eb8f4e --- /dev/null +++ b/include/grpc/impl/codegen/connectivity_state.h @@ -0,0 +1,59 @@ +/* + * + * Copyright 2016, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 COPYRIGHT + * OWNER OR CONTRIBUTORS 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 GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H +#define GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** Connectivity state of a channel. */ +typedef enum { + /** channel is idle */ + GRPC_CHANNEL_IDLE, + /** channel is connecting */ + GRPC_CHANNEL_CONNECTING, + /** channel is ready for work */ + GRPC_CHANNEL_READY, + /** channel has seen a failure but expects to recover */ + GRPC_CHANNEL_TRANSIENT_FAILURE, + /** channel has seen a failure that it cannot recover from */ + GRPC_CHANNEL_FATAL_FAILURE +} grpc_connectivity_state; + +#ifdef __cplusplus +} +#endif + +#endif /* GRPC_IMPL_CODEGEN_CONNECTIVITY_STATE_H */ diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h new file mode 100644 index 0000000000..6a9000fb0d --- /dev/null +++ b/include/grpc/impl/codegen/port_platform.h @@ -0,0 +1,340 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 COPYRIGHT + * OWNER OR CONTRIBUTORS 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 GRPC_IMPL_CODEGEN_PORT_PLATFORM_H +#define GRPC_IMPL_CODEGEN_PORT_PLATFORM_H + +/* Get windows.h included everywhere (we need it) */ +#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32) +#ifndef WIN32_LEAN_AND_MEAN +#define GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED +#define WIN32_LEAN_AND_MEAN +#endif /* WIN32_LEAN_AND_MEAN */ + +#ifndef NOMINMAX +#define GRPC_NOMINMX_WAS_NOT_DEFINED +#define NOMINMAX +#endif /* NOMINMAX */ + +#ifndef _WIN32_WINNT +#error \ + "Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)" +#else /* !defined(_WIN32_WINNT) */ +#if (_WIN32_WINNT < 0x0600) +#error \ + "Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)" +#endif /* _WIN32_WINNT < 0x0600 */ +#endif /* defined(_WIN32_WINNT) */ + +#include <windows.h> + +#ifdef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED +#undef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED +#undef WIN32_LEAN_AND_MEAN +#endif /* GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED */ + +#ifdef GRPC_NOMINMAX_WAS_NOT_DEFINED +#undef GRPC_NOMINMAX_WAS_NOT_DEFINED +#undef NOMINMAX +#endif /* GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED */ +#endif /* defined(_WIN64) || defined(WIN64) || defined(_WIN32) || \ + defined(WIN32) */ + +/* Override this file with one for your platform if you need to redefine + things. */ + +#if !defined(GPR_NO_AUTODETECT_PLATFORM) +#if defined(_WIN64) || defined(WIN64) +#define GPR_PLATFORM_STRING "windows" +#define GPR_WIN32 1 +#define GPR_ARCH_64 1 +#define GPR_GETPID_IN_PROCESS_H 1 +#define GPR_WINSOCK_SOCKET 1 +#ifdef __GNUC__ +#define GPR_GCC_ATOMIC 1 +#define GPR_GCC_TLS 1 +#else +#define GPR_WIN32_ATOMIC 1 +#define GPR_MSVC_TLS 1 +#endif +#define GPR_WINDOWS_CRASH_HANDLER 1 +#elif defined(_WIN32) || defined(WIN32) +#define GPR_PLATFORM_STRING "windows" +#define GPR_ARCH_32 1 +#define GPR_WIN32 1 +#define GPR_GETPID_IN_PROCESS_H 1 +#define GPR_WINSOCK_SOCKET 1 +#ifdef __GNUC__ +#define GPR_GCC_ATOMIC 1 +#define GPR_GCC_TLS 1 +#else +#define GPR_WIN32_ATOMIC 1 +#define GPR_MSVC_TLS 1 +#endif +#define GPR_WINDOWS_CRASH_HANDLER 1 +#elif defined(ANDROID) || defined(__ANDROID__) +#define GPR_PLATFORM_STRING "android" +#define GPR_ANDROID 1 +#define GPR_ARCH_32 1 +#define GPR_CPU_LINUX 1 +#define GPR_GCC_SYNC 1 +#define GPR_GCC_TLS 1 +#define GPR_POSIX_MULTIPOLL_WITH_POLL 1 +#define GPR_POSIX_WAKEUP_FD 1 +#define GPR_LINUX_EVENTFD 1 +#define GPR_POSIX_SOCKET 1 +#define GPR_POSIX_SOCKETADDR 1 +#define GPR_POSIX_SOCKETUTILS 1 +#define GPR_POSIX_ENV 1 +#define GPR_POSIX_FILE 1 +#define GPR_POSIX_STRING 1 +#define GPR_POSIX_SUBPROCESS 1 +#define GPR_POSIX_SYNC 1 +#define GPR_POSIX_TIME 1 +#define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_HAVE_MSG_NOSIGNAL 1 +#elif defined(__linux__) +#define GPR_POSIX_CRASH_HANDLER 1 +#define GPR_PLATFORM_STRING "linux" +#ifndef _BSD_SOURCE +#define _BSD_SOURCE +#endif +#ifndef _DEFAULT_SOURCE +#define _DEFAULT_SOURCE +#endif +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include <features.h> +#define GPR_CPU_LINUX 1 +#define GPR_GCC_ATOMIC 1 +#define GPR_GCC_TLS 1 +#define GPR_LINUX 1 +#define GPR_LINUX_MULTIPOLL_WITH_EPOLL 1 +#define GPR_POSIX_WAKEUP_FD 1 +#define GPR_POSIX_SOCKET 1 +#define GPR_POSIX_SOCKETADDR 1 +#ifdef __GLIBC_PREREQ +#if __GLIBC_PREREQ(2, 9) +#define GPR_LINUX_EVENTFD 1 +#endif +#if __GLIBC_PREREQ(2, 10) +#define GPR_LINUX_SOCKETUTILS 1 +#endif +#if __GLIBC_PREREQ(2, 17) +#define GPR_LINUX_ENV 1 +#endif +#endif +#ifndef GPR_LINUX_EVENTFD +#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 +#endif +#ifndef GPR_LINUX_SOCKETUTILS +#define GPR_POSIX_SOCKETUTILS +#endif +#ifndef GPR_LINUX_ENV +#define GPR_POSIX_ENV 1 +#endif +#define GPR_POSIX_FILE 1 +#define GPR_POSIX_STRING 1 +#define GPR_POSIX_SUBPROCESS 1 +#define GPR_POSIX_SYNC 1 +#define GPR_POSIX_TIME 1 +#define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_HAVE_MSG_NOSIGNAL 1 +#ifdef _LP64 +#define GPR_ARCH_64 1 +#else /* _LP64 */ +#define GPR_ARCH_32 1 +#endif /* _LP64 */ +#elif defined(__APPLE__) +#include <TargetConditionals.h> +#ifndef _BSD_SOURCE +#define _BSD_SOURCE +#endif +#define GPR_MSG_IOVLEN_TYPE int +#if TARGET_OS_IPHONE +#define GPR_FORBID_UNREACHABLE_CODE 1 +#define GPR_PLATFORM_STRING "ios" +#define GPR_CPU_IPHONE 1 +#define GPR_PTHREAD_TLS 1 +#else /* TARGET_OS_IPHONE */ +#define GPR_PLATFORM_STRING "osx" +#define GPR_CPU_POSIX 1 +#define GPR_GCC_TLS 1 +#define GPR_POSIX_CRASH_HANDLER 1 +#endif +#define GPR_GCC_ATOMIC 1 +#define GPR_POSIX_LOG 1 +#define GPR_POSIX_MULTIPOLL_WITH_POLL 1 +#define GPR_POSIX_WAKEUP_FD 1 +#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 +#define GPR_POSIX_SOCKET 1 +#define GPR_POSIX_SOCKETADDR 1 +#define GPR_POSIX_SOCKETUTILS 1 +#define GPR_POSIX_ENV 1 +#define GPR_POSIX_FILE 1 +#define GPR_POSIX_STRING 1 +#define GPR_POSIX_SUBPROCESS 1 +#define GPR_POSIX_SYNC 1 +#define GPR_POSIX_TIME 1 +#define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_HAVE_SO_NOSIGPIPE 1 +#ifdef _LP64 +#define GPR_ARCH_64 1 +#else /* _LP64 */ +#define GPR_ARCH_32 1 +#endif /* _LP64 */ +#elif defined(__FreeBSD__) +#define GPR_PLATFORM_STRING "freebsd" +#ifndef _BSD_SOURCE +#define _BSD_SOURCE +#endif +#define GPR_CPU_POSIX 1 +#define GPR_GCC_ATOMIC 1 +#define GPR_GCC_TLS 1 +#define GPR_POSIX_LOG 1 +#define GPR_POSIX_MULTIPOLL_WITH_POLL 1 +#define GPR_POSIX_WAKEUP_FD 1 +#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 +#define GPR_POSIX_SOCKET 1 +#define GPR_POSIX_SOCKETADDR 1 +#define GPR_POSIX_SOCKETUTILS 1 +#define GPR_POSIX_ENV 1 +#define GPR_POSIX_FILE 1 +#define GPR_POSIX_STRING 1 +#define GPR_POSIX_SUBPROCESS 1 +#define GPR_POSIX_SYNC 1 +#define GPR_POSIX_TIME 1 +#define GPR_GETPID_IN_UNISTD_H 1 +#define GPR_HAVE_SO_NOSIGPIPE 1 +#ifdef _LP64 +#define GPR_ARCH_64 1 +#else /* _LP64 */ +#define GPR_ARCH_32 1 +#endif /* _LP64 */ +#else +#error Could not auto-detect platform +#endif +#endif /* GPR_NO_AUTODETECT_PLATFORM */ + +#ifndef GPR_PLATFORM_STRING +#warning "GPR_PLATFORM_STRING not auto-detected" +#define GPR_PLATFORM_STRING "unknown" +#endif + +#ifdef GPR_GCOV +#undef GPR_FORBID_UNREACHABLE_CODE +#define GPR_FORBID_UNREACHABLE_CODE 1 +#endif + +/* For a common case, assume that the platform has a C99-like stdint.h */ + +#include <stdint.h> + +/* Cache line alignment */ +#ifndef GPR_CACHELINE_SIZE_LOG +#if defined(__i386__) || defined(__x86_64__) +#define GPR_CACHELINE_SIZE_LOG 6 +#endif +#ifndef GPR_CACHELINE_SIZE_LOG +/* A reasonable default guess. Note that overestimates tend to waste more + space, while underestimates tend to waste more time. */ +#define GPR_CACHELINE_SIZE_LOG 6 +#endif /* GPR_CACHELINE_SIZE_LOG */ +#endif /* GPR_CACHELINE_SIZE_LOG */ + +#define GPR_CACHELINE_SIZE (1 << GPR_CACHELINE_SIZE_LOG) + +/* scrub GCC_ATOMIC if it's not available on this compiler */ +#if defined(GPR_GCC_ATOMIC) && !defined(__ATOMIC_RELAXED) +#undef GPR_GCC_ATOMIC +#define GPR_GCC_SYNC 1 +#endif + +/* Validate platform combinations */ +#if defined(GPR_GCC_ATOMIC) + defined(GPR_GCC_SYNC) + \ + defined(GPR_WIN32_ATOMIC) != \ + 1 +#error Must define exactly one of GPR_GCC_ATOMIC, GPR_GCC_SYNC, GPR_WIN32_ATOMIC +#endif + +#if defined(GPR_ARCH_32) + defined(GPR_ARCH_64) != 1 +#error Must define exactly one of GPR_ARCH_32, GPR_ARCH_64 +#endif + +#if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WIN32) + \ + defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != \ + 1 +#error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WIN32, GPR_CPU_IPHONE, GPR_CPU_CUSTOM +#endif + +#if defined(GPR_POSIX_MULTIPOLL_WITH_POLL) && !defined(GPR_POSIX_SOCKET) +#error Must define GPR_POSIX_SOCKET to use GPR_POSIX_MULTIPOLL_WITH_POLL +#endif + +#if defined(GPR_POSIX_SOCKET) + defined(GPR_WINSOCK_SOCKET) + \ + defined(GPR_CUSTOM_SOCKET) != \ + 1 +#error Must define exactly one of GPR_POSIX_SOCKET, GPR_WINSOCK_SOCKET, GPR_CUSTOM_SOCKET +#endif + +#if defined(GPR_MSVC_TLS) + defined(GPR_GCC_TLS) + defined(GPR_PTHREAD_TLS) + \ + defined(GPR_CUSTOM_TLS) != \ + 1 +#error Must define exactly one of GPR_MSVC_TLS, GPR_GCC_TLS, GPR_PTHREAD_TLS, GPR_CUSTOM_TLS +#endif + +/* maximum alignment needed for any type on this platform, rounded up to a + power of two */ +#define GPR_MAX_ALIGNMENT 16 + +#ifndef GRPC_MUST_USE_RESULT +#ifdef __GNUC__ +#define GRPC_MUST_USE_RESULT __attribute__((warn_unused_result)) +#else +#define GRPC_MUST_USE_RESULT +#endif +#endif + +#if GPR_FORBID_UNREACHABLE_CODE +#define GPR_UNREACHABLE_CODE(STATEMENT) +#else +#define GPR_UNREACHABLE_CODE(STATEMENT) \ + do { \ + gpr_log(GPR_ERROR, "Should never reach here."); \ + abort(); \ + STATEMENT; \ + } while (0) +#endif /* GPR_FORBID_UNREACHABLE_CODE */ + +#endif /* GRPC_IMPL_CODEGEN_PORT_PLATFORM_H */ diff --git a/include/grpc/impl/codegen/time.h b/include/grpc/impl/codegen/time.h new file mode 100644 index 0000000000..4ca0f3706f --- /dev/null +++ b/include/grpc/impl/codegen/time.h @@ -0,0 +1,128 @@ +/* + * + * Copyright 2015, Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 COPYRIGHT + * OWNER OR CONTRIBUTORS 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 GRPC_IMPL_CODEGEN_TIME_H +#define GRPC_IMPL_CODEGEN_TIME_H +/* Time support. + We use gpr_timespec, which is analogous to struct timespec. On some + machines, absolute times may be in local time. */ + +#include <grpc/impl/codegen/port_platform.h> +#include <stddef.h> +#include <time.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* The clocks we support. */ +typedef enum { + /* Monotonic clock. Epoch undefined. Always moves forwards. */ + GPR_CLOCK_MONOTONIC = 0, + /* Realtime clock. May jump forwards or backwards. Settable by + the system administrator. Has its epoch at 0:00:00 UTC 1 Jan 1970. */ + GPR_CLOCK_REALTIME, + /* CPU cycle time obtained by rdtsc instruction on x86 platforms. Epoch + undefined. Degrades to GPR_CLOCK_REALTIME on other platforms. */ + GPR_CLOCK_PRECISE, + /* Unmeasurable clock type: no base, created by taking the difference + between two times */ + GPR_TIMESPAN +} gpr_clock_type; + +typedef struct gpr_timespec { + int64_t tv_sec; + int32_t tv_nsec; + /** Against which clock was this time measured? (or GPR_TIMESPAN if + this is a relative time meaure) */ + gpr_clock_type clock_type; +} gpr_timespec; + +/* Time constants. */ +gpr_timespec gpr_time_0(gpr_clock_type type); /* The zero time interval. */ +gpr_timespec gpr_inf_future(gpr_clock_type type); /* The far future */ +gpr_timespec gpr_inf_past(gpr_clock_type type); /* The far past. */ + +#define GPR_MS_PER_SEC 1000 +#define GPR_US_PER_SEC 1000000 +#define GPR_NS_PER_SEC 1000000000 +#define GPR_NS_PER_MS 1000000 +#define GPR_NS_PER_US 1000 +#define GPR_US_PER_MS 1000 + +/* initialize time subsystem */ +void gpr_time_init(void); + +/* Return the current time measured from the given clocks epoch. */ +gpr_timespec gpr_now(gpr_clock_type clock); + +/* Convert a timespec from one clock to another */ +gpr_timespec gpr_convert_clock_type(gpr_timespec t, + gpr_clock_type target_clock); + +/* Return -ve, 0, or +ve according to whether a < b, a == b, or a > b + respectively. */ +int gpr_time_cmp(gpr_timespec a, gpr_timespec b); + +gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b); +gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b); + +/* Add and subtract times. Calculations saturate at infinities. */ +gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b); +gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b); + +/* Return a timespec representing a given number of time units. LONG_MIN is + interpreted as gpr_inf_past, and LONG_MAX as gpr_inf_future. */ +gpr_timespec gpr_time_from_micros(long x, gpr_clock_type clock_type); +gpr_timespec gpr_time_from_nanos(long x, gpr_clock_type clock_type); +gpr_timespec gpr_time_from_millis(long x, gpr_clock_type clock_type); +gpr_timespec gpr_time_from_seconds(long x, gpr_clock_type clock_type); +gpr_timespec gpr_time_from_minutes(long x, gpr_clock_type clock_type); +gpr_timespec gpr_time_from_hours(long x, gpr_clock_type clock_type); + +int32_t gpr_time_to_millis(gpr_timespec timespec); + +/* Return 1 if two times are equal or within threshold of each other, + 0 otherwise */ +int gpr_time_similar(gpr_timespec a, gpr_timespec b, gpr_timespec threshold); + +/* Sleep until at least 'until' - an absolute timeout */ +void gpr_sleep_until(gpr_timespec until); + +double gpr_timespec_to_micros(gpr_timespec t); + +#ifdef __cplusplus +} +#endif + +#endif /* GRPC_IMPL_CODEGEN_TIME_H */ diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index 8a30f1da41..7465a0e450 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -34,307 +34,6 @@ #ifndef GRPC_SUPPORT_PORT_PLATFORM_H #define GRPC_SUPPORT_PORT_PLATFORM_H -/* Get windows.h included everywhere (we need it) */ -#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32) -#ifndef WIN32_LEAN_AND_MEAN -#define GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED -#define WIN32_LEAN_AND_MEAN -#endif /* WIN32_LEAN_AND_MEAN */ - -#ifndef NOMINMAX -#define GRPC_NOMINMX_WAS_NOT_DEFINED -#define NOMINMAX -#endif /* NOMINMAX */ - -#ifndef _WIN32_WINNT -#error \ - "Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)" -#else /* !defined(_WIN32_WINNT) */ -#if (_WIN32_WINNT < 0x0600) -#error \ - "Please compile grpc with _WIN32_WINNT of at least 0x600 (aka Windows Vista)" -#endif /* _WIN32_WINNT < 0x0600 */ -#endif /* defined(_WIN32_WINNT) */ - -#include <windows.h> - -#ifdef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED -#undef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED -#undef WIN32_LEAN_AND_MEAN -#endif /* GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED */ - -#ifdef GRPC_NOMINMAX_WAS_NOT_DEFINED -#undef GRPC_NOMINMAX_WAS_NOT_DEFINED -#undef NOMINMAX -#endif /* GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED */ -#endif /* defined(_WIN64) || defined(WIN64) || defined(_WIN32) || \ - defined(WIN32) */ - -/* Override this file with one for your platform if you need to redefine - things. */ - -#if !defined(GPR_NO_AUTODETECT_PLATFORM) -#if defined(_WIN64) || defined(WIN64) -#define GPR_PLATFORM_STRING "windows" -#define GPR_WIN32 1 -#define GPR_ARCH_64 1 -#define GPR_GETPID_IN_PROCESS_H 1 -#define GPR_WINSOCK_SOCKET 1 -#ifdef __GNUC__ -#define GPR_GCC_ATOMIC 1 -#define GPR_GCC_TLS 1 -#else -#define GPR_WIN32_ATOMIC 1 -#define GPR_MSVC_TLS 1 -#endif -#define GPR_WINDOWS_CRASH_HANDLER 1 -#elif defined(_WIN32) || defined(WIN32) -#define GPR_PLATFORM_STRING "windows" -#define GPR_ARCH_32 1 -#define GPR_WIN32 1 -#define GPR_GETPID_IN_PROCESS_H 1 -#define GPR_WINSOCK_SOCKET 1 -#ifdef __GNUC__ -#define GPR_GCC_ATOMIC 1 -#define GPR_GCC_TLS 1 -#else -#define GPR_WIN32_ATOMIC 1 -#define GPR_MSVC_TLS 1 -#endif -#define GPR_WINDOWS_CRASH_HANDLER 1 -#elif defined(ANDROID) || defined(__ANDROID__) -#define GPR_PLATFORM_STRING "android" -#define GPR_ANDROID 1 -#define GPR_ARCH_32 1 -#define GPR_CPU_LINUX 1 -#define GPR_GCC_SYNC 1 -#define GPR_GCC_TLS 1 -#define GPR_POSIX_MULTIPOLL_WITH_POLL 1 -#define GPR_POSIX_WAKEUP_FD 1 -#define GPR_LINUX_EVENTFD 1 -#define GPR_POSIX_SOCKET 1 -#define GPR_POSIX_SOCKETADDR 1 -#define GPR_POSIX_SOCKETUTILS 1 -#define GPR_POSIX_ENV 1 -#define GPR_POSIX_FILE 1 -#define GPR_POSIX_STRING 1 -#define GPR_POSIX_SUBPROCESS 1 -#define GPR_POSIX_SYNC 1 -#define GPR_POSIX_TIME 1 -#define GPR_GETPID_IN_UNISTD_H 1 -#define GPR_HAVE_MSG_NOSIGNAL 1 -#elif defined(__linux__) -#define GPR_POSIX_CRASH_HANDLER 1 -#define GPR_PLATFORM_STRING "linux" -#ifndef _BSD_SOURCE -#define _BSD_SOURCE -#endif -#ifndef _DEFAULT_SOURCE -#define _DEFAULT_SOURCE -#endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include <features.h> -#define GPR_CPU_LINUX 1 -#define GPR_GCC_ATOMIC 1 -#define GPR_GCC_TLS 1 -#define GPR_LINUX 1 -#define GPR_LINUX_MULTIPOLL_WITH_EPOLL 1 -#define GPR_POSIX_WAKEUP_FD 1 -#define GPR_POSIX_SOCKET 1 -#define GPR_POSIX_SOCKETADDR 1 -#ifdef __GLIBC_PREREQ -#if __GLIBC_PREREQ(2, 9) -#define GPR_LINUX_EVENTFD 1 -#endif -#if __GLIBC_PREREQ(2, 10) -#define GPR_LINUX_SOCKETUTILS 1 -#endif -#if __GLIBC_PREREQ(2, 17) -#define GPR_LINUX_ENV 1 -#endif -#endif -#ifndef GPR_LINUX_EVENTFD -#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 -#endif -#ifndef GPR_LINUX_SOCKETUTILS -#define GPR_POSIX_SOCKETUTILS -#endif -#ifndef GPR_LINUX_ENV -#define GPR_POSIX_ENV 1 -#endif -#define GPR_POSIX_FILE 1 -#define GPR_POSIX_STRING 1 -#define GPR_POSIX_SUBPROCESS 1 -#define GPR_POSIX_SYNC 1 -#define GPR_POSIX_TIME 1 -#define GPR_GETPID_IN_UNISTD_H 1 -#define GPR_HAVE_MSG_NOSIGNAL 1 -#ifdef _LP64 -#define GPR_ARCH_64 1 -#else /* _LP64 */ -#define GPR_ARCH_32 1 -#endif /* _LP64 */ -#elif defined(__APPLE__) -#include <TargetConditionals.h> -#ifndef _BSD_SOURCE -#define _BSD_SOURCE -#endif -#define GPR_MSG_IOVLEN_TYPE int -#if TARGET_OS_IPHONE -#define GPR_FORBID_UNREACHABLE_CODE 1 -#define GPR_PLATFORM_STRING "ios" -#define GPR_CPU_IPHONE 1 -#define GPR_PTHREAD_TLS 1 -#else /* TARGET_OS_IPHONE */ -#define GPR_PLATFORM_STRING "osx" -#define GPR_CPU_POSIX 1 -#define GPR_GCC_TLS 1 -#define GPR_POSIX_CRASH_HANDLER 1 -#endif -#define GPR_GCC_ATOMIC 1 -#define GPR_POSIX_LOG 1 -#define GPR_POSIX_MULTIPOLL_WITH_POLL 1 -#define GPR_POSIX_WAKEUP_FD 1 -#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 -#define GPR_POSIX_SOCKET 1 -#define GPR_POSIX_SOCKETADDR 1 -#define GPR_POSIX_SOCKETUTILS 1 -#define GPR_POSIX_ENV 1 -#define GPR_POSIX_FILE 1 -#define GPR_POSIX_STRING 1 -#define GPR_POSIX_SUBPROCESS 1 -#define GPR_POSIX_SYNC 1 -#define GPR_POSIX_TIME 1 -#define GPR_GETPID_IN_UNISTD_H 1 -#define GPR_HAVE_SO_NOSIGPIPE 1 -#ifdef _LP64 -#define GPR_ARCH_64 1 -#else /* _LP64 */ -#define GPR_ARCH_32 1 -#endif /* _LP64 */ -#elif defined(__FreeBSD__) -#define GPR_PLATFORM_STRING "freebsd" -#ifndef _BSD_SOURCE -#define _BSD_SOURCE -#endif -#define GPR_CPU_POSIX 1 -#define GPR_GCC_ATOMIC 1 -#define GPR_GCC_TLS 1 -#define GPR_POSIX_LOG 1 -#define GPR_POSIX_MULTIPOLL_WITH_POLL 1 -#define GPR_POSIX_WAKEUP_FD 1 -#define GPR_POSIX_NO_SPECIAL_WAKEUP_FD 1 -#define GPR_POSIX_SOCKET 1 -#define GPR_POSIX_SOCKETADDR 1 -#define GPR_POSIX_SOCKETUTILS 1 -#define GPR_POSIX_ENV 1 -#define GPR_POSIX_FILE 1 -#define GPR_POSIX_STRING 1 -#define GPR_POSIX_SUBPROCESS 1 -#define GPR_POSIX_SYNC 1 -#define GPR_POSIX_TIME 1 -#define GPR_GETPID_IN_UNISTD_H 1 -#define GPR_HAVE_SO_NOSIGPIPE 1 -#ifdef _LP64 -#define GPR_ARCH_64 1 -#else /* _LP64 */ -#define GPR_ARCH_32 1 -#endif /* _LP64 */ -#else -#error Could not auto-detect platform -#endif -#endif /* GPR_NO_AUTODETECT_PLATFORM */ - -#ifndef GPR_PLATFORM_STRING -#warning "GPR_PLATFORM_STRING not auto-detected" -#define GPR_PLATFORM_STRING "unknown" -#endif - -#ifdef GPR_GCOV -#undef GPR_FORBID_UNREACHABLE_CODE -#define GPR_FORBID_UNREACHABLE_CODE 1 -#endif - -/* For a common case, assume that the platform has a C99-like stdint.h */ - -#include <stdint.h> - -/* Cache line alignment */ -#ifndef GPR_CACHELINE_SIZE_LOG -#if defined(__i386__) || defined(__x86_64__) -#define GPR_CACHELINE_SIZE_LOG 6 -#endif -#ifndef GPR_CACHELINE_SIZE_LOG -/* A reasonable default guess. Note that overestimates tend to waste more - space, while underestimates tend to waste more time. */ -#define GPR_CACHELINE_SIZE_LOG 6 -#endif /* GPR_CACHELINE_SIZE_LOG */ -#endif /* GPR_CACHELINE_SIZE_LOG */ - -#define GPR_CACHELINE_SIZE (1 << GPR_CACHELINE_SIZE_LOG) - -/* scrub GCC_ATOMIC if it's not available on this compiler */ -#if defined(GPR_GCC_ATOMIC) && !defined(__ATOMIC_RELAXED) -#undef GPR_GCC_ATOMIC -#define GPR_GCC_SYNC 1 -#endif - -/* Validate platform combinations */ -#if defined(GPR_GCC_ATOMIC) + defined(GPR_GCC_SYNC) + \ - defined(GPR_WIN32_ATOMIC) != \ - 1 -#error Must define exactly one of GPR_GCC_ATOMIC, GPR_GCC_SYNC, GPR_WIN32_ATOMIC -#endif - -#if defined(GPR_ARCH_32) + defined(GPR_ARCH_64) != 1 -#error Must define exactly one of GPR_ARCH_32, GPR_ARCH_64 -#endif - -#if defined(GPR_CPU_LINUX) + defined(GPR_CPU_POSIX) + defined(GPR_WIN32) + \ - defined(GPR_CPU_IPHONE) + defined(GPR_CPU_CUSTOM) != \ - 1 -#error Must define exactly one of GPR_CPU_LINUX, GPR_CPU_POSIX, GPR_WIN32, GPR_CPU_IPHONE, GPR_CPU_CUSTOM -#endif - -#if defined(GPR_POSIX_MULTIPOLL_WITH_POLL) && !defined(GPR_POSIX_SOCKET) -#error Must define GPR_POSIX_SOCKET to use GPR_POSIX_MULTIPOLL_WITH_POLL -#endif - -#if defined(GPR_POSIX_SOCKET) + defined(GPR_WINSOCK_SOCKET) + \ - defined(GPR_CUSTOM_SOCKET) != \ - 1 -#error Must define exactly one of GPR_POSIX_SOCKET, GPR_WINSOCK_SOCKET, GPR_CUSTOM_SOCKET -#endif - -#if defined(GPR_MSVC_TLS) + defined(GPR_GCC_TLS) + defined(GPR_PTHREAD_TLS) + \ - defined(GPR_CUSTOM_TLS) != \ - 1 -#error Must define exactly one of GPR_MSVC_TLS, GPR_GCC_TLS, GPR_PTHREAD_TLS, GPR_CUSTOM_TLS -#endif - -/* maximum alignment needed for any type on this platform, rounded up to a - power of two */ -#define GPR_MAX_ALIGNMENT 16 - -#ifndef GRPC_MUST_USE_RESULT -#ifdef __GNUC__ -#define GRPC_MUST_USE_RESULT __attribute__((warn_unused_result)) -#else -#define GRPC_MUST_USE_RESULT -#endif -#endif - -#if GPR_FORBID_UNREACHABLE_CODE -#define GPR_UNREACHABLE_CODE(STATEMENT) -#else -#define GPR_UNREACHABLE_CODE(STATEMENT) \ - do { \ - gpr_log(GPR_ERROR, "Should never reach here."); \ - abort(); \ - STATEMENT; \ - } while (0) -#endif /* GPR_FORBID_UNREACHABLE_CODE */ +#include <grpc/impl/codegen/port_platform.h> #endif /* GRPC_SUPPORT_PORT_PLATFORM_H */ diff --git a/include/grpc/support/time.h b/include/grpc/support/time.h index d2607f3e95..b3f2f8cd44 100644 --- a/include/grpc/support/time.h +++ b/include/grpc/support/time.h @@ -33,96 +33,7 @@ #ifndef GRPC_SUPPORT_TIME_H #define GRPC_SUPPORT_TIME_H -/* Time support. - We use gpr_timespec, which is analogous to struct timespec. On some - machines, absolute times may be in local time. */ -#include <grpc/support/port_platform.h> -#include <stddef.h> -#include <time.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* The clocks we support. */ -typedef enum { - /* Monotonic clock. Epoch undefined. Always moves forwards. */ - GPR_CLOCK_MONOTONIC = 0, - /* Realtime clock. May jump forwards or backwards. Settable by - the system administrator. Has its epoch at 0:00:00 UTC 1 Jan 1970. */ - GPR_CLOCK_REALTIME, - /* CPU cycle time obtained by rdtsc instruction on x86 platforms. Epoch - undefined. Degrades to GPR_CLOCK_REALTIME on other platforms. */ - GPR_CLOCK_PRECISE, - /* Unmeasurable clock type: no base, created by taking the difference - between two times */ - GPR_TIMESPAN -} gpr_clock_type; - -typedef struct gpr_timespec { - int64_t tv_sec; - int32_t tv_nsec; - /** Against which clock was this time measured? (or GPR_TIMESPAN if - this is a relative time meaure) */ - gpr_clock_type clock_type; -} gpr_timespec; - -/* Time constants. */ -gpr_timespec gpr_time_0(gpr_clock_type type); /* The zero time interval. */ -gpr_timespec gpr_inf_future(gpr_clock_type type); /* The far future */ -gpr_timespec gpr_inf_past(gpr_clock_type type); /* The far past. */ - -#define GPR_MS_PER_SEC 1000 -#define GPR_US_PER_SEC 1000000 -#define GPR_NS_PER_SEC 1000000000 -#define GPR_NS_PER_MS 1000000 -#define GPR_NS_PER_US 1000 -#define GPR_US_PER_MS 1000 - -/* initialize time subsystem */ -void gpr_time_init(void); - -/* Return the current time measured from the given clocks epoch. */ -gpr_timespec gpr_now(gpr_clock_type clock); - -/* Convert a timespec from one clock to another */ -gpr_timespec gpr_convert_clock_type(gpr_timespec t, - gpr_clock_type target_clock); - -/* Return -ve, 0, or +ve according to whether a < b, a == b, or a > b - respectively. */ -int gpr_time_cmp(gpr_timespec a, gpr_timespec b); - -gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b); -gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b); - -/* Add and subtract times. Calculations saturate at infinities. */ -gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b); -gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b); - -/* Return a timespec representing a given number of time units. LONG_MIN is - interpreted as gpr_inf_past, and LONG_MAX as gpr_inf_future. */ -gpr_timespec gpr_time_from_micros(long x, gpr_clock_type clock_type); -gpr_timespec gpr_time_from_nanos(long x, gpr_clock_type clock_type); -gpr_timespec gpr_time_from_millis(long x, gpr_clock_type clock_type); -gpr_timespec gpr_time_from_seconds(long x, gpr_clock_type clock_type); -gpr_timespec gpr_time_from_minutes(long x, gpr_clock_type clock_type); -gpr_timespec gpr_time_from_hours(long x, gpr_clock_type clock_type); - -int32_t gpr_time_to_millis(gpr_timespec timespec); - -/* Return 1 if two times are equal or within threshold of each other, - 0 otherwise */ -int gpr_time_similar(gpr_timespec a, gpr_timespec b, gpr_timespec threshold); - -/* Sleep until at least 'until' - an absolute timeout */ -void gpr_sleep_until(gpr_timespec until); - -double gpr_timespec_to_micros(gpr_timespec t); - -#ifdef __cplusplus -} -#endif +#include <grpc/impl/codegen/time.h> #endif /* GRPC_SUPPORT_TIME_H */ diff --git a/package.json b/package.json index e0bbb7d80f..7168813b01 100644 --- a/package.json +++ b/package.json @@ -81,6 +81,9 @@ "include/grpc/byte_buffer_reader.h", "include/grpc/compression.h", "include/grpc/grpc.h", + "include/grpc/impl/codegen/connectivity_state.h", + "include/grpc/impl/codegen/port_platform.h", + "include/grpc/impl/codegen/time.h", "include/grpc/status.h", "include/grpc/census.h", "src/core/security/auth_filters.h", diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index c7974d655b..8ed18f9584 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -43,6 +43,7 @@ #include <grpc++/security/credentials.h> #include <grpc++/impl/call.h> #include <grpc++/impl/rpc_method.h> +#include <grpc++/impl/codegen/completion_queue_tag.h> #include <grpc++/support/channel_arguments.h> #include <grpc++/support/config.h> #include <grpc++/support/status.h> diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index a175beb452..420d1160f0 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -37,6 +37,7 @@ #include <grpc/grpc.h> #include <grpc/support/log.h> #include <grpc++/support/time.h> +#include <grpc++/impl/codegen/completion_queue_tag.h> namespace grpc { diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index a9a49f7af4..1a041133bd 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -43,6 +43,7 @@ #include <grpc++/impl/method_handler_impl.h> #include <grpc++/impl/rpc_service_method.h> #include <grpc++/impl/service_type.h> +#include <grpc++/impl/codegen/completion_queue_tag.h> #include <grpc++/server_context.h> #include <grpc++/security/server_credentials.h> #include <grpc++/support/time.h> diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c index 1e1524d098..1e14ac3410 100644 --- a/test/core/surface/public_headers_must_be_c89.c +++ b/test/core/surface/public_headers_must_be_c89.c @@ -37,6 +37,9 @@ #include <grpc/compression.h> #include <grpc/grpc.h> #include <grpc/grpc_security.h> +#include <grpc/impl/codegen/connectivity_state.h> +#include <grpc/impl/codegen/port_platform.h> +#include <grpc/impl/codegen/time.h> #include <grpc/status.h> #include <grpc/support/alloc.h> #include <grpc/support/atm.h> diff --git a/test/cpp/common/alarm_test.cc b/test/cpp/common/alarm_test.cc index d41a25a63c..9056809a20 100644 --- a/test/cpp/common/alarm_test.cc +++ b/test/cpp/common/alarm_test.cc @@ -35,6 +35,7 @@ #include <grpc++/completion_queue.h> #include <gtest/gtest.h> +#include <grpc++/completion_queue.h> #include "test/core/util/test_config.h" namespace grpc { diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 09da8812f5..c1d9fa1bac 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -769,8 +769,14 @@ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ +include/grpc++/impl/codegen/call_hook.h \ include/grpc++/impl/codegen/channel_interface.h \ +include/grpc++/impl/codegen/completion_queue_tag.h \ +include/grpc++/impl/codegen/config.h \ include/grpc++/impl/codegen/server_interface.h \ +include/grpc++/impl/codegen/status.h \ +include/grpc++/impl/codegen/status_code_enum.h \ +include/grpc++/impl/codegen/time.h \ include/grpc++/impl/grpc_library.h \ include/grpc++/impl/method_handler_impl.h \ include/grpc++/impl/proto_utils.h \ diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 7ec8a0e695..92080e6938 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -769,8 +769,14 @@ include/grpc++/generic/generic_stub.h \ include/grpc++/grpc++.h \ include/grpc++/impl/call.h \ include/grpc++/impl/client_unary_call.h \ +include/grpc++/impl/codegen/call_hook.h \ include/grpc++/impl/codegen/channel_interface.h \ +include/grpc++/impl/codegen/completion_queue_tag.h \ +include/grpc++/impl/codegen/config.h \ include/grpc++/impl/codegen/server_interface.h \ +include/grpc++/impl/codegen/status.h \ +include/grpc++/impl/codegen/status_code_enum.h \ +include/grpc++/impl/codegen/time.h \ include/grpc++/impl/grpc_library.h \ include/grpc++/impl/method_handler_impl.h \ include/grpc++/impl/proto_utils.h \ diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index 3a1d097fb9..8ce9dd5e92 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -765,6 +765,9 @@ include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ include/grpc/grpc.h \ +include/grpc/impl/codegen/connectivity_state.h \ +include/grpc/impl/codegen/port_platform.h \ +include/grpc/impl/codegen/time.h \ include/grpc/status.h \ include/grpc/census.h \ include/grpc/support/alloc.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 2280fde425..a2b37c9c1c 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -765,6 +765,9 @@ include/grpc/byte_buffer.h \ include/grpc/byte_buffer_reader.h \ include/grpc/compression.h \ include/grpc/grpc.h \ +include/grpc/impl/codegen/connectivity_state.h \ +include/grpc/impl/codegen/port_platform.h \ +include/grpc/impl/codegen/time.h \ include/grpc/status.h \ include/grpc/census.h \ src/core/security/auth_filters.h \ diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json index 19c3fb689f..476ccbec27 100644 --- a/tools/run_tests/sources_and_headers.json +++ b/tools/run_tests/sources_and_headers.json @@ -2888,6 +2888,9 @@ "include/grpc/compression.h", "include/grpc/grpc.h", "include/grpc/grpc_security.h", + "include/grpc/impl/codegen/connectivity_state.h", + "include/grpc/impl/codegen/port_platform.h", + "include/grpc/impl/codegen/time.h", "include/grpc/status.h", "src/core/census/aggregation.h", "src/core/census/context.h", @@ -3029,6 +3032,9 @@ "include/grpc/compression.h", "include/grpc/grpc.h", "include/grpc/grpc_security.h", + "include/grpc/impl/codegen/connectivity_state.h", + "include/grpc/impl/codegen/port_platform.h", + "include/grpc/impl/codegen/time.h", "include/grpc/status.h", "src/core/census/aggregation.h", "src/core/census/context.c", @@ -3401,6 +3407,9 @@ "include/grpc/census.h", "include/grpc/compression.h", "include/grpc/grpc.h", + "include/grpc/impl/codegen/connectivity_state.h", + "include/grpc/impl/codegen/port_platform.h", + "include/grpc/impl/codegen/time.h", "include/grpc/status.h", "src/core/census/aggregation.h", "src/core/census/context.h", @@ -3527,6 +3536,9 @@ "include/grpc/census.h", "include/grpc/compression.h", "include/grpc/grpc.h", + "include/grpc/impl/codegen/connectivity_state.h", + "include/grpc/impl/codegen/port_platform.h", + "include/grpc/impl/codegen/time.h", "include/grpc/status.h", "src/core/census/aggregation.h", "src/core/census/context.c", @@ -3844,8 +3856,14 @@ "include/grpc++/grpc++.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", + "include/grpc++/impl/codegen/call_hook.h", "include/grpc++/impl/codegen/channel_interface.h", + "include/grpc++/impl/codegen/completion_queue_tag.h", + "include/grpc++/impl/codegen/config.h", "include/grpc++/impl/codegen/server_interface.h", + "include/grpc++/impl/codegen/status.h", + "include/grpc++/impl/codegen/status_code_enum.h", + "include/grpc++/impl/codegen/time.h", "include/grpc++/impl/grpc_library.h", "include/grpc++/impl/method_handler_impl.h", "include/grpc++/impl/proto_utils.h", @@ -3901,8 +3919,14 @@ "include/grpc++/grpc++.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", + "include/grpc++/impl/codegen/call_hook.h", "include/grpc++/impl/codegen/channel_interface.h", + "include/grpc++/impl/codegen/completion_queue_tag.h", + "include/grpc++/impl/codegen/config.h", "include/grpc++/impl/codegen/server_interface.h", + "include/grpc++/impl/codegen/status.h", + "include/grpc++/impl/codegen/status_code_enum.h", + "include/grpc++/impl/codegen/time.h", "include/grpc++/impl/grpc_library.h", "include/grpc++/impl/method_handler_impl.h", "include/grpc++/impl/proto_utils.h", @@ -4042,8 +4066,14 @@ "include/grpc++/grpc++.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", + "include/grpc++/impl/codegen/call_hook.h", "include/grpc++/impl/codegen/channel_interface.h", + "include/grpc++/impl/codegen/completion_queue_tag.h", + "include/grpc++/impl/codegen/config.h", "include/grpc++/impl/codegen/server_interface.h", + "include/grpc++/impl/codegen/status.h", + "include/grpc++/impl/codegen/status_code_enum.h", + "include/grpc++/impl/codegen/time.h", "include/grpc++/impl/grpc_library.h", "include/grpc++/impl/method_handler_impl.h", "include/grpc++/impl/proto_utils.h", @@ -4096,8 +4126,14 @@ "include/grpc++/grpc++.h", "include/grpc++/impl/call.h", "include/grpc++/impl/client_unary_call.h", + "include/grpc++/impl/codegen/call_hook.h", "include/grpc++/impl/codegen/channel_interface.h", + "include/grpc++/impl/codegen/completion_queue_tag.h", + "include/grpc++/impl/codegen/config.h", "include/grpc++/impl/codegen/server_interface.h", + "include/grpc++/impl/codegen/status.h", + "include/grpc++/impl/codegen/status_code_enum.h", + "include/grpc++/impl/codegen/time.h", "include/grpc++/impl/grpc_library.h", "include/grpc++/impl/method_handler_impl.h", "include/grpc++/impl/proto_utils.h", diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj b/vsprojects/vcxproj/grpc++/grpc++.vcxproj index 2f6dce0e9b..074bb8226f 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj @@ -267,8 +267,14 @@ <ClInclude Include="$(SolutionDir)\..\include\grpc++\grpc++.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\call.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\client_unary_call.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\call_hook.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\channel_interface.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\completion_queue_tag.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\config.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\server_interface.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\status.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\status_code_enum.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\time.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\grpc_library.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\method_handler_impl.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\proto_utils.h" /> diff --git a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters index 8c00ea846b..e3ba7ae42e 100644 --- a/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++/grpc++.vcxproj.filters @@ -126,12 +126,30 @@ <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\client_unary_call.h"> <Filter>include\grpc++\impl</Filter> </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\call_hook.h"> + <Filter>include\grpc++\impl\codegen</Filter> + </ClInclude> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\channel_interface.h"> <Filter>include\grpc++\impl\codegen</Filter> </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\completion_queue_tag.h"> + <Filter>include\grpc++\impl\codegen</Filter> + </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\config.h"> + <Filter>include\grpc++\impl\codegen</Filter> + </ClInclude> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\server_interface.h"> <Filter>include\grpc++\impl\codegen</Filter> </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\status.h"> + <Filter>include\grpc++\impl\codegen</Filter> + </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\status_code_enum.h"> + <Filter>include\grpc++\impl\codegen</Filter> + </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\time.h"> + <Filter>include\grpc++\impl\codegen</Filter> + </ClInclude> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\grpc_library.h"> <Filter>include\grpc++\impl</Filter> </ClInclude> diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj index 1aed7b98bf..8b7215fc14 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj @@ -267,8 +267,14 @@ <ClInclude Include="$(SolutionDir)\..\include\grpc++\grpc++.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\call.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\client_unary_call.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\call_hook.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\channel_interface.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\completion_queue_tag.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\config.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\server_interface.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\status.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\status_code_enum.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\time.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\grpc_library.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\method_handler_impl.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\proto_utils.h" /> diff --git a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters index 8d1a5174dd..4113f275bc 100644 --- a/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc++_unsecure/grpc++_unsecure.vcxproj.filters @@ -111,12 +111,30 @@ <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\client_unary_call.h"> <Filter>include\grpc++\impl</Filter> </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\call_hook.h"> + <Filter>include\grpc++\impl\codegen</Filter> + </ClInclude> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\channel_interface.h"> <Filter>include\grpc++\impl\codegen</Filter> </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\completion_queue_tag.h"> + <Filter>include\grpc++\impl\codegen</Filter> + </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\config.h"> + <Filter>include\grpc++\impl\codegen</Filter> + </ClInclude> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\server_interface.h"> <Filter>include\grpc++\impl\codegen</Filter> </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\status.h"> + <Filter>include\grpc++\impl\codegen</Filter> + </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\status_code_enum.h"> + <Filter>include\grpc++\impl\codegen</Filter> + </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\codegen\time.h"> + <Filter>include\grpc++\impl\codegen</Filter> + </ClInclude> <ClInclude Include="$(SolutionDir)\..\include\grpc++\impl\grpc_library.h"> <Filter>include\grpc++\impl</Filter> </ClInclude> diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj index 8d6800e9d3..18c0f0170a 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj @@ -272,6 +272,9 @@ <ClInclude Include="$(SolutionDir)\..\include\grpc\byte_buffer_reader.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc\compression.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc\grpc.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\connectivity_state.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\port_platform.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\time.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc\status.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc\census.h" /> </ItemGroup> diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters index f29f881595..4a35c08dcd 100644 --- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters +++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters @@ -471,6 +471,15 @@ <ClInclude Include="$(SolutionDir)\..\include\grpc\grpc.h"> <Filter>include\grpc</Filter> </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\connectivity_state.h"> + <Filter>include\grpc\impl\codegen</Filter> + </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\port_platform.h"> + <Filter>include\grpc\impl\codegen</Filter> + </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\time.h"> + <Filter>include\grpc\impl\codegen</Filter> + </ClInclude> <ClInclude Include="$(SolutionDir)\..\include\grpc\status.h"> <Filter>include\grpc</Filter> </ClInclude> @@ -878,6 +887,12 @@ <Filter Include="include\grpc"> <UniqueIdentifier>{880c644d-b84f-cfca-98bd-e145f36232ab}</UniqueIdentifier> </Filter> + <Filter Include="include\grpc\impl"> + <UniqueIdentifier>{38832702-fee1-b2bc-75d3-923e748dcde9}</UniqueIdentifier> + </Filter> + <Filter Include="include\grpc\impl\codegen"> + <UniqueIdentifier>{def748f5-ed2a-a9bb-40d9-c31d00f0e13b}</UniqueIdentifier> + </Filter> <Filter Include="src"> <UniqueIdentifier>{d538af37-07b2-062b-fa2a-d9f882cb2737}</UniqueIdentifier> </Filter> diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj index 78ffe148e5..8d9e6d1daa 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj @@ -262,6 +262,9 @@ <ClInclude Include="$(SolutionDir)\..\include\grpc\byte_buffer_reader.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc\compression.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc\grpc.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\connectivity_state.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\port_platform.h" /> + <ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\time.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc\status.h" /> <ClInclude Include="$(SolutionDir)\..\include\grpc\census.h" /> </ItemGroup> diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters index e068c3fe18..558bfca371 100644 --- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters +++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters @@ -408,6 +408,15 @@ <ClInclude Include="$(SolutionDir)\..\include\grpc\grpc.h"> <Filter>include\grpc</Filter> </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\connectivity_state.h"> + <Filter>include\grpc\impl\codegen</Filter> + </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\port_platform.h"> + <Filter>include\grpc\impl\codegen</Filter> + </ClInclude> + <ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\time.h"> + <Filter>include\grpc\impl\codegen</Filter> + </ClInclude> <ClInclude Include="$(SolutionDir)\..\include\grpc\status.h"> <Filter>include\grpc</Filter> </ClInclude> @@ -773,6 +782,12 @@ <Filter Include="include\grpc"> <UniqueIdentifier>{77b9717b-b8d8-dd5f-14bb-a3e96809a70a}</UniqueIdentifier> </Filter> + <Filter Include="include\grpc\impl"> + <UniqueIdentifier>{10cfa248-c60f-376f-e7ae-2a7d7d8e81f5}</UniqueIdentifier> + </Filter> + <Filter Include="include\grpc\impl\codegen"> + <UniqueIdentifier>{03cc6735-c734-7017-4000-a435f29d55c3}</UniqueIdentifier> + </Filter> <Filter Include="src"> <UniqueIdentifier>{aaf326a1-c884-46ea-875a-cbbd9983e539}</UniqueIdentifier> </Filter> |