aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-02-12 19:22:31 -0800
committerGravatar ncteisen <ncteisen@gmail.com>2018-02-13 09:27:35 -0800
commitac86f043735ea75a5ad79283ef50042d7448f04f (patch)
tree36662eebf21edb8ca8161b10f45101d026fc95a9 /include
parentbc43b0e683678d47e14e1ecd9a2aba0ab7abc7cd (diff)
parent1b05b412688b7ae825eab8f91af042a24d4e18f4 (diff)
Merge branch 'master' of https://github.com/grpc/grpc into channel-tracing
Diffstat (limited to 'include')
-rw-r--r--include/grpc++/alarm.h49
-rw-r--r--include/grpc++/generic/generic_stub.h19
-rw-r--r--include/grpc++/impl/codegen/client_context.h13
-rw-r--r--include/grpc++/impl/codegen/completion_queue.h115
-rw-r--r--include/grpc++/impl/codegen/proto_utils.h14
-rw-r--r--include/grpc++/impl/codegen/server_context.h9
-rw-r--r--include/grpc++/server_builder.h1
-rw-r--r--include/grpc/compression_ruby.h48
-rw-r--r--include/grpc/grpc.h19
-rw-r--r--include/grpc/impl/codegen/compression_types.h5
-rw-r--r--include/grpc/impl/codegen/grpc_types.h5
-rw-r--r--include/grpc/module.modulemap10
-rw-r--r--include/grpc/support/avl.h102
-rw-r--r--include/grpc/support/cmdline.h88
-rw-r--r--include/grpc/support/host_port.h51
-rw-r--r--include/grpc/support/subprocess.h44
-rw-r--r--include/grpc/support/tls.h68
-rw-r--r--include/grpc/support/tls_gcc.h50
-rw-r--r--include/grpc/support/tls_msvc.h50
-rw-r--r--include/grpc/support/tls_pthread.h54
-rw-r--r--include/grpc/support/useful.h65
21 files changed, 135 insertions, 744 deletions
diff --git a/include/grpc++/alarm.h b/include/grpc++/alarm.h
index b43425e224..37d4189201 100644
--- a/include/grpc++/alarm.h
+++ b/include/grpc++/alarm.h
@@ -28,17 +28,16 @@
#include <grpc++/impl/grpc_library.h>
#include <grpc/grpc.h>
-struct grpc_alarm;
-
namespace grpc {
-class CompletionQueue;
-
/// A thin wrapper around \a grpc_alarm (see / \a / src/core/surface/alarm.h).
class Alarm : private GrpcLibraryCodegen {
public:
/// Create an unset completion queue alarm
- Alarm() : tag_(nullptr), alarm_(grpc_alarm_create(nullptr)) {}
+ Alarm();
+
+ /// Destroy the given completion queue alarm, cancelling it in the process.
+ ~Alarm();
/// DEPRECATED: Create and set a completion queue alarm instance associated to
/// \a cq.
@@ -48,10 +47,8 @@ class Alarm : private GrpcLibraryCodegen {
/// internal::GrpcLibraryInitializer instance would need to be introduced
/// here. \endinternal.
template <typename T>
- Alarm(CompletionQueue* cq, const T& deadline, void* tag)
- : tag_(tag), alarm_(grpc_alarm_create(nullptr)) {
- grpc_alarm_set(alarm_, cq->cq(), TimePoint<T>(deadline).raw_time(),
- static_cast<void*>(&tag_), nullptr);
+ Alarm(CompletionQueue* cq, const T& deadline, void* tag) : Alarm() {
+ SetInternal(cq, TimePoint<T>(deadline).raw_time(), tag);
}
/// Trigger an alarm instance on completion queue \a cq at the specified time.
@@ -60,9 +57,7 @@ class Alarm : private GrpcLibraryCodegen {
/// event's success bit will be true, false otherwise (ie, upon cancellation).
template <typename T>
void Set(CompletionQueue* cq, const T& deadline, void* tag) {
- tag_.Set(tag);
- grpc_alarm_set(alarm_, cq->cq(), TimePoint<T>(deadline).raw_time(),
- static_cast<void*>(&tag_), nullptr);
+ SetInternal(cq, TimePoint<T>(deadline).raw_time(), tag);
}
/// Alarms aren't copyable.
@@ -70,43 +65,21 @@ class Alarm : private GrpcLibraryCodegen {
Alarm& operator=(const Alarm&) = delete;
/// Alarms are movable.
- Alarm(Alarm&& rhs) : tag_(rhs.tag_), alarm_(rhs.alarm_) {
- rhs.alarm_ = nullptr;
- }
+ Alarm(Alarm&& rhs) : alarm_(rhs.alarm_) { rhs.alarm_ = nullptr; }
Alarm& operator=(Alarm&& rhs) {
- tag_ = rhs.tag_;
alarm_ = rhs.alarm_;
rhs.alarm_ = nullptr;
return *this;
}
- /// Destroy the given completion queue alarm, cancelling it in the process.
- ~Alarm() {
- if (alarm_ != nullptr) grpc_alarm_destroy(alarm_, nullptr);
- }
-
/// Cancel a completion queue alarm. Calling this function over an alarm that
/// has already fired has no effect.
- void Cancel() {
- if (alarm_ != nullptr) grpc_alarm_cancel(alarm_, nullptr);
- }
+ void Cancel();
private:
- class AlarmEntry : public internal::CompletionQueueTag {
- public:
- AlarmEntry(void* tag) : tag_(tag) {}
- void Set(void* tag) { tag_ = tag; }
- bool FinalizeResult(void** tag, bool* status) override {
- *tag = tag_;
- return true;
- }
-
- private:
- void* tag_;
- };
+ void SetInternal(CompletionQueue* cq, gpr_timespec deadline, void* tag);
- AlarmEntry tag_;
- grpc_alarm* alarm_; // owned
+ internal::CompletionQueueTag* alarm_;
};
} // namespace grpc
diff --git a/include/grpc++/generic/generic_stub.h b/include/grpc++/generic/generic_stub.h
index d5064318cf..e72826bdc1 100644
--- a/include/grpc++/generic/generic_stub.h
+++ b/include/grpc++/generic/generic_stub.h
@@ -37,15 +37,6 @@ class GenericStub final {
explicit GenericStub(std::shared_ptr<ChannelInterface> channel)
: channel_(channel) {}
- /// Begin a call to a named method \a method using \a context.
- /// A tag \a tag will be delivered to \a cq when the call has been started
- /// (i.e, initial metadata has been sent).
- /// The return value only indicates whether or not registration of the call
- /// succeeded (i.e. the call won't proceed if the return value is nullptr).
- std::unique_ptr<GenericClientAsyncReaderWriter> Call(
- ClientContext* context, const grpc::string& method, CompletionQueue* cq,
- void* tag);
-
/// Setup a call to a named method \a method using \a context, but don't
/// start it. Let it be started explicitly with StartCall and a tag.
/// The return value only indicates whether or not registration of the call
@@ -61,6 +52,16 @@ class GenericStub final {
ClientContext* context, const grpc::string& method,
const ByteBuffer& request, CompletionQueue* cq);
+ /// DEPRECATED for multi-threaded use
+ /// Begin a call to a named method \a method using \a context.
+ /// A tag \a tag will be delivered to \a cq when the call has been started
+ /// (i.e, initial metadata has been sent).
+ /// The return value only indicates whether or not registration of the call
+ /// succeeded (i.e. the call won't proceed if the return value is nullptr).
+ std::unique_ptr<GenericClientAsyncReaderWriter> Call(
+ ClientContext* context, const grpc::string& method, CompletionQueue* cq,
+ void* tag);
+
private:
std::shared_ptr<ChannelInterface> channel_;
};
diff --git a/include/grpc++/impl/codegen/client_context.h b/include/grpc++/impl/codegen/client_context.h
index 61d97ce818..38cce27b99 100644
--- a/include/grpc++/impl/codegen/client_context.h
+++ b/include/grpc++/impl/codegen/client_context.h
@@ -289,7 +289,9 @@ class ClientContext {
creds_ = creds;
}
- /// Return the compression algorithm to be used by the client call.
+ /// Return the compression algorithm the client call will request be used.
+ /// Note that the gRPC runtime may decide to ignore this request, for example,
+ /// due to resource constraints.
grpc_compression_algorithm compression_algorithm() const {
return compression_algorithm_;
}
@@ -302,7 +304,10 @@ class ClientContext {
/// Flag whether the initial metadata should be \a corked
///
/// If \a corked is true, then the initial metadata will be coalesced with the
- /// write of first message in the stream.
+ /// write of first message in the stream. As a result, any tag set for the
+ /// initial metadata operation (starting a client-streaming or bidi-streaming
+ /// RPC) will not actually be sent to the completion queue or delivered
+ /// via Next.
///
/// \param corked The flag indicating whether the initial metadata is to be
/// corked or not.
@@ -330,6 +335,10 @@ class ClientContext {
/// already finished, it may still return success.
///
/// There is no guarantee the call will be cancelled.
+ ///
+ /// Note that TryCancel() does not change any of the tags that are pending
+ /// on the completion queue. All pending tags will still be delivered
+ /// (though their ok result may reflect the effect of cancellation).
void TryCancel();
/// Global Callbacks
diff --git a/include/grpc++/impl/codegen/completion_queue.h b/include/grpc++/impl/codegen/completion_queue.h
index b8a7862578..83477d0489 100644
--- a/include/grpc++/impl/codegen/completion_queue.h
+++ b/include/grpc++/impl/codegen/completion_queue.h
@@ -111,12 +111,83 @@ class CompletionQueue : private GrpcLibraryCodegen {
/// Tri-state return for AsyncNext: SHUTDOWN, GOT_EVENT, TIMEOUT.
enum NextStatus {
- SHUTDOWN, ///< The completion queue has been shutdown.
+ SHUTDOWN, ///< The completion queue has been shutdown and fully-drained
GOT_EVENT, ///< Got a new event; \a tag will be filled in with its
///< associated value; \a ok indicating its success.
TIMEOUT ///< deadline was reached.
};
+ /// Read from the queue, blocking until an event is available or the queue is
+ /// shutting down.
+ ///
+ /// \param tag[out] Updated to point to the read event's tag.
+ /// \param ok[out] true if read a successful event, false otherwise.
+ ///
+ /// Note that each tag sent to the completion queue (through RPC operations
+ /// or alarms) will be delivered out of the completion queue by a call to
+ /// Next (or a related method), regardless of whether the operation succeeded
+ /// or not. Success here means that this operation completed in the normal
+ /// valid manner.
+ ///
+ /// Server-side RPC request: \a ok indicates that the RPC has indeed
+ /// been started. If it is false, the server has been Shutdown
+ /// before this particular call got matched to an incoming RPC.
+ ///
+ /// Client-side StartCall/RPC invocation: \a ok indicates that the RPC is
+ /// going to go to the wire. If it is false, it not going to the wire. This
+ /// would happen if the channel is either permanently broken or
+ /// transiently broken but with the fail-fast option. (Note that async unary
+ /// RPCs don't post a CQ tag at this point, nor do client-streaming
+ /// or bidi-streaming RPCs that have the initial metadata corked option set.)
+ ///
+ /// Client-side Write, Client-side WritesDone, Server-side Write,
+ /// Server-side Finish, Server-side SendInitialMetadata (which is
+ /// typically included in Write or Finish when not done explicitly):
+ /// \a ok means that the data/metadata/status/etc is going to go to the
+ /// wire. If it is false, it not going to the wire because the call
+ /// is already dead (i.e., canceled, deadline expired, other side
+ /// dropped the channel, etc).
+ ///
+ /// Client-side Read, Server-side Read, Client-side
+ /// RecvInitialMetadata (which is typically included in Read if not
+ /// done explicitly): \a ok indicates whether there is a valid message
+ /// that got read. If not, you know that there are certainly no more
+ /// messages that can ever be read from this stream. For the client-side
+ /// operations, this only happens because the call is dead. For the
+ /// server-sider operation, though, this could happen because the client
+ /// has done a WritesDone already.
+ ///
+ /// Client-side Finish: \a ok should always be true
+ ///
+ /// Server-side AsyncNotifyWhenDone: \a ok should always be true
+ ///
+ /// Alarm: \a ok is true if it expired, false if it was canceled
+ ///
+ /// \return true if got an event, false if the queue is fully drained and
+ /// shut down.
+ bool Next(void** tag, bool* ok) {
+ return (AsyncNextInternal(tag, ok,
+ g_core_codegen_interface->gpr_inf_future(
+ GPR_CLOCK_REALTIME)) != SHUTDOWN);
+ }
+
+ /// Read from the queue, blocking up to \a deadline (or the queue's shutdown).
+ /// Both \a tag and \a ok are updated upon success (if an event is available
+ /// within the \a deadline). A \a tag points to an arbitrary location usually
+ /// employed to uniquely identify an event.
+ ///
+ /// \param tag[out] Upon sucess, updated to point to the event's tag.
+ /// \param ok[out] Upon sucess, true if a successful event, false otherwise
+ /// See documentation for CompletionQueue::Next for explanation of ok
+ /// \param deadline[in] How long to block in wait for an event.
+ ///
+ /// \return The type of event read.
+ template <typename T>
+ NextStatus AsyncNext(void** tag, bool* ok, const T& deadline) {
+ TimePoint<T> deadline_tp(deadline);
+ return AsyncNextInternal(tag, ok, deadline_tp.raw_time());
+ }
+
/// EXPERIMENTAL
/// First executes \a F, then reads from the queue, blocking up to
/// \a deadline (or the queue's shutdown).
@@ -141,44 +212,16 @@ class CompletionQueue : private GrpcLibraryCodegen {
}
}
- /// Read from the queue, blocking up to \a deadline (or the queue's shutdown).
- /// Both \a tag and \a ok are updated upon success (if an event is available
- /// within the \a deadline). A \a tag points to an arbitrary location usually
- /// employed to uniquely identify an event.
- ///
- /// \param tag[out] Upon sucess, updated to point to the event's tag.
- /// \param ok[out] Upon sucess, true if read a regular event, false otherwise.
- /// \param deadline[in] How long to block in wait for an event.
- ///
- /// \return The type of event read.
- template <typename T>
- NextStatus AsyncNext(void** tag, bool* ok, const T& deadline) {
- TimePoint<T> deadline_tp(deadline);
- return AsyncNextInternal(tag, ok, deadline_tp.raw_time());
- }
-
- /// Read from the queue, blocking until an event is available or the queue is
- /// shutting down.
- ///
- /// \param tag[out] Updated to point to the read event's tag.
- /// \param ok[out] true if read a regular event, false otherwise.
- ///
- /// \return true if read a regular event, false if the queue is shutting down.
- bool Next(void** tag, bool* ok) {
- return (AsyncNextInternal(tag, ok,
- g_core_codegen_interface->gpr_inf_future(
- GPR_CLOCK_REALTIME)) != SHUTDOWN);
- }
-
/// Request the shutdown of the queue.
///
/// \warning This method must be called at some point if this completion queue
- /// is accessed with Next or AsyncNext. Once invoked, \a Next
- /// will start to return false and \a AsyncNext will return \a
- /// NextStatus::SHUTDOWN. Only once either one of these methods does that
- /// (that is, once the queue has been \em drained) can an instance of this
- /// class be destroyed. Also note that applications must ensure that
- /// no work is enqueued on this completion queue after this method is called.
+ /// is accessed with Next or AsyncNext. \a Next will not return false
+ /// until this method has been called and all pending tags have been drained.
+ /// (Likewise for \a AsyncNext returning \a NextStatus::SHUTDOWN .)
+ /// Only once either one of these methods does that (that is, once the queue
+ /// has been \em drained) can an instance of this class be destroyed.
+ /// Also note that applications must ensure that no work is enqueued on this
+ /// completion queue after this method is called.
void Shutdown();
/// Returns a \em raw pointer to the underlying \a grpc_completion_queue
diff --git a/include/grpc++/impl/codegen/proto_utils.h b/include/grpc++/impl/codegen/proto_utils.h
index b7636034d4..209250bba2 100644
--- a/include/grpc++/impl/codegen/proto_utils.h
+++ b/include/grpc++/impl/codegen/proto_utils.h
@@ -59,18 +59,22 @@ class GrpcBufferWriter : public ::grpc::protobuf::io::ZeroCopyOutputStream {
bool Next(void** data, int* size) override {
// Protobuf should not ask for more memory than total_size_.
GPR_CODEGEN_ASSERT(byte_count_ < total_size_);
+ size_t remain = total_size_ - byte_count_;
if (have_backup_) {
slice_ = backup_slice_;
have_backup_ = false;
+ if (GRPC_SLICE_LENGTH(slice_) > remain) {
+ GRPC_SLICE_SET_LENGTH(slice_, remain);
+ }
} else {
// When less than a whole block is needed, only allocate that much.
// But make sure the allocated slice is not inlined.
- size_t remain = total_size_ - byte_count_ > block_size_
- ? block_size_
- : total_size_ - byte_count_;
+ size_t allocate_length =
+ remain > static_cast<size_t>(block_size_) ? block_size_ : remain;
slice_ = g_core_codegen_interface->grpc_slice_malloc(
- remain > GRPC_SLICE_INLINED_SIZE ? remain
- : GRPC_SLICE_INLINED_SIZE + 1);
+ allocate_length > GRPC_SLICE_INLINED_SIZE
+ ? allocate_length
+ : GRPC_SLICE_INLINED_SIZE + 1);
}
*data = GRPC_SLICE_START_PTR(slice_);
// On win x64, int is only 32bit
diff --git a/include/grpc++/impl/codegen/server_context.h b/include/grpc++/impl/codegen/server_context.h
index a2d6967bf8..57347f4fcd 100644
--- a/include/grpc++/impl/codegen/server_context.h
+++ b/include/grpc++/impl/codegen/server_context.h
@@ -151,6 +151,10 @@ class ServerContext {
/// The only exception is that if the serverhandler is already returning an
/// error status code, it is ok to not return Status::CANCELLED even if
/// TryCancel() was called.
+ ///
+ /// Note that TryCancel() does not change any of the tags that are pending
+ /// on the completion queue. All pending tags will still be delivered
+ /// (though their ok result may reflect the effect of cancellation).
void TryCancel() const;
/// Return a collection of initial metadata key-value pairs sent from the
@@ -185,7 +189,10 @@ class ServerContext {
/// \a set_compression_level.
bool compression_level_set() const { return compression_level_set_; }
- /// Return the compression algorithm to be used by the server call.
+ /// Return the compression algorithm the server call will request be used.
+ /// Note that the gRPC runtime may decide to ignore this request, for example,
+ /// due to resource constraints, or if the server is aware the client doesn't
+ /// support the requested algorithm.
grpc_compression_algorithm compression_algorithm() const {
return compression_algorithm_;
}
diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h
index e2bae4b41f..ea9834c179 100644
--- a/include/grpc++/server_builder.h
+++ b/include/grpc++/server_builder.h
@@ -30,7 +30,6 @@
#include <grpc++/support/config.h>
#include <grpc/compression.h>
#include <grpc/support/cpu.h>
-#include <grpc/support/useful.h>
#include <grpc/support/workaround_list.h>
struct grpc_resource_quota;
diff --git a/include/grpc/compression_ruby.h b/include/grpc/compression_ruby.h
deleted file mode 100644
index b063b2b529..0000000000
--- a/include/grpc/compression_ruby.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Copyright 2017 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_COMPRESSION_RUBY_H
-#define GRPC_COMPRESSION_RUBY_H
-
-#include <grpc/impl/codegen/port_platform.h>
-
-#include <grpc/impl/codegen/compression_types.h>
-#include <grpc/slice.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Parses the \a slice as a grpc_compression_algorithm instance and updating \a
- * algorithm following algorithm names compatible with Ruby. Returns 1 upon
- * success, 0 otherwise. */
-GRPCAPI int grpc_compression_algorithm_parse_ruby(
- grpc_slice value, grpc_compression_algorithm* algorithm);
-
-/** Updates \a name with the encoding name corresponding to a valid \a
- * algorithm. The \a name follows names compatible with Ruby. Note that \a name
- * is statically allocated and must *not* be freed. Returns 1 upon success, 0
- * otherwise. */
-GRPCAPI int grpc_compression_algorithm_name_ruby(
- grpc_compression_algorithm algorithm, const char** name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_COMPRESSION_RUBY_H */
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h
index f083bc591e..47d749c728 100644
--- a/include/grpc/grpc.h
+++ b/include/grpc/grpc.h
@@ -160,25 +160,6 @@ GRPCAPI void grpc_completion_queue_thread_local_cache_init(
GRPCAPI int grpc_completion_queue_thread_local_cache_flush(
grpc_completion_queue* cq, void** tag, int* ok);
-/** Create a completion queue alarm instance */
-GRPCAPI grpc_alarm* grpc_alarm_create(void* reserved);
-
-/** Set a completion queue alarm instance associated to \a cq.
- *
- * Once the alarm expires (at \a deadline) or it's cancelled (see \a
- * grpc_alarm_cancel), an event with tag \a tag will be added to \a cq. If the
- * alarm expired, the event's success bit will be true, false otherwise (ie,
- * upon cancellation). */
-GRPCAPI void grpc_alarm_set(grpc_alarm* alarm, grpc_completion_queue* cq,
- gpr_timespec deadline, void* tag, void* reserved);
-
-/** Cancel a completion queue alarm. Calling this function over an alarm that
- * has already fired has no effect. */
-GRPCAPI void grpc_alarm_cancel(grpc_alarm* alarm, void* reserved);
-
-/** Destroy the given completion queue alarm, cancelling it in the process. */
-GRPCAPI void grpc_alarm_destroy(grpc_alarm* alarm, void* reserved);
-
/** Check the connectivity state of a channel. */
GRPCAPI grpc_connectivity_state grpc_channel_check_connectivity_state(
grpc_channel* channel, int try_to_connect);
diff --git a/include/grpc/impl/codegen/compression_types.h b/include/grpc/impl/codegen/compression_types.h
index ddc667fcdb..e35d892967 100644
--- a/include/grpc/impl/codegen/compression_types.h
+++ b/include/grpc/impl/codegen/compression_types.h
@@ -55,8 +55,9 @@ extern "C" {
/** The various compression algorithms supported by gRPC */
typedef enum {
GRPC_COMPRESS_NONE = 0,
- GRPC_COMPRESS_MESSAGE_DEFLATE,
- GRPC_COMPRESS_MESSAGE_GZIP,
+ GRPC_COMPRESS_DEFLATE,
+ GRPC_COMPRESS_GZIP,
+ /* EXPERIMENTAL: Stream compression is currently experimental. */
GRPC_COMPRESS_STREAM_GZIP,
/* TODO(ctiller): snappy */
GRPC_COMPRESS_ALGORITHMS_COUNT
diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h
index e3af64b3c0..efd0e28787 100644
--- a/include/grpc/impl/codegen/grpc_types.h
+++ b/include/grpc/impl/codegen/grpc_types.h
@@ -239,6 +239,9 @@ typedef struct {
/** The time between the first and second connection attempts, in ms */
#define GRPC_ARG_INITIAL_RECONNECT_BACKOFF_MS \
"grpc.initial_reconnect_backoff_ms"
+/** Minimum amount of time between DNS resolutions, in ms */
+#define GRPC_ARG_DNS_MIN_TIME_BETWEEN_RESOLUTIONS_MS \
+ "grpc.dns_min_time_between_resolutions_ms"
/** The timeout used on servers for finishing handshaking on an incoming
connection. Defaults to 120 seconds. */
#define GRPC_ARG_SERVER_HANDSHAKE_TIMEOUT_MS "grpc.server_handshake_timeout_ms"
@@ -296,7 +299,7 @@ typedef struct {
#define GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS "grpc.grpclb_call_timeout_ms"
/* Timeout in milliseconds to wait for the serverlist from the grpclb load
balancer before using fallback backend addresses from the resolver.
- If 0, fallback will never be used. */
+ If 0, fallback will never be used. Default value is 10000. */
#define GRPC_ARG_GRPCLB_FALLBACK_TIMEOUT_MS "grpc.grpclb_fallback_timeout_ms"
/** If non-zero, grpc server's cronet compression workaround will be enabled */
#define GRPC_ARG_WORKAROUND_CRONET_COMPRESSION \
diff --git a/include/grpc/module.modulemap b/include/grpc/module.modulemap
index d23072f556..e5dac828b1 100644
--- a/include/grpc/module.modulemap
+++ b/include/grpc/module.modulemap
@@ -4,21 +4,15 @@ framework module grpc {
header "support/alloc.h"
header "support/atm.h"
- header "support/avl.h"
- header "support/cmdline.h"
header "support/cpu.h"
- header "support/host_port.h"
header "support/log.h"
header "support/log_windows.h"
header "support/port_platform.h"
header "support/string_util.h"
- header "support/subprocess.h"
header "support/sync.h"
header "support/sync_generic.h"
header "support/thd.h"
header "support/time.h"
- header "support/tls.h"
- header "support/useful.h"
header "impl/codegen/atm.h"
header "impl/codegen/fork.h"
header "impl/codegen/gpr_slice.h"
@@ -45,7 +39,6 @@ framework module grpc {
header "byte_buffer.h"
header "byte_buffer_reader.h"
header "compression.h"
- header "compression_ruby.h"
header "fork.h"
header "grpc.h"
header "grpc_posix.h"
@@ -63,9 +56,6 @@ framework module grpc {
textual header "support/sync_custom.h"
textual header "support/sync_posix.h"
textual header "support/sync_windows.h"
- textual header "support/tls_gcc.h"
- textual header "support/tls_msvc.h"
- textual header "support/tls_pthread.h"
textual header "impl/codegen/atm_gcc_atomic.h"
textual header "impl/codegen/atm_gcc_sync.h"
textual header "impl/codegen/atm_windows.h"
diff --git a/include/grpc/support/avl.h b/include/grpc/support/avl.h
deleted file mode 100644
index b5a8c0ffa1..0000000000
--- a/include/grpc/support/avl.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_SUPPORT_AVL_H
-#define GRPC_SUPPORT_AVL_H
-
-#include <grpc/support/sync.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** internal node of an AVL tree */
-typedef struct gpr_avl_node {
- gpr_refcount refs;
- void* key;
- void* value;
- struct gpr_avl_node* left;
- struct gpr_avl_node* right;
- long height;
-} gpr_avl_node;
-
-/** vtable for the AVL tree
- * The optional user_data is propagated from the top level gpr_avl_XXX API.
- * From the same API call, multiple vtable functions may be called multiple
- * times.
- */
-typedef struct gpr_avl_vtable {
- /** destroy a key */
- void (*destroy_key)(void* key, void* user_data);
- /** copy a key, returning new value */
- void* (*copy_key)(void* key, void* user_data);
- /** compare key1, key2; return <0 if key1 < key2,
- >0 if key1 > key2, 0 if key1 == key2 */
- long (*compare_keys)(void* key1, void* key2, void* user_data);
- /** destroy a value */
- void (*destroy_value)(void* value, void* user_data);
- /** copy a value */
- void* (*copy_value)(void* value, void* user_data);
-} gpr_avl_vtable;
-
-/** "pointer" to an AVL tree - this is a reference
- counted object - use gpr_avl_ref to add a reference,
- gpr_avl_unref when done with a reference */
-typedef struct gpr_avl {
- const gpr_avl_vtable* vtable;
- gpr_avl_node* root;
-} gpr_avl;
-
-/** Create an immutable AVL tree. */
-GPRAPI gpr_avl gpr_avl_create(const gpr_avl_vtable* vtable);
-/** Add a reference to an existing tree - returns
- the tree as a convenience. The optional user_data will be passed to vtable
- functions. */
-GPRAPI gpr_avl gpr_avl_ref(gpr_avl avl, void* user_data);
-/** Remove a reference to a tree - destroying it if there
- are no references left. The optional user_data will be passed to vtable
- functions. */
-GPRAPI void gpr_avl_unref(gpr_avl avl, void* user_data);
-/** Return a new tree with (key, value) added to avl.
- implicitly unrefs avl to allow easy chaining.
- if key exists in avl, the new tree's key entry updated
- (i.e. a duplicate is not created). The optional user_data will be passed to
- vtable functions. */
-GPRAPI gpr_avl gpr_avl_add(gpr_avl avl, void* key, void* value,
- void* user_data);
-/** Return a new tree with key deleted
- implicitly unrefs avl to allow easy chaining. The optional user_data will be
- passed to vtable functions. */
-GPRAPI gpr_avl gpr_avl_remove(gpr_avl avl, void* key, void* user_data);
-/** Lookup key, and return the associated value.
- Does not mutate avl.
- Returns NULL if key is not found. The optional user_data will be passed to
- vtable functions.*/
-GPRAPI void* gpr_avl_get(gpr_avl avl, void* key, void* user_data);
-/** Return 1 if avl contains key, 0 otherwise; if it has the key, sets *value to
- its value. THe optional user_data will be passed to vtable functions. */
-GPRAPI int gpr_avl_maybe_get(gpr_avl avl, void* key, void** value,
- void* user_data);
-/** Return 1 if avl is empty, 0 otherwise */
-GPRAPI int gpr_avl_is_empty(gpr_avl avl);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SUPPORT_AVL_H */
diff --git a/include/grpc/support/cmdline.h b/include/grpc/support/cmdline.h
deleted file mode 100644
index c34a109fbd..0000000000
--- a/include/grpc/support/cmdline.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_SUPPORT_CMDLINE_H
-#define GRPC_SUPPORT_CMDLINE_H
-
-#include <grpc/support/port_platform.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Simple command line parser.
-
- Supports flags that can be specified as -foo, --foo, --no-foo, -no-foo, etc
- And integers, strings that can be specified as -foo=4, -foo blah, etc
-
- No support for short command line options (but we may get that in the
- future.)
-
- Usage (for a program with a single flag argument 'foo'):
-
- int main(int argc, char **argv) {
- gpr_cmdline *cl;
- int verbose = 0;
-
- cl = gpr_cmdline_create("My cool tool");
- gpr_cmdline_add_int(cl, "verbose", "Produce verbose output?", &verbose);
- gpr_cmdline_parse(cl, argc, argv);
- gpr_cmdline_destroy(cl);
-
- if (verbose) {
- gpr_log(GPR_INFO, "Goodbye cruel world!");
- }
-
- return 0;
- } */
-
-typedef struct gpr_cmdline gpr_cmdline;
-
-/** Construct a command line parser: takes a short description of the tool
- doing the parsing */
-GPRAPI gpr_cmdline* gpr_cmdline_create(const char* description);
-/** Add an integer parameter, with a name (used on the command line) and some
- helpful text (used in the command usage) */
-GPRAPI void gpr_cmdline_add_int(gpr_cmdline* cl, const char* name,
- const char* help, int* value);
-/** The same, for a boolean flag */
-GPRAPI void gpr_cmdline_add_flag(gpr_cmdline* cl, const char* name,
- const char* help, int* value);
-/** And for a string */
-GPRAPI void gpr_cmdline_add_string(gpr_cmdline* cl, const char* name,
- const char* help, const char** value);
-/** Set a callback for non-named arguments */
-GPRAPI void gpr_cmdline_on_extra_arg(
- gpr_cmdline* cl, const char* name, const char* help,
- void (*on_extra_arg)(void* user_data, const char* arg), void* user_data);
-/** Enable surviving failure: default behavior is to exit the process */
-GPRAPI void gpr_cmdline_set_survive_failure(gpr_cmdline* cl);
-/** Parse the command line; returns 1 on success, on failure either dies
- (by default) or returns 0 if gpr_cmdline_set_survive_failure() has been
- called */
-GPRAPI int gpr_cmdline_parse(gpr_cmdline* cl, int argc, char** argv);
-/** Destroy the parser */
-GPRAPI void gpr_cmdline_destroy(gpr_cmdline* cl);
-/** Get a string describing usage */
-GPRAPI char* gpr_cmdline_usage_string(gpr_cmdline* cl, const char* argv0);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SUPPORT_CMDLINE_H */
diff --git a/include/grpc/support/host_port.h b/include/grpc/support/host_port.h
deleted file mode 100644
index 9805811bfb..0000000000
--- a/include/grpc/support/host_port.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_SUPPORT_HOST_PORT_H
-#define GRPC_SUPPORT_HOST_PORT_H
-
-#include <grpc/support/port_platform.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** Given a host and port, creates a newly-allocated string of the form
- "host:port" or "[ho:st]:port", depending on whether the host contains colons
- like an IPv6 literal. If the host is already bracketed, then additional
- brackets will not be added.
-
- Usage is similar to gpr_asprintf: returns the number of bytes written
- (excluding the final '\0'), and *out points to a string which must later be
- destroyed using gpr_free().
-
- In the unlikely event of an error, returns -1 and sets *out to NULL. */
-GPRAPI int gpr_join_host_port(char** out, const char* host, int port);
-
-/** Given a name in the form "host:port" or "[ho:st]:port", split into hostname
- and port number, into newly allocated strings, which must later be
- destroyed using gpr_free().
- Return 1 on success, 0 on failure. Guarantees *host and *port == NULL on
- failure. */
-GPRAPI int gpr_split_host_port(const char* name, char** host, char** port);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SUPPORT_HOST_PORT_H */
diff --git a/include/grpc/support/subprocess.h b/include/grpc/support/subprocess.h
deleted file mode 100644
index 175f7b50eb..0000000000
--- a/include/grpc/support/subprocess.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_SUPPORT_SUBPROCESS_H
-#define GRPC_SUPPORT_SUBPROCESS_H
-
-#include <grpc/support/port_platform.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct gpr_subprocess gpr_subprocess;
-
-/** .exe on windows, empty on unices */
-GPRAPI const char* gpr_subprocess_binary_extension();
-
-GPRAPI gpr_subprocess* gpr_subprocess_create(int argc, const char** argv);
-/** if subprocess has not been joined, kill it */
-GPRAPI void gpr_subprocess_destroy(gpr_subprocess* p);
-/** returns exit status; can be called at most once */
-GPRAPI int gpr_subprocess_join(gpr_subprocess* p);
-GPRAPI void gpr_subprocess_interrupt(gpr_subprocess* p);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-#endif /* GRPC_SUPPORT_SUBPROCESS_H */
diff --git a/include/grpc/support/tls.h b/include/grpc/support/tls.h
deleted file mode 100644
index 4c9e79b6cf..0000000000
--- a/include/grpc/support/tls.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_SUPPORT_TLS_H
-#define GRPC_SUPPORT_TLS_H
-
-#include <grpc/support/port_platform.h>
-
-/** Thread local storage.
-
- A minimal wrapper that should be implementable across many compilers,
- and implementable efficiently across most modern compilers.
-
- Thread locals have type intptr_t.
-
- Declaring a thread local variable 'foo':
- GPR_TLS_DECL(foo);
- Thread locals always have static scope.
-
- Declaring a thread local class variable 'foo':
- GPR_TLS_CLASS_DECL(foo);
-
- Defining the thread local class variable:
- GPR_TLS_CLASS_DEF(foo);
-
- Initializing a thread local (must be done at library initialization
- time):
- gpr_tls_init(&foo);
-
- Destroying a thread local:
- gpr_tls_destroy(&foo);
-
- Setting a thread local (returns new_value):
- gpr_tls_set(&foo, new_value);
-
- Accessing a thread local:
- current_value = gpr_tls_get(&foo);
-
- ALL functions here may be implemented as macros. */
-
-#ifdef GPR_GCC_TLS
-#include <grpc/support/tls_gcc.h>
-#endif
-
-#ifdef GPR_MSVC_TLS
-#include <grpc/support/tls_msvc.h>
-#endif
-
-#ifdef GPR_PTHREAD_TLS
-#include <grpc/support/tls_pthread.h>
-#endif
-
-#endif /* GRPC_SUPPORT_TLS_H */
diff --git a/include/grpc/support/tls_gcc.h b/include/grpc/support/tls_gcc.h
deleted file mode 100644
index b44f0f1c8c..0000000000
--- a/include/grpc/support/tls_gcc.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_SUPPORT_TLS_GCC_H
-#define GRPC_SUPPORT_TLS_GCC_H
-
-#include <stdbool.h>
-
-#include <grpc/support/log.h>
-
-/** Thread local storage based on gcc compiler primitives.
- #include tls.h to use this - and see that file for documentation */
-
-struct gpr_gcc_thread_local {
- intptr_t value;
-};
-
-#define GPR_TLS_DECL(name) \
- static __thread struct gpr_gcc_thread_local name = {0}
-
-#define GPR_TLS_CLASS_DECL(name) \
- static __thread struct gpr_gcc_thread_local name
-
-#define GPR_TLS_CLASS_DEF(name) __thread struct gpr_gcc_thread_local name = {0}
-
-#define gpr_tls_init(tls) \
- do { \
- } while (0)
-#define gpr_tls_destroy(tls) \
- do { \
- } while (0)
-#define gpr_tls_set(tls, new_value) (((tls)->value) = (new_value))
-#define gpr_tls_get(tls) ((tls)->value)
-
-#endif /* GRPC_SUPPORT_TLS_GCC_H */
diff --git a/include/grpc/support/tls_msvc.h b/include/grpc/support/tls_msvc.h
deleted file mode 100644
index 68a411f5d4..0000000000
--- a/include/grpc/support/tls_msvc.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_SUPPORT_TLS_MSVC_H
-#define GRPC_SUPPORT_TLS_MSVC_H
-
-/** Thread local storage based on ms visual c compiler primitives.
- #include tls.h to use this - and see that file for documentation */
-
-struct gpr_msvc_thread_local {
- intptr_t value;
-};
-
-/** Use GPR_TLS_DECL to declare tls static variables outside a class */
-#define GPR_TLS_DECL(name) \
- static __declspec(thread) struct gpr_msvc_thread_local name = {0}
-
-/** Use GPR_TLS_CLASS_DECL to declare tls static variable members of a class.
- * GPR_TLS_CLASS_DEF needs to be called to define this member. */
-#define GPR_TLS_CLASS_DECL(name) \
- static __declspec(thread) struct gpr_msvc_thread_local name
-
-#define GPR_TLS_CLASS_DEF(name) \
- __declspec(thread) struct gpr_msvc_thread_local name = {0}
-
-#define gpr_tls_init(tls) \
- do { \
- } while (0)
-#define gpr_tls_destroy(tls) \
- do { \
- } while (0)
-#define gpr_tls_set(tls, new_value) (((tls)->value) = (new_value))
-#define gpr_tls_get(tls) ((tls)->value)
-
-#endif /* GRPC_SUPPORT_TLS_MSVC_H */
diff --git a/include/grpc/support/tls_pthread.h b/include/grpc/support/tls_pthread.h
deleted file mode 100644
index 249c8b16f8..0000000000
--- a/include/grpc/support/tls_pthread.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_SUPPORT_TLS_PTHREAD_H
-#define GRPC_SUPPORT_TLS_PTHREAD_H
-
-#include <grpc/support/log.h> /* for GPR_ASSERT */
-#include <pthread.h>
-
-/** Thread local storage based on pthread library calls.
- #include tls.h to use this - and see that file for documentation */
-
-struct gpr_pthread_thread_local {
- pthread_key_t key;
-};
-
-/** Use GPR_TLS_DECL to declare tls static variables outside a class */
-#define GPR_TLS_DECL(name) static struct gpr_pthread_thread_local name = {0}
-
-/** Use GPR_TLS_CLASS_DECL to declare tls static variable members of a class.
- * GPR_TLS_CLASS_DEF needs to be called to define this member. */
-#define GPR_TLS_CLASS_DECL(name) static struct gpr_pthread_thread_local name
-
-/** Use GPR_TLS_CLASS_DEF to declare tls static variable members of a class.
- * GPR_TLS_CLASS_DEF needs to be called to define this member. */
-#define GPR_TLS_CLASS_DEF(name) struct gpr_pthread_thread_local name = {0}
-
-#define gpr_tls_init(tls) GPR_ASSERT(0 == pthread_key_create(&(tls)->key, NULL))
-#define gpr_tls_destroy(tls) pthread_key_delete((tls)->key)
-#define gpr_tls_get(tls) ((intptr_t)pthread_getspecific((tls)->key))
-#ifdef __cplusplus
-extern "C" {
-#endif
-intptr_t gpr_tls_set(struct gpr_pthread_thread_local* tls, intptr_t value);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SUPPORT_TLS_PTHREAD_H */
diff --git a/include/grpc/support/useful.h b/include/grpc/support/useful.h
deleted file mode 100644
index bd66d3bb27..0000000000
--- a/include/grpc/support/useful.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_SUPPORT_USEFUL_H
-#define GRPC_SUPPORT_USEFUL_H
-
-/** useful macros that don't belong anywhere else */
-
-#define GPR_MIN(a, b) ((a) < (b) ? (a) : (b))
-#define GPR_MAX(a, b) ((a) > (b) ? (a) : (b))
-#define GPR_CLAMP(a, min, max) ((a) < (min) ? (min) : (a) > (max) ? (max) : (a))
-/** rotl, rotr assume x is unsigned */
-#define GPR_ROTL(x, n) (((x) << (n)) | ((x) >> (sizeof(x) * 8 - (n))))
-#define GPR_ROTR(x, n) (((x) >> (n)) | ((x) << (sizeof(x) * 8 - (n))))
-
-#define GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array)))
-
-#define GPR_SWAP(type, a, b) \
- do { \
- type x = a; \
- a = b; \
- b = x; \
- } while (0)
-
-/** Set the \a n-th bit of \a i (a mutable pointer). */
-#define GPR_BITSET(i, n) ((*(i)) |= (1u << (n)))
-
-/** Clear the \a n-th bit of \a i (a mutable pointer). */
-#define GPR_BITCLEAR(i, n) ((*(i)) &= ~(1u << (n)))
-
-/** Get the \a n-th bit of \a i */
-#define GPR_BITGET(i, n) (((i) & (1u << (n))) != 0)
-
-#define GPR_INTERNAL_HEXDIGIT_BITCOUNT(x) \
- ((x) - (((x) >> 1) & 0x77777777) - (((x) >> 2) & 0x33333333) - \
- (((x) >> 3) & 0x11111111))
-
-/** Returns number of bits set in bitset \a i */
-#define GPR_BITCOUNT(i) \
- (((GPR_INTERNAL_HEXDIGIT_BITCOUNT(i) + \
- (GPR_INTERNAL_HEXDIGIT_BITCOUNT(i) >> 4)) & \
- 0x0f0f0f0f) % \
- 255)
-
-#define GPR_ICMP(a, b) ((a) < (b) ? -1 : ((a) > (b) ? 1 : 0))
-
-#define GPR_HASH_POINTER(x, range) \
- ((((size_t)x) >> 4) ^ (((size_t)x) >> 9) ^ (((size_t)x) >> 14)) % (range)
-
-#endif /* GRPC_SUPPORT_USEFUL_H */