grpc 1.3.4 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +581 -450
- data/include/grpc/census.h +49 -49
- data/include/grpc/grpc.h +16 -70
- data/include/grpc/grpc_security.h +59 -59
- data/include/grpc/grpc_security_constants.h +9 -9
- data/include/grpc/impl/codegen/atm.h +1 -1
- data/include/grpc/impl/codegen/atm_windows.h +4 -4
- data/include/grpc/impl/codegen/byte_buffer_reader.h +2 -2
- data/include/grpc/impl/codegen/compression_types.h +4 -5
- data/include/grpc/impl/codegen/gpr_slice.h +5 -5
- data/include/grpc/impl/codegen/gpr_types.h +6 -7
- data/include/grpc/impl/codegen/grpc_types.h +128 -59
- data/include/grpc/impl/codegen/port_platform.h +6 -0
- data/include/grpc/impl/codegen/propagation_bits.h +2 -2
- data/include/grpc/impl/codegen/slice.h +13 -12
- data/include/grpc/impl/codegen/status.h +23 -18
- data/include/grpc/impl/codegen/sync.h +1 -1
- data/include/grpc/load_reporting.h +6 -6
- data/include/grpc/slice.h +47 -25
- data/include/grpc/slice_buffer.h +18 -14
- data/include/grpc/support/alloc.h +7 -7
- data/include/grpc/support/cmdline.h +10 -10
- data/include/grpc/support/cpu.h +3 -3
- data/include/grpc/support/histogram.h +1 -1
- data/include/grpc/support/host_port.h +2 -2
- data/include/grpc/support/log.h +9 -9
- data/include/grpc/support/log_windows.h +1 -1
- data/include/grpc/support/string_util.h +3 -3
- data/include/grpc/support/subprocess.h +3 -3
- data/include/grpc/support/sync.h +31 -31
- data/include/grpc/support/thd.h +11 -11
- data/include/grpc/support/time.h +12 -12
- data/include/grpc/support/tls.h +1 -1
- data/include/grpc/support/tls_gcc.h +2 -2
- data/include/grpc/support/tls_msvc.h +1 -1
- data/include/grpc/support/tls_pthread.h +1 -1
- data/include/grpc/support/useful.h +2 -2
- data/include/grpc/support/workaround_list.h +46 -0
- data/src/core/ext/census/context.c +1 -1
- data/src/core/ext/census/intrusive_hash_map.c +319 -0
- data/src/core/ext/census/intrusive_hash_map.h +167 -0
- data/src/core/ext/census/intrusive_hash_map_internal.h +63 -0
- data/src/core/ext/census/resource.c +3 -1
- data/src/core/ext/filters/client_channel/channel_connectivity.c +1 -1
- data/src/core/ext/filters/client_channel/client_channel.c +173 -103
- data/src/core/ext/filters/client_channel/client_channel_plugin.c +3 -2
- data/src/core/ext/filters/client_channel/lb_policy.c +2 -1
- data/src/core/ext/filters/client_channel/lb_policy.h +8 -7
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.c +153 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h +42 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.c +405 -102
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.c +133 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h +65 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.c +90 -51
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +7 -1
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +19 -8
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +63 -34
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.c +2 -1
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.c +188 -294
- data/src/core/ext/filters/client_channel/lb_policy_factory.c +28 -5
- data/src/core/ext/filters/client_channel/lb_policy_factory.h +18 -4
- data/src/core/ext/filters/client_channel/parse_address.c +90 -59
- data/src/core/ext/filters/client_channel/parse_address.h +17 -8
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.c +11 -7
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.c +59 -14
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h +6 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.c +3 -3
- data/src/core/ext/filters/client_channel/subchannel.c +20 -17
- data/src/core/ext/filters/client_channel/subchannel.h +1 -0
- data/src/core/ext/filters/client_channel/subchannel_index.c +11 -1
- data/src/core/ext/filters/client_channel/uri_parser.c +36 -22
- data/src/core/ext/filters/client_channel/uri_parser.h +1 -1
- data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.c +42 -17
- data/src/core/{lib/channel → ext/filters/deadline}/deadline_filter.h +8 -9
- data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.c +19 -11
- data/src/core/{lib/channel → ext/filters/http/client}/http_client_filter.h +3 -6
- data/src/core/ext/filters/http/http_filters_plugin.c +104 -0
- data/src/core/{lib/channel/compress_filter.c → ext/filters/http/message_compress/message_compress_filter.c} +124 -23
- data/src/core/{lib/channel/compress_filter.h → ext/filters/http/message_compress/message_compress_filter.h} +5 -6
- data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.c +4 -6
- data/src/core/{lib/channel → ext/filters/http/server}/http_server_filter.h +3 -3
- data/src/core/ext/filters/load_reporting/load_reporting.c +2 -25
- data/src/core/ext/filters/load_reporting/load_reporting_filter.c +26 -1
- data/src/core/ext/filters/max_age/max_age_filter.c +14 -14
- data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.c +91 -47
- data/src/core/{lib/channel → ext/filters/message_size}/message_size_filter.h +3 -3
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c +223 -0
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h +40 -0
- data/src/core/ext/filters/workarounds/workaround_utils.c +65 -0
- data/src/core/ext/filters/workarounds/workaround_utils.h +52 -0
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.c +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.c +3 -2
- data/src/core/ext/transport/chttp2/transport/bin_decoder.c +2 -2
- data/src/core/ext/transport/chttp2/transport/bin_encoder.c +3 -3
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.c +319 -175
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +3 -2
- data/src/core/ext/transport/chttp2/transport/frame_data.c +203 -164
- data/src/core/ext/transport/chttp2/transport/frame_data.h +8 -14
- data/src/core/ext/transport/chttp2/transport/frame_goaway.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_ping.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_rst_stream.c +1 -1
- data/src/core/ext/transport/chttp2/transport/frame_settings.c +5 -5
- data/src/core/ext/transport/chttp2/transport/frame_window_update.c +1 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.c +4 -4
- data/src/core/ext/transport/chttp2/transport/hpack_parser.c +2 -4
- data/src/core/ext/transport/chttp2/transport/hpack_table.c +4 -3
- data/src/core/ext/transport/chttp2/transport/internal.h +50 -33
- data/src/core/ext/transport/chttp2/transport/parsing.c +10 -11
- data/src/core/ext/transport/chttp2/transport/writing.c +32 -13
- data/src/core/lib/channel/channel_args.c +30 -9
- data/src/core/lib/channel/channel_args.h +5 -1
- data/src/core/lib/channel/channel_stack.c +1 -1
- data/src/core/lib/channel/channel_stack.h +2 -2
- data/src/core/lib/channel/channel_stack_builder.c +13 -1
- data/src/core/lib/channel/channel_stack_builder.h +5 -1
- data/src/core/lib/channel/connected_channel.c +3 -1
- data/src/core/lib/channel/context.h +2 -2
- data/src/core/lib/compression/message_compress.c +2 -2
- data/src/core/lib/debug/trace.c +13 -6
- data/src/core/lib/debug/trace.h +27 -1
- data/src/core/lib/http/httpcli.c +1 -1
- data/src/core/lib/http/httpcli_security_connector.c +9 -11
- data/src/core/lib/http/parser.c +2 -2
- data/src/core/lib/http/parser.h +2 -1
- data/src/core/lib/iomgr/combiner.c +6 -6
- data/src/core/lib/iomgr/combiner.h +2 -1
- data/src/core/lib/iomgr/error.c +12 -5
- data/src/core/lib/iomgr/error.h +13 -13
- data/src/core/lib/iomgr/ev_epoll1_linux.c +984 -0
- data/src/core/lib/iomgr/ev_epoll1_linux.h +44 -0
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.c +2146 -0
- data/src/core/lib/iomgr/ev_epoll_limited_pollers_linux.h +43 -0
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.c +1337 -0
- data/src/core/lib/iomgr/ev_epoll_thread_pool_linux.h +43 -0
- data/src/core/lib/iomgr/ev_epollex_linux.c +1511 -0
- data/src/core/lib/iomgr/ev_epollex_linux.h +43 -0
- data/src/core/lib/iomgr/{ev_epoll_linux.c → ev_epollsig_linux.c} +41 -33
- data/src/core/lib/iomgr/{ev_epoll_linux.h → ev_epollsig_linux.h} +4 -4
- data/src/core/lib/iomgr/ev_poll_posix.c +12 -27
- data/src/core/lib/iomgr/ev_poll_posix.h +2 -2
- data/src/core/lib/iomgr/ev_posix.c +22 -8
- data/src/core/lib/iomgr/ev_posix.h +4 -3
- data/src/core/lib/iomgr/ev_windows.c +43 -0
- data/src/core/lib/iomgr/exec_ctx.c +5 -0
- data/src/core/lib/iomgr/exec_ctx.h +2 -0
- data/src/core/lib/iomgr/iomgr.c +4 -0
- data/src/core/lib/iomgr/iomgr.h +3 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.c +116 -0
- data/src/core/lib/iomgr/is_epollexclusive_available.h +41 -0
- data/src/core/lib/iomgr/lockfree_event.c +16 -0
- data/src/core/lib/iomgr/pollset.h +2 -5
- data/src/core/lib/iomgr/pollset_uv.c +1 -1
- data/src/core/lib/iomgr/pollset_windows.c +3 -3
- data/src/core/lib/iomgr/resource_quota.c +9 -8
- data/src/core/lib/iomgr/resource_quota.h +2 -1
- data/src/core/lib/iomgr/sockaddr_utils.h +1 -1
- data/src/core/lib/iomgr/socket_mutator.h +2 -0
- data/src/core/lib/iomgr/sys_epoll_wrapper.h +43 -0
- data/src/core/lib/iomgr/tcp_client_posix.c +6 -6
- data/src/core/lib/iomgr/tcp_client_uv.c +3 -3
- data/src/core/lib/iomgr/tcp_posix.c +7 -7
- data/src/core/lib/iomgr/tcp_posix.h +2 -1
- data/src/core/lib/iomgr/tcp_server_posix.c +1 -1
- data/src/core/lib/iomgr/tcp_uv.c +6 -6
- data/src/core/lib/iomgr/tcp_uv.h +2 -1
- data/src/core/lib/iomgr/tcp_windows.c +1 -1
- data/src/core/lib/iomgr/timer_generic.c +24 -25
- data/src/core/lib/iomgr/timer_manager.c +276 -0
- data/src/core/lib/iomgr/timer_manager.h +52 -0
- data/src/core/lib/iomgr/timer_uv.c +6 -0
- data/src/core/lib/iomgr/udp_server.c +42 -9
- data/src/core/lib/iomgr/udp_server.h +3 -1
- data/src/core/lib/security/credentials/credentials.c +0 -1
- data/src/core/lib/security/credentials/fake/fake_credentials.c +23 -0
- data/src/core/lib/security/credentials/fake/fake_credentials.h +12 -9
- data/src/core/lib/security/credentials/google_default/google_default_credentials.c +1 -1
- data/src/core/lib/security/credentials/jwt/jwt_credentials.c +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.c +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.c +24 -53
- data/src/core/lib/security/transport/client_auth_filter.c +9 -3
- data/src/core/lib/security/transport/secure_endpoint.c +7 -7
- data/src/core/lib/security/transport/secure_endpoint.h +1 -1
- data/src/core/lib/security/transport/security_connector.c +45 -57
- data/src/core/lib/security/transport/security_connector.h +10 -14
- data/src/core/lib/security/transport/security_handshaker.c +123 -97
- data/src/core/lib/slice/b64.c +1 -1
- data/src/core/lib/slice/percent_encoding.c +3 -3
- data/src/core/lib/slice/slice.c +66 -33
- data/src/core/lib/slice/slice_buffer.c +25 -6
- data/src/core/lib/slice/slice_hash_table.c +33 -35
- data/src/core/lib/slice/slice_hash_table.h +7 -12
- data/src/core/lib/support/atomic.h +45 -0
- data/src/core/lib/support/atomic_with_atm.h +70 -0
- data/src/core/lib/support/atomic_with_std.h +48 -0
- data/src/core/lib/support/avl.c +14 -14
- data/src/core/lib/support/cmdline.c +3 -3
- data/src/core/lib/support/histogram.c +2 -2
- data/src/core/lib/support/host_port.c +1 -1
- data/src/core/lib/support/memory.h +74 -0
- data/src/core/lib/support/mpscq.c +36 -2
- data/src/core/lib/support/mpscq.h +28 -1
- data/src/core/lib/support/stack_lockfree.c +3 -36
- data/src/core/lib/support/string.c +12 -12
- data/src/core/lib/support/string_posix.c +1 -1
- data/src/core/lib/support/subprocess_posix.c +2 -2
- data/src/core/lib/support/thd_posix.c +1 -1
- data/src/core/lib/support/time_posix.c +8 -0
- data/src/core/lib/support/tmpfile_posix.c +10 -10
- data/src/core/lib/surface/alarm.c +3 -1
- data/src/core/lib/surface/api_trace.c +2 -1
- data/src/core/lib/surface/api_trace.h +2 -2
- data/src/core/lib/surface/byte_buffer_reader.c +1 -1
- data/src/core/lib/surface/call.c +65 -22
- data/src/core/lib/surface/call.h +4 -2
- data/src/core/lib/surface/channel_init.c +2 -19
- data/src/core/lib/surface/channel_stack_type.c +18 -0
- data/src/core/lib/surface/channel_stack_type.h +2 -0
- data/src/core/lib/surface/completion_queue.c +694 -247
- data/src/core/lib/surface/completion_queue.h +30 -13
- data/src/core/lib/surface/completion_queue_factory.c +24 -9
- data/src/core/lib/surface/init.c +1 -52
- data/src/core/lib/surface/{lame_client.c → lame_client.cc} +37 -26
- data/src/core/lib/surface/server.c +79 -110
- data/src/core/lib/surface/server.h +2 -1
- data/src/core/lib/surface/version.c +2 -2
- data/src/core/lib/transport/bdp_estimator.c +25 -9
- data/src/core/lib/transport/bdp_estimator.h +7 -1
- data/src/core/lib/transport/byte_stream.c +23 -9
- data/src/core/lib/transport/byte_stream.h +15 -6
- data/src/core/lib/transport/connectivity_state.c +6 -6
- data/src/core/lib/transport/connectivity_state.h +2 -1
- data/src/core/lib/transport/service_config.c +6 -13
- data/src/core/lib/transport/service_config.h +2 -2
- data/src/core/lib/transport/static_metadata.c +403 -389
- data/src/core/lib/transport/static_metadata.h +127 -114
- data/src/core/plugin_registry/grpc_plugin_registry.c +16 -0
- data/src/core/tsi/fake_transport_security.c +5 -4
- data/src/core/tsi/ssl_transport_security.c +71 -82
- data/src/core/tsi/ssl_transport_security.h +39 -61
- data/src/core/tsi/transport_security.c +83 -2
- data/src/core/tsi/transport_security.h +27 -2
- data/src/core/tsi/transport_security_adapter.c +236 -0
- data/src/core/tsi/transport_security_adapter.h +62 -0
- data/src/core/tsi/transport_security_interface.h +179 -66
- data/src/ruby/ext/grpc/extconf.rb +2 -1
- data/src/ruby/ext/grpc/rb_byte_buffer.c +8 -6
- data/src/ruby/ext/grpc/rb_call.c +56 -48
- data/src/ruby/ext/grpc/rb_call.h +3 -4
- data/src/ruby/ext/grpc/rb_call_credentials.c +23 -22
- data/src/ruby/ext/grpc/rb_channel.c +2 -3
- data/src/ruby/ext/grpc/rb_channel_args.c +11 -9
- data/src/ruby/ext/grpc/rb_channel_credentials.c +16 -12
- data/src/ruby/ext/grpc/rb_completion_queue.c +7 -9
- data/src/ruby/ext/grpc/rb_compression_options.c +7 -6
- data/src/ruby/ext/grpc/rb_event_thread.c +10 -12
- data/src/ruby/ext/grpc/rb_event_thread.h +1 -2
- data/src/ruby/ext/grpc/rb_grpc.c +11 -15
- data/src/ruby/ext/grpc/rb_grpc.h +2 -2
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +16 -6
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +25 -10
- data/src/ruby/ext/grpc/rb_server.c +26 -28
- data/src/ruby/lib/grpc/grpc.rb +1 -1
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/third_party/cares/config_linux/ares_config.h +36 -2
- data/third_party/zlib/adler32.c +14 -7
- data/third_party/zlib/compress.c +24 -18
- data/third_party/zlib/crc32.c +29 -12
- data/third_party/zlib/deflate.c +499 -303
- data/third_party/zlib/deflate.h +19 -16
- data/third_party/zlib/gzguts.h +16 -7
- data/third_party/zlib/gzlib.c +17 -14
- data/third_party/zlib/gzread.c +108 -48
- data/third_party/zlib/gzwrite.c +210 -122
- data/third_party/zlib/infback.c +2 -2
- data/third_party/zlib/inffast.c +34 -51
- data/third_party/zlib/inflate.c +86 -37
- data/third_party/zlib/inflate.h +7 -4
- data/third_party/zlib/inftrees.c +12 -14
- data/third_party/zlib/trees.c +38 -61
- data/third_party/zlib/uncompr.c +66 -32
- data/third_party/zlib/zconf.h +32 -9
- data/third_party/zlib/zlib.h +298 -154
- data/third_party/zlib/zutil.c +25 -24
- data/third_party/zlib/zutil.h +35 -17
- metadata +63 -30
data/include/grpc/census.h
CHANGED
@@ -31,7 +31,7 @@
|
|
31
31
|
*
|
32
32
|
*/
|
33
33
|
|
34
|
-
|
34
|
+
/** RPC-internal Census API's. These are designed to be generic enough that
|
35
35
|
* they can (ultimately) be used in many different RPC systems (with differing
|
36
36
|
* implementations). */
|
37
37
|
|
@@ -44,12 +44,12 @@
|
|
44
44
|
extern "C" {
|
45
45
|
#endif
|
46
46
|
|
47
|
-
|
47
|
+
/** Identify census features that can be enabled via census_initialize(). */
|
48
48
|
enum census_features {
|
49
|
-
CENSUS_FEATURE_NONE = 0,
|
50
|
-
CENSUS_FEATURE_TRACING = 1,
|
51
|
-
CENSUS_FEATURE_STATS = 2,
|
52
|
-
CENSUS_FEATURE_CPU = 4,
|
49
|
+
CENSUS_FEATURE_NONE = 0, /** Do not enable census. */
|
50
|
+
CENSUS_FEATURE_TRACING = 1, /** Enable census tracing. */
|
51
|
+
CENSUS_FEATURE_STATS = 2, /** Enable Census stats collection. */
|
52
|
+
CENSUS_FEATURE_CPU = 4, /** Enable Census CPU usage collection. */
|
53
53
|
CENSUS_FEATURE_ALL =
|
54
54
|
CENSUS_FEATURE_TRACING | CENSUS_FEATURE_STATS | CENSUS_FEATURE_CPU
|
55
55
|
};
|
@@ -82,7 +82,7 @@ CENSUSAPI int census_enabled(void);
|
|
82
82
|
metrics will be recorded. Keys are unique within a context. */
|
83
83
|
typedef struct census_context census_context;
|
84
84
|
|
85
|
-
|
85
|
+
/** A tag is a key:value pair. Both keys and values are nil-terminated strings,
|
86
86
|
containing printable ASCII characters (decimal 32-126). Keys must be at
|
87
87
|
least one character in length. Both keys and values can have at most
|
88
88
|
CENSUS_MAX_TAG_KB_LEN characters (including the terminating nil). The
|
@@ -97,36 +97,36 @@ typedef struct {
|
|
97
97
|
uint8_t flags;
|
98
98
|
} census_tag;
|
99
99
|
|
100
|
-
|
100
|
+
/** Maximum length of a tag's key or value. */
|
101
101
|
#define CENSUS_MAX_TAG_KV_LEN 255
|
102
|
-
|
102
|
+
/** Maximum number of propagatable tags. */
|
103
103
|
#define CENSUS_MAX_PROPAGATED_TAGS 255
|
104
104
|
|
105
|
-
|
106
|
-
#define CENSUS_TAG_PROPAGATE 1
|
107
|
-
#define CENSUS_TAG_STATS 2
|
108
|
-
#define CENSUS_TAG_RESERVED 4
|
109
|
-
|
105
|
+
/** Tag flags. */
|
106
|
+
#define CENSUS_TAG_PROPAGATE 1 /** Tag should be propagated over RPC */
|
107
|
+
#define CENSUS_TAG_STATS 2 /** Tag will be used for statistics aggregation */
|
108
|
+
#define CENSUS_TAG_RESERVED 4 /** Reserved for internal use. */
|
109
|
+
/** Flag values 4,8,16,32,64,128 are reserved for future/internal use. Clients
|
110
110
|
should not use or rely on their values. */
|
111
111
|
|
112
112
|
#define CENSUS_TAG_IS_PROPAGATED(flags) (flags & CENSUS_TAG_PROPAGATE)
|
113
113
|
#define CENSUS_TAG_IS_STATS(flags) (flags & CENSUS_TAG_STATS)
|
114
114
|
|
115
|
-
|
115
|
+
/** An instance of this structure is kept by every context, and records the
|
116
116
|
basic information associated with the creation of that context. */
|
117
117
|
typedef struct {
|
118
|
-
int n_propagated_tags;
|
119
|
-
int n_local_tags;
|
120
|
-
int n_deleted_tags;
|
121
|
-
int n_added_tags;
|
122
|
-
int n_modified_tags;
|
123
|
-
int n_invalid_tags;
|
118
|
+
int n_propagated_tags; /** number of propagated tags */
|
119
|
+
int n_local_tags; /** number of non-propagated (local) tags */
|
120
|
+
int n_deleted_tags; /** number of tags that were deleted */
|
121
|
+
int n_added_tags; /** number of tags that were added */
|
122
|
+
int n_modified_tags; /** number of tags that were modified */
|
123
|
+
int n_invalid_tags; /** number of tags with bad keys or values (e.g.
|
124
124
|
longer than CENSUS_MAX_TAG_KV_LEN) */
|
125
|
-
int n_ignored_tags;
|
125
|
+
int n_ignored_tags; /** number of tags ignored because of
|
126
126
|
CENSUS_MAX_PROPAGATED_TAGS limit. */
|
127
127
|
} census_context_status;
|
128
128
|
|
129
|
-
|
129
|
+
/** Create a new context, adding and removing tags from an existing context.
|
130
130
|
This will copy all tags from the 'tags' input, so it is recommended
|
131
131
|
to add as many tags in a single operation as is practical for the client.
|
132
132
|
@param base Base context to build upon. Can be NULL.
|
@@ -148,15 +148,15 @@ CENSUSAPI census_context *census_context_create(
|
|
148
148
|
const census_context *base, const census_tag *tags, int ntags,
|
149
149
|
census_context_status const **status);
|
150
150
|
|
151
|
-
|
151
|
+
/** Destroy a context. Once this function has been called, the context cannot
|
152
152
|
be reused. */
|
153
153
|
CENSUSAPI void census_context_destroy(census_context *context);
|
154
154
|
|
155
|
-
|
155
|
+
/** Get a pointer to the original status from the context creation. */
|
156
156
|
CENSUSAPI const census_context_status *census_context_get_status(
|
157
157
|
const census_context *context);
|
158
158
|
|
159
|
-
|
159
|
+
/** Structure used for iterating over the tags in a context. API clients should
|
160
160
|
not use or reference internal fields - neither their contents or
|
161
161
|
presence/absence are guaranteed. */
|
162
162
|
typedef struct {
|
@@ -166,25 +166,25 @@ typedef struct {
|
|
166
166
|
char *kvm;
|
167
167
|
} census_context_iterator;
|
168
168
|
|
169
|
-
|
169
|
+
/** Initialize a census_tag_iterator. Must be called before first use. */
|
170
170
|
CENSUSAPI void census_context_initialize_iterator(
|
171
171
|
const census_context *context, census_context_iterator *iterator);
|
172
172
|
|
173
|
-
|
173
|
+
/** Get the contents of the "next" tag in the context. If there are no more
|
174
174
|
tags, returns 0 (and 'tag' contents will be unchanged), otherwise returns 1.
|
175
175
|
*/
|
176
176
|
CENSUSAPI int census_context_next_tag(census_context_iterator *iterator,
|
177
177
|
census_tag *tag);
|
178
178
|
|
179
|
-
|
179
|
+
/** Get a context tag by key. Returns 0 if the key is not present. */
|
180
180
|
CENSUSAPI int census_context_get_tag(const census_context *context,
|
181
181
|
const char *key, census_tag *tag);
|
182
182
|
|
183
|
-
|
183
|
+
/** Tag set encode/decode functionality. These functions are intended
|
184
184
|
for use by RPC systems only, for purposes of transmitting/receiving contexts.
|
185
185
|
*/
|
186
186
|
|
187
|
-
|
187
|
+
/** Encode a context into a buffer.
|
188
188
|
@param context context to be encoded
|
189
189
|
@param buffer buffer into which the context will be encoded.
|
190
190
|
@param buf_size number of available bytes in buffer.
|
@@ -193,15 +193,15 @@ CENSUSAPI int census_context_get_tag(const census_context *context,
|
|
193
193
|
CENSUSAPI size_t census_context_encode(const census_context *context,
|
194
194
|
char *buffer, size_t buf_size);
|
195
195
|
|
196
|
-
|
196
|
+
/** Decode context buffer encoded with census_context_encode(). Returns NULL
|
197
197
|
if there is an error in parsing either buffer. */
|
198
198
|
CENSUSAPI census_context *census_context_decode(const char *buffer,
|
199
199
|
size_t size);
|
200
200
|
|
201
|
-
|
201
|
+
/** Distributed traces can have a number of options. */
|
202
202
|
enum census_trace_mask_values {
|
203
|
-
CENSUS_TRACE_MASK_NONE = 0,
|
204
|
-
CENSUS_TRACE_MASK_IS_SAMPLED = 1
|
203
|
+
CENSUS_TRACE_MASK_NONE = 0, /** Default, empty flags */
|
204
|
+
CENSUS_TRACE_MASK_IS_SAMPLED = 1 /** RPC tracing enabled for this context. */
|
205
205
|
};
|
206
206
|
|
207
207
|
/** Get the current trace mask associated with this context. The value returned
|
@@ -211,7 +211,7 @@ CENSUSAPI int census_trace_mask(const census_context *context);
|
|
211
211
|
/** Set the trace mask associated with a context. */
|
212
212
|
CENSUSAPI void census_set_trace_mask(int trace_mask);
|
213
213
|
|
214
|
-
|
214
|
+
/** The concept of "operation" is a fundamental concept for Census. In an RPC
|
215
215
|
system, an operation typically represents a single RPC, or a significant
|
216
216
|
sub-part thereof (e.g. a single logical "read" RPC to a distributed storage
|
217
217
|
system might do several other actions in parallel, from looking up metadata
|
@@ -238,7 +238,7 @@ CENSUSAPI void census_set_trace_mask(int trace_mask);
|
|
238
238
|
at which an operation begins.
|
239
239
|
*/
|
240
240
|
typedef struct {
|
241
|
-
|
241
|
+
/** Use gpr_timespec for default implementation. High performance
|
242
242
|
* implementations should use a cycle-counter based timestamp. */
|
243
243
|
gpr_timespec ts;
|
244
244
|
} census_timestamp;
|
@@ -398,12 +398,12 @@ CENSUSAPI void census_trace_print(census_context *context, uint32_t type,
|
|
398
398
|
|
399
399
|
/** Trace record. */
|
400
400
|
typedef struct {
|
401
|
-
census_timestamp timestamp;
|
402
|
-
uint64_t trace_id;
|
403
|
-
uint64_t op_id;
|
404
|
-
uint32_t type;
|
405
|
-
const char *buffer;
|
406
|
-
size_t buf_size;
|
401
|
+
census_timestamp timestamp; /** Time of record creation */
|
402
|
+
uint64_t trace_id; /** Trace ID associated with record */
|
403
|
+
uint64_t op_id; /** Operation ID associated with record */
|
404
|
+
uint32_t type; /** Type (as used in census_trace_print() */
|
405
|
+
const char *buffer; /** Buffer (from census_trace_print() */
|
406
|
+
size_t buf_size; /** Number of bytes inside buffer */
|
407
407
|
} census_trace_record;
|
408
408
|
|
409
409
|
/** Start a scan of existing trace records. While a scan is ongoing, addition
|
@@ -431,7 +431,7 @@ CENSUSAPI int census_get_trace_record(census_trace_record *trace_record);
|
|
431
431
|
/** End a scan previously started by census_trace_scan_start() */
|
432
432
|
CENSUSAPI void census_trace_scan_end();
|
433
433
|
|
434
|
-
|
434
|
+
/** Core stats collection API's. The following concepts are used:
|
435
435
|
* Resource: Users record measurements for a single resource. Examples
|
436
436
|
include RPC latency, CPU seconds consumed, and bytes transmitted.
|
437
437
|
* Aggregation: An aggregation of a set of measurements. Census supports the
|
@@ -450,7 +450,7 @@ CENSUSAPI void census_trace_scan_end();
|
|
450
450
|
implementations. The proto definitions can be found in src/proto/census.
|
451
451
|
*/
|
452
452
|
|
453
|
-
|
453
|
+
/** Define a new resource. `resource_pb` should contain an encoded Resource
|
454
454
|
protobuf, `resource_pb_size` being the size of the buffer. Returns a -ve
|
455
455
|
value on error, or a positive (>= 0) resource id (for use in
|
456
456
|
census_delete_resource() and census_record_values()). In order to be valid, a
|
@@ -459,21 +459,21 @@ CENSUSAPI void census_trace_scan_end();
|
|
459
459
|
CENSUSAPI int32_t census_define_resource(const uint8_t *resource_pb,
|
460
460
|
size_t resource_pb_size);
|
461
461
|
|
462
|
-
|
462
|
+
/** Delete a resource created by census_define_resource(). */
|
463
463
|
CENSUSAPI void census_delete_resource(int32_t resource_id);
|
464
464
|
|
465
|
-
|
465
|
+
/** Determine the id of a resource, given its name. returns -1 if the resource
|
466
466
|
does not exist. */
|
467
467
|
CENSUSAPI int32_t census_resource_id(const char *name);
|
468
468
|
|
469
|
-
|
469
|
+
/** A single value to be recorded comprises two parts: an ID for the particular
|
470
470
|
* resource and the value to be recorded against it. */
|
471
471
|
typedef struct {
|
472
472
|
int32_t resource_id;
|
473
473
|
double value;
|
474
474
|
} census_value;
|
475
475
|
|
476
|
-
|
476
|
+
/** Record new usage values against the given context. */
|
477
477
|
CENSUSAPI void census_record_values(census_context *context,
|
478
478
|
census_value *values, size_t nvalues);
|
479
479
|
|
data/include/grpc/grpc.h
CHANGED
@@ -93,55 +93,6 @@ GRPCAPI const char *grpc_version_string(void);
|
|
93
93
|
/** Return a string specifying what the 'g' in gRPC stands for */
|
94
94
|
GRPCAPI const char *grpc_g_stands_for(void);
|
95
95
|
|
96
|
-
/** Specifies the type of APIs to use to pop events from the completion queue */
|
97
|
-
typedef enum {
|
98
|
-
/* Events are popped out by calling grpc_completion_queue_next() API ONLY */
|
99
|
-
GRPC_CQ_NEXT = 1,
|
100
|
-
|
101
|
-
/* Events are popped out by calling grpc_completion_queue_pluck() API ONLY */
|
102
|
-
GRPC_CQ_PLUCK
|
103
|
-
} grpc_cq_completion_type;
|
104
|
-
|
105
|
-
/** Completion queues internally MAY maintain a set of file descriptors in a
|
106
|
-
structure called 'pollset'. This enum specifies if a completion queue has an
|
107
|
-
associated pollset and any restrictions on the type of file descriptors that
|
108
|
-
can be present in the pollset.
|
109
|
-
|
110
|
-
I/O progress can only be made when grpc_completion_queue_next() or
|
111
|
-
grpc_completion_queue_pluck() are called on the completion queue (unless the
|
112
|
-
grpc_cq_polling_type is GRPC_CQ_NON_POLLING) and hence it is very important
|
113
|
-
to actively call these APIs */
|
114
|
-
typedef enum {
|
115
|
-
/** The completion queue will have an associated pollset and there is no
|
116
|
-
restriction on the type of file descriptors the pollset may contain */
|
117
|
-
GRPC_CQ_DEFAULT_POLLING,
|
118
|
-
|
119
|
-
/* Similar to GRPC_CQ_DEFAULT_POLLING except that the completion queues will
|
120
|
-
not contain any 'listening file descriptors' (i.e file descriptors used to
|
121
|
-
listen to incoming channels) */
|
122
|
-
GRPC_CQ_NON_LISTENING,
|
123
|
-
|
124
|
-
/* The completion queue will not have an associated pollset. Note that
|
125
|
-
grpc_completion_queue_next() or grpc_completion_queue_pluck() MUST still be
|
126
|
-
called to pop events from the completion queue; it is not required to call
|
127
|
-
them actively to make I/O progress */
|
128
|
-
GRPC_CQ_NON_POLLING
|
129
|
-
} grpc_cq_polling_type;
|
130
|
-
|
131
|
-
#define GRPC_CQ_CURRENT_VERSION 1
|
132
|
-
typedef struct grpc_completion_queue_attributes {
|
133
|
-
/* The version number of this structure. More fields might be added to this
|
134
|
-
structure in future. */
|
135
|
-
int version; /* Set to GRPC_CQ_CURRENT_VERSION */
|
136
|
-
|
137
|
-
grpc_cq_completion_type cq_completion_type;
|
138
|
-
|
139
|
-
grpc_cq_polling_type cq_polling_type;
|
140
|
-
} grpc_completion_queue_attributes;
|
141
|
-
|
142
|
-
/** The completion queue factory structure is opaque to the callers of grpc */
|
143
|
-
typedef struct grpc_completion_queue_factory grpc_completion_queue_factory;
|
144
|
-
|
145
96
|
/** Returns the completion queue factory based on the attributes. MAY return a
|
146
97
|
NULL if no factory can be found */
|
147
98
|
GRPCAPI const grpc_completion_queue_factory *
|
@@ -159,7 +110,9 @@ GRPCAPI grpc_completion_queue *grpc_completion_queue_create_for_pluck(
|
|
159
110
|
void *reserved);
|
160
111
|
|
161
112
|
/** Create a completion queue */
|
162
|
-
GRPCAPI grpc_completion_queue *grpc_completion_queue_create(
|
113
|
+
GRPCAPI grpc_completion_queue *grpc_completion_queue_create(
|
114
|
+
const grpc_completion_queue_factory *factory,
|
115
|
+
const grpc_completion_queue_attributes *attributes, void *reserved);
|
163
116
|
|
164
117
|
/** Blocks until an event is available, the completion queue is being shut down,
|
165
118
|
or deadline is reached.
|
@@ -269,6 +222,10 @@ GRPCAPI grpc_call *grpc_channel_create_registered_call(
|
|
269
222
|
grpc_completion_queue *completion_queue, void *registered_call_handle,
|
270
223
|
gpr_timespec deadline, void *reserved);
|
271
224
|
|
225
|
+
/** Allocate memory in the grpc_call arena: this memory is automatically
|
226
|
+
discarded at call completion */
|
227
|
+
GRPCAPI void *grpc_call_arena_alloc(grpc_call *call, size_t size);
|
228
|
+
|
272
229
|
/** Start a batch of operations defined in the array ops; when complete, post a
|
273
230
|
completion of type 'tag' to the completion queue bound to the call.
|
274
231
|
The order of ops specified in the batch has no significance.
|
@@ -300,12 +257,6 @@ GRPCAPI grpc_call_error grpc_call_start_batch(grpc_call *call,
|
|
300
257
|
functionality. Instead, use grpc_auth_context. */
|
301
258
|
GRPCAPI char *grpc_call_get_peer(grpc_call *call);
|
302
259
|
|
303
|
-
struct grpc_load_reporting_cost_context;
|
304
|
-
|
305
|
-
/* Associate costs contained in \a cost_context to \a call. */
|
306
|
-
GRPCAPI void grpc_call_set_load_reporting_cost_context(
|
307
|
-
grpc_call *call, struct grpc_load_reporting_cost_context *context);
|
308
|
-
|
309
260
|
struct census_context;
|
310
261
|
|
311
262
|
/** Set census context for a call; Must be called before first call to
|
@@ -342,7 +293,7 @@ GRPCAPI grpc_channel *grpc_lame_client_channel_create(
|
|
342
293
|
/** Close and destroy a grpc channel */
|
343
294
|
GRPCAPI void grpc_channel_destroy(grpc_channel *channel);
|
344
295
|
|
345
|
-
|
296
|
+
/** Error handling for grpc_call
|
346
297
|
Most grpc_call functions return a grpc_error. If the error is not GRPC_OK
|
347
298
|
then the operation failed due to some unsatisfied precondition.
|
348
299
|
If a grpc_call fails, it's guaranteed that no change to the call state
|
@@ -351,7 +302,7 @@ GRPCAPI void grpc_channel_destroy(grpc_channel *channel);
|
|
351
302
|
/** Called by clients to cancel an RPC on the server.
|
352
303
|
Can be called multiple times, from any thread.
|
353
304
|
THREAD-SAFETY grpc_call_cancel and grpc_call_cancel_with_status
|
354
|
-
are thread-safe, and can be called at any point before
|
305
|
+
are thread-safe, and can be called at any point before grpc_call_unref
|
355
306
|
is called.*/
|
356
307
|
GRPCAPI grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved);
|
357
308
|
|
@@ -366,9 +317,13 @@ GRPCAPI grpc_call_error grpc_call_cancel_with_status(grpc_call *call,
|
|
366
317
|
const char *description,
|
367
318
|
void *reserved);
|
368
319
|
|
369
|
-
/**
|
370
|
-
THREAD SAFETY:
|
371
|
-
GRPCAPI void
|
320
|
+
/** Ref a call.
|
321
|
+
THREAD SAFETY: grpc_call_unref is thread-compatible */
|
322
|
+
GRPCAPI void grpc_call_ref(grpc_call *call);
|
323
|
+
|
324
|
+
/** Unref a call.
|
325
|
+
THREAD SAFETY: grpc_call_unref is thread-compatible */
|
326
|
+
GRPCAPI void grpc_call_unref(grpc_call *call);
|
372
327
|
|
373
328
|
/** Request notification of a new call.
|
374
329
|
Once a call is received, a notification tagged with \a tag_new is added to
|
@@ -429,15 +384,6 @@ GRPCAPI void grpc_server_register_completion_queue(grpc_server *server,
|
|
429
384
|
grpc_completion_queue *cq,
|
430
385
|
void *reserved);
|
431
386
|
|
432
|
-
/** Register a non-listening completion queue with the server. This API is
|
433
|
-
similar to grpc_server_register_completion_queue except that the server will
|
434
|
-
not use this completion_queue to listen to any incoming channels.
|
435
|
-
|
436
|
-
Registering a non-listening completion queue will have negative performance
|
437
|
-
impact and hence this API is not recommended for production use cases. */
|
438
|
-
GRPCAPI void grpc_server_register_non_listening_completion_queue(
|
439
|
-
grpc_server *server, grpc_completion_queue *q, void *reserved);
|
440
|
-
|
441
387
|
/** Add a HTTP2 over plaintext over tcp listener.
|
442
388
|
Returns bound port number on success, 0 on failure.
|
443
389
|
REQUIRES: server not started */
|
@@ -42,7 +42,7 @@
|
|
42
42
|
extern "C" {
|
43
43
|
#endif
|
44
44
|
|
45
|
-
|
45
|
+
/** --- Authentication Context. --- */
|
46
46
|
|
47
47
|
typedef struct grpc_auth_context grpc_auth_context;
|
48
48
|
|
@@ -52,84 +52,84 @@ typedef struct grpc_auth_property_iterator {
|
|
52
52
|
const char *name;
|
53
53
|
} grpc_auth_property_iterator;
|
54
54
|
|
55
|
-
|
55
|
+
/** value, if not NULL, is guaranteed to be NULL terminated. */
|
56
56
|
typedef struct grpc_auth_property {
|
57
57
|
char *name;
|
58
58
|
char *value;
|
59
59
|
size_t value_length;
|
60
60
|
} grpc_auth_property;
|
61
61
|
|
62
|
-
|
62
|
+
/** Returns NULL when the iterator is at the end. */
|
63
63
|
GRPCAPI const grpc_auth_property *grpc_auth_property_iterator_next(
|
64
64
|
grpc_auth_property_iterator *it);
|
65
65
|
|
66
|
-
|
66
|
+
/** Iterates over the auth context. */
|
67
67
|
GRPCAPI grpc_auth_property_iterator
|
68
68
|
grpc_auth_context_property_iterator(const grpc_auth_context *ctx);
|
69
69
|
|
70
|
-
|
70
|
+
/** Gets the peer identity. Returns an empty iterator (first _next will return
|
71
71
|
NULL) if the peer is not authenticated. */
|
72
72
|
GRPCAPI grpc_auth_property_iterator
|
73
73
|
grpc_auth_context_peer_identity(const grpc_auth_context *ctx);
|
74
74
|
|
75
|
-
|
75
|
+
/** Finds a property in the context. May return an empty iterator (first _next
|
76
76
|
will return NULL) if no property with this name was found in the context. */
|
77
77
|
GRPCAPI grpc_auth_property_iterator grpc_auth_context_find_properties_by_name(
|
78
78
|
const grpc_auth_context *ctx, const char *name);
|
79
79
|
|
80
|
-
|
80
|
+
/** Gets the name of the property that indicates the peer identity. Will return
|
81
81
|
NULL if the peer is not authenticated. */
|
82
82
|
GRPCAPI const char *grpc_auth_context_peer_identity_property_name(
|
83
83
|
const grpc_auth_context *ctx);
|
84
84
|
|
85
|
-
|
85
|
+
/** Returns 1 if the peer is authenticated, 0 otherwise. */
|
86
86
|
GRPCAPI int grpc_auth_context_peer_is_authenticated(
|
87
87
|
const grpc_auth_context *ctx);
|
88
88
|
|
89
|
-
|
89
|
+
/** Gets the auth context from the call. Caller needs to call
|
90
90
|
grpc_auth_context_release on the returned context. */
|
91
91
|
GRPCAPI grpc_auth_context *grpc_call_auth_context(grpc_call *call);
|
92
92
|
|
93
|
-
|
93
|
+
/** Releases the auth context returned from grpc_call_auth_context. */
|
94
94
|
GRPCAPI void grpc_auth_context_release(grpc_auth_context *context);
|
95
95
|
|
96
|
-
|
96
|
+
/** --
|
97
97
|
The following auth context methods should only be called by a server metadata
|
98
98
|
processor to set properties extracted from auth metadata.
|
99
99
|
-- */
|
100
100
|
|
101
|
-
|
101
|
+
/** Add a property. */
|
102
102
|
GRPCAPI void grpc_auth_context_add_property(grpc_auth_context *ctx,
|
103
103
|
const char *name, const char *value,
|
104
104
|
size_t value_length);
|
105
105
|
|
106
|
-
|
106
|
+
/** Add a C string property. */
|
107
107
|
GRPCAPI void grpc_auth_context_add_cstring_property(grpc_auth_context *ctx,
|
108
108
|
const char *name,
|
109
109
|
const char *value);
|
110
110
|
|
111
|
-
|
111
|
+
/** Sets the property name. Returns 1 if successful or 0 in case of failure
|
112
112
|
(which means that no property with this name exists). */
|
113
113
|
GRPCAPI int grpc_auth_context_set_peer_identity_property_name(
|
114
114
|
grpc_auth_context *ctx, const char *name);
|
115
115
|
|
116
|
-
|
116
|
+
/** --- grpc_channel_credentials object. ---
|
117
117
|
|
118
118
|
A channel credentials object represents a way to authenticate a client on a
|
119
119
|
channel. */
|
120
120
|
|
121
121
|
typedef struct grpc_channel_credentials grpc_channel_credentials;
|
122
122
|
|
123
|
-
|
123
|
+
/** Releases a channel credentials object.
|
124
124
|
The creator of the credentials object is responsible for its release. */
|
125
125
|
GRPCAPI void grpc_channel_credentials_release(grpc_channel_credentials *creds);
|
126
126
|
|
127
|
-
|
127
|
+
/** Creates default credentials to connect to a google gRPC service.
|
128
128
|
WARNING: Do NOT use this credentials to connect to a non-google service as
|
129
129
|
this could result in an oauth2 token leak. */
|
130
130
|
GRPCAPI grpc_channel_credentials *grpc_google_default_credentials_create(void);
|
131
131
|
|
132
|
-
|
132
|
+
/** Callback for getting the SSL roots override from the application.
|
133
133
|
In case of success, *pem_roots_certs must be set to a NULL terminated string
|
134
134
|
containing the list of PEM encoded root certificates. The ownership is passed
|
135
135
|
to the core and freed (laster by the core) with gpr_free.
|
@@ -138,7 +138,7 @@ GRPCAPI grpc_channel_credentials *grpc_google_default_credentials_create(void);
|
|
138
138
|
typedef grpc_ssl_roots_override_result (*grpc_ssl_roots_override_callback)(
|
139
139
|
char **pem_root_certs);
|
140
140
|
|
141
|
-
|
141
|
+
/** Setup a callback to override the default TLS/SSL roots.
|
142
142
|
This function is not thread-safe and must be called at initialization time
|
143
143
|
before any ssl credentials are created to have the desired side effect.
|
144
144
|
If GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment is set to a valid path, the
|
@@ -146,19 +146,19 @@ typedef grpc_ssl_roots_override_result (*grpc_ssl_roots_override_callback)(
|
|
146
146
|
GRPCAPI void grpc_set_ssl_roots_override_callback(
|
147
147
|
grpc_ssl_roots_override_callback cb);
|
148
148
|
|
149
|
-
|
149
|
+
/** Object that holds a private key / certificate chain pair in PEM format. */
|
150
150
|
typedef struct {
|
151
|
-
|
151
|
+
/** private_key is the NULL-terminated string containing the PEM encoding of
|
152
152
|
the client's private key. */
|
153
153
|
const char *private_key;
|
154
154
|
|
155
|
-
|
155
|
+
/** cert_chain is the NULL-terminated string containing the PEM encoding of
|
156
156
|
the client's certificate chain. */
|
157
157
|
const char *cert_chain;
|
158
158
|
} grpc_ssl_pem_key_cert_pair;
|
159
159
|
|
160
|
-
|
161
|
-
-
|
160
|
+
/** Creates an SSL credentials object.
|
161
|
+
- pem_root_certs is the NULL-terminated string containing the PEM encoding
|
162
162
|
of the server root certificates. If this parameter is NULL, the
|
163
163
|
implementation will first try to dereference the file pointed by the
|
164
164
|
GRPC_DEFAULT_SSL_ROOTS_FILE_PATH environment variable, and if that fails,
|
@@ -172,7 +172,7 @@ GRPCAPI grpc_channel_credentials *grpc_ssl_credentials_create(
|
|
172
172
|
const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pair,
|
173
173
|
void *reserved);
|
174
174
|
|
175
|
-
|
175
|
+
/** --- grpc_call_credentials object.
|
176
176
|
|
177
177
|
A call credentials object represents a way to authenticate on a particular
|
178
178
|
call. These credentials can be composed with a channel credentials object
|
@@ -180,21 +180,21 @@ GRPCAPI grpc_channel_credentials *grpc_ssl_credentials_create(
|
|
180
180
|
|
181
181
|
typedef struct grpc_call_credentials grpc_call_credentials;
|
182
182
|
|
183
|
-
|
183
|
+
/** Releases a call credentials object.
|
184
184
|
The creator of the credentials object is responsible for its release. */
|
185
185
|
GRPCAPI void grpc_call_credentials_release(grpc_call_credentials *creds);
|
186
186
|
|
187
|
-
|
187
|
+
/** Creates a composite channel credentials object. */
|
188
188
|
GRPCAPI grpc_channel_credentials *grpc_composite_channel_credentials_create(
|
189
189
|
grpc_channel_credentials *channel_creds, grpc_call_credentials *call_creds,
|
190
190
|
void *reserved);
|
191
191
|
|
192
|
-
|
192
|
+
/** Creates a composite call credentials object. */
|
193
193
|
GRPCAPI grpc_call_credentials *grpc_composite_call_credentials_create(
|
194
194
|
grpc_call_credentials *creds1, grpc_call_credentials *creds2,
|
195
195
|
void *reserved);
|
196
196
|
|
197
|
-
|
197
|
+
/** Creates a compute engine credentials object for connecting to Google.
|
198
198
|
WARNING: Do NOT use this credentials to connect to a non-google service as
|
199
199
|
this could result in an oauth2 token leak. */
|
200
200
|
GRPCAPI grpc_call_credentials *grpc_google_compute_engine_credentials_create(
|
@@ -202,7 +202,7 @@ GRPCAPI grpc_call_credentials *grpc_google_compute_engine_credentials_create(
|
|
202
202
|
|
203
203
|
GRPCAPI gpr_timespec grpc_max_auth_token_lifetime();
|
204
204
|
|
205
|
-
|
205
|
+
/** Creates a JWT credentials object. May return NULL if the input is invalid.
|
206
206
|
- json_key is the JSON key string containing the client's private key.
|
207
207
|
- token_lifetime is the lifetime of each Json Web Token (JWT) created with
|
208
208
|
this credentials. It should not exceed grpc_max_auth_token_lifetime or
|
@@ -212,7 +212,7 @@ grpc_service_account_jwt_access_credentials_create(const char *json_key,
|
|
212
212
|
gpr_timespec token_lifetime,
|
213
213
|
void *reserved);
|
214
214
|
|
215
|
-
|
215
|
+
/** Creates an Oauth2 Refresh Token credentials object for connecting to Google.
|
216
216
|
May return NULL if the input is invalid.
|
217
217
|
WARNING: Do NOT use this credentials to connect to a non-google service as
|
218
218
|
this could result in an oauth2 token leak.
|
@@ -221,17 +221,17 @@ grpc_service_account_jwt_access_credentials_create(const char *json_key,
|
|
221
221
|
GRPCAPI grpc_call_credentials *grpc_google_refresh_token_credentials_create(
|
222
222
|
const char *json_refresh_token, void *reserved);
|
223
223
|
|
224
|
-
|
224
|
+
/** Creates an Oauth2 Access Token credentials with an access token that was
|
225
225
|
aquired by an out of band mechanism. */
|
226
226
|
GRPCAPI grpc_call_credentials *grpc_access_token_credentials_create(
|
227
227
|
const char *access_token, void *reserved);
|
228
228
|
|
229
|
-
|
229
|
+
/** Creates an IAM credentials object for connecting to Google. */
|
230
230
|
GRPCAPI grpc_call_credentials *grpc_google_iam_credentials_create(
|
231
231
|
const char *authorization_token, const char *authority_selector,
|
232
232
|
void *reserved);
|
233
233
|
|
234
|
-
|
234
|
+
/** Callback function to be called by the metadata credentials plugin
|
235
235
|
implementation when the metadata is ready.
|
236
236
|
- user_data is the opaque pointer that was passed in the get_metadata method
|
237
237
|
of the grpc_metadata_credentials_plugin (see below).
|
@@ -246,31 +246,31 @@ typedef void (*grpc_credentials_plugin_metadata_cb)(
|
|
246
246
|
void *user_data, const grpc_metadata *creds_md, size_t num_creds_md,
|
247
247
|
grpc_status_code status, const char *error_details);
|
248
248
|
|
249
|
-
|
249
|
+
/** Context that can be used by metadata credentials plugin in order to create
|
250
250
|
auth related metadata. */
|
251
251
|
typedef struct {
|
252
|
-
|
252
|
+
/** The fully qualifed service url. */
|
253
253
|
const char *service_url;
|
254
254
|
|
255
|
-
|
255
|
+
/** The method name of the RPC being called (not fully qualified).
|
256
256
|
The fully qualified method name can be built from the service_url:
|
257
257
|
full_qualified_method_name = ctx->service_url + '/' + ctx->method_name. */
|
258
258
|
const char *method_name;
|
259
259
|
|
260
|
-
|
260
|
+
/** The auth_context of the channel which gives the server's identity. */
|
261
261
|
const grpc_auth_context *channel_auth_context;
|
262
262
|
|
263
|
-
|
263
|
+
/** Reserved for future use. */
|
264
264
|
void *reserved;
|
265
265
|
} grpc_auth_metadata_context;
|
266
266
|
|
267
|
-
|
267
|
+
/** grpc_metadata_credentials plugin is an API user provided structure used to
|
268
268
|
create grpc_credentials objects that can be set on a channel (composed) or
|
269
269
|
a call. See grpc_credentials_metadata_create_from_plugin below.
|
270
270
|
The grpc client stack will call the get_metadata method of the plugin for
|
271
271
|
every call in scope for the credentials created from it. */
|
272
272
|
typedef struct {
|
273
|
-
|
273
|
+
/** The implementation of this method has to be non-blocking.
|
274
274
|
- context is the information that can be used by the plugin to create auth
|
275
275
|
metadata.
|
276
276
|
- cb is the callback that needs to be called when the metadata is ready.
|
@@ -278,39 +278,39 @@ typedef struct {
|
|
278
278
|
void (*get_metadata)(void *state, grpc_auth_metadata_context context,
|
279
279
|
grpc_credentials_plugin_metadata_cb cb, void *user_data);
|
280
280
|
|
281
|
-
|
281
|
+
/** Destroys the plugin state. */
|
282
282
|
void (*destroy)(void *state);
|
283
283
|
|
284
|
-
|
284
|
+
/** State that will be set as the first parameter of the methods above. */
|
285
285
|
void *state;
|
286
286
|
|
287
|
-
|
287
|
+
/** Type of credentials that this plugin is implementing. */
|
288
288
|
const char *type;
|
289
289
|
} grpc_metadata_credentials_plugin;
|
290
290
|
|
291
|
-
|
291
|
+
/** Creates a credentials object from a plugin. */
|
292
292
|
GRPCAPI grpc_call_credentials *grpc_metadata_credentials_create_from_plugin(
|
293
293
|
grpc_metadata_credentials_plugin plugin, void *reserved);
|
294
294
|
|
295
|
-
|
295
|
+
/** --- Secure channel creation. --- */
|
296
296
|
|
297
|
-
|
297
|
+
/** Creates a secure channel using the passed-in credentials. */
|
298
298
|
GRPCAPI grpc_channel *grpc_secure_channel_create(
|
299
299
|
grpc_channel_credentials *creds, const char *target,
|
300
300
|
const grpc_channel_args *args, void *reserved);
|
301
301
|
|
302
|
-
|
302
|
+
/** --- grpc_server_credentials object. ---
|
303
303
|
|
304
304
|
A server credentials object represents a way to authenticate a server. */
|
305
305
|
|
306
306
|
typedef struct grpc_server_credentials grpc_server_credentials;
|
307
307
|
|
308
|
-
|
308
|
+
/** Releases a server_credentials object.
|
309
309
|
The creator of the server_credentials object is responsible for its release.
|
310
310
|
*/
|
311
311
|
GRPCAPI void grpc_server_credentials_release(grpc_server_credentials *creds);
|
312
312
|
|
313
|
-
|
313
|
+
/** Deprecated in favor of grpc_ssl_server_credentials_create_ex.
|
314
314
|
Creates an SSL server_credentials object.
|
315
315
|
- pem_roots_cert is the NULL-terminated string containing the PEM encoding of
|
316
316
|
the client root certificates. This parameter may be NULL if the server does
|
@@ -326,7 +326,7 @@ GRPCAPI grpc_server_credentials *grpc_ssl_server_credentials_create(
|
|
326
326
|
const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs,
|
327
327
|
size_t num_key_cert_pairs, int force_client_auth, void *reserved);
|
328
328
|
|
329
|
-
|
329
|
+
/** Same as grpc_ssl_server_credentials_create method except uses
|
330
330
|
grpc_ssl_client_certificate_request_type enum to support more ways to
|
331
331
|
authenticate client cerificates.*/
|
332
332
|
GRPCAPI grpc_server_credentials *grpc_ssl_server_credentials_create_ex(
|
@@ -335,25 +335,25 @@ GRPCAPI grpc_server_credentials *grpc_ssl_server_credentials_create_ex(
|
|
335
335
|
grpc_ssl_client_certificate_request_type client_certificate_request,
|
336
336
|
void *reserved);
|
337
337
|
|
338
|
-
|
338
|
+
/** --- Server-side secure ports. --- */
|
339
339
|
|
340
|
-
|
340
|
+
/** Add a HTTP2 over an encrypted link over tcp listener.
|
341
341
|
Returns bound port number on success, 0 on failure.
|
342
342
|
REQUIRES: server not started */
|
343
343
|
GRPCAPI int grpc_server_add_secure_http2_port(grpc_server *server,
|
344
344
|
const char *addr,
|
345
345
|
grpc_server_credentials *creds);
|
346
346
|
|
347
|
-
|
347
|
+
/** --- Call specific credentials. --- */
|
348
348
|
|
349
|
-
|
349
|
+
/** Sets a credentials to a call. Can only be called on the client side before
|
350
350
|
grpc_call_start_batch. */
|
351
351
|
GRPCAPI grpc_call_error grpc_call_set_credentials(grpc_call *call,
|
352
352
|
grpc_call_credentials *creds);
|
353
353
|
|
354
|
-
|
354
|
+
/** --- Auth Metadata Processing --- */
|
355
355
|
|
356
|
-
|
356
|
+
/** Callback function that is called when the metadata processing is done.
|
357
357
|
- Consumed metadata will be removed from the set of metadata available on the
|
358
358
|
call. consumed_md may be NULL if no metadata has been consumed.
|
359
359
|
- Response metadata will be set on the response. response_md may be NULL.
|
@@ -367,9 +367,9 @@ typedef void (*grpc_process_auth_metadata_done_cb)(
|
|
367
367
|
const grpc_metadata *response_md, size_t num_response_md,
|
368
368
|
grpc_status_code status, const char *error_details);
|
369
369
|
|
370
|
-
|
370
|
+
/** Pluggable server-side metadata processor object. */
|
371
371
|
typedef struct {
|
372
|
-
|
372
|
+
/** The context object is read/write: it contains the properties of the
|
373
373
|
channel peer and it is the job of the process function to augment it with
|
374
374
|
properties derived from the passed-in metadata.
|
375
375
|
The lifetime of these objects is guaranteed until cb is invoked. */
|