aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/cpp_generator.cc108
-rw-r--r--src/compiler/cpp_generator.h6
-rw-r--r--src/compiler/cpp_plugin.cc14
-rw-r--r--src/compiler/python_generator.cc7
-rw-r--r--src/core/channel/client_uchannel.c234
-rw-r--r--src/core/httpcli/parser.c211
-rw-r--r--src/core/lib/census/README.md (renamed from src/core/census/README.md)0
-rw-r--r--src/core/lib/census/aggregation.h (renamed from src/core/census/aggregation.h)6
-rw-r--r--src/core/lib/census/context.c (renamed from src/core/census/context.c)2
-rw-r--r--src/core/lib/census/grpc_context.c (renamed from src/core/census/grpc_context.c)6
-rw-r--r--src/core/lib/census/grpc_filter.c (renamed from src/core/census/grpc_filter.c)40
-rw-r--r--src/core/lib/census/grpc_filter.h (renamed from src/core/census/grpc_filter.h)8
-rw-r--r--src/core/lib/census/grpc_plugin.c (renamed from src/core/census/grpc_plugin.c)10
-rw-r--r--src/core/lib/census/grpc_plugin.h (renamed from src/core/census/grpc_plugin.h)6
-rw-r--r--src/core/lib/census/initialize.c (renamed from src/core/census/initialize.c)0
-rw-r--r--src/core/lib/census/mlog.c (renamed from src/core/census/mlog.c)2
-rw-r--r--src/core/lib/census/mlog.h (renamed from src/core/census/mlog.h)6
-rw-r--r--src/core/lib/census/operation.c (renamed from src/core/census/operation.c)2
-rw-r--r--src/core/lib/census/placeholders.c (renamed from src/core/census/placeholders.c)0
-rw-r--r--src/core/lib/census/rpc_metric_id.h (renamed from src/core/census/rpc_metric_id.h)6
-rw-r--r--src/core/lib/census/tracing.c (renamed from src/core/census/tracing.c)2
-rw-r--r--src/core/lib/channel/channel_args.c (renamed from src/core/channel/channel_args.c)4
-rw-r--r--src/core/lib/channel/channel_args.h (renamed from src/core/channel/channel_args.h)6
-rw-r--r--src/core/lib/channel/channel_stack.c (renamed from src/core/channel/channel_stack.c)4
-rw-r--r--src/core/lib/channel/channel_stack.h (renamed from src/core/channel/channel_stack.h)10
-rw-r--r--src/core/lib/channel/channel_stack_builder.c (renamed from src/core/channel/channel_stack_builder.c)3
-rw-r--r--src/core/lib/channel/channel_stack_builder.h (renamed from src/core/channel/channel_stack_builder.h)10
-rw-r--r--src/core/lib/channel/client_channel.c (renamed from src/core/channel/client_channel.c)32
-rw-r--r--src/core/lib/channel/client_channel.h (renamed from src/core/channel/client_channel.h)10
-rw-r--r--src/core/lib/channel/compress_filter.c (renamed from src/core/channel/compress_filter.c)29
-rw-r--r--src/core/lib/channel/compress_filter.h (renamed from src/core/channel/compress_filter.h)8
-rw-r--r--src/core/lib/channel/connected_channel.c (renamed from src/core/channel/connected_channel.c)22
-rw-r--r--src/core/lib/channel/connected_channel.h (renamed from src/core/channel/connected_channel.h)8
-rw-r--r--src/core/lib/channel/context.h (renamed from src/core/channel/context.h)6
-rw-r--r--src/core/lib/channel/http_client_filter.c (renamed from src/core/channel/http_client_filter.c)23
-rw-r--r--src/core/lib/channel/http_client_filter.h (renamed from src/core/channel/http_client_filter.h)8
-rw-r--r--src/core/lib/channel/http_server_filter.c (renamed from src/core/channel/http_server_filter.c)21
-rw-r--r--src/core/lib/channel/http_server_filter.h (renamed from src/core/channel/http_server_filter.h)8
-rw-r--r--src/core/lib/channel/subchannel_call_holder.c (renamed from src/core/channel/subchannel_call_holder.c)4
-rw-r--r--src/core/lib/channel/subchannel_call_holder.h (renamed from src/core/channel/subchannel_call_holder.h)13
-rw-r--r--src/core/lib/client_config/README.md (renamed from src/core/client_config/README.md)0
-rw-r--r--src/core/lib/client_config/client_config.c (renamed from src/core/client_config/client_config.c)2
-rw-r--r--src/core/lib/client_config/client_config.h (renamed from src/core/client_config/client_config.h)8
-rw-r--r--src/core/lib/client_config/connector.c (renamed from src/core/client_config/connector.c)2
-rw-r--r--src/core/lib/client_config/connector.h (renamed from src/core/client_config/connector.h)12
-rw-r--r--src/core/lib/client_config/default_initial_connect_string.c (renamed from src/core/client_config/default_initial_connect_string.c)4
-rw-r--r--src/core/lib/client_config/initial_connect_string.c (renamed from src/core/client_config/initial_connect_string.c)4
-rw-r--r--src/core/lib/client_config/initial_connect_string.h (renamed from src/core/client_config/initial_connect_string.h)8
-rw-r--r--src/core/lib/client_config/lb_policies/load_balancer_api.c (renamed from src/core/client_config/lb_policies/load_balancer_api.c)2
-rw-r--r--src/core/lib/client_config/lb_policies/load_balancer_api.h (renamed from src/core/client_config/lb_policies/load_balancer_api.h)10
-rw-r--r--src/core/lib/client_config/lb_policies/pick_first.c (renamed from src/core/client_config/lb_policies/pick_first.c)12
-rw-r--r--src/core/lib/client_config/lb_policies/pick_first.h (renamed from src/core/client_config/lb_policies/pick_first.h)8
-rw-r--r--src/core/lib/client_config/lb_policies/round_robin.c (renamed from src/core/client_config/lb_policies/round_robin.c)10
-rw-r--r--src/core/lib/client_config/lb_policies/round_robin.h (renamed from src/core/client_config/lb_policies/round_robin.h)10
-rw-r--r--src/core/lib/client_config/lb_policy.c (renamed from src/core/client_config/lb_policy.c)2
-rw-r--r--src/core/lib/client_config/lb_policy.h (renamed from src/core/client_config/lb_policy.h)10
-rw-r--r--src/core/lib/client_config/lb_policy_factory.c (renamed from src/core/client_config/lb_policy_factory.c)4
-rw-r--r--src/core/lib/client_config/lb_policy_factory.h (renamed from src/core/client_config/lb_policy_factory.h)10
-rw-r--r--src/core/lib/client_config/lb_policy_registry.c (renamed from src/core/client_config/lb_policy_registry.c)4
-rw-r--r--src/core/lib/client_config/lb_policy_registry.h (renamed from src/core/client_config/lb_policy_registry.h)8
-rw-r--r--src/core/lib/client_config/resolver.c (renamed from src/core/client_config/resolver.c)4
-rw-r--r--src/core/lib/client_config/resolver.h (renamed from src/core/client_config/resolver.h)12
-rw-r--r--src/core/lib/client_config/resolver_factory.c (renamed from src/core/client_config/resolver_factory.c)4
-rw-r--r--src/core/lib/client_config/resolver_factory.h (renamed from src/core/client_config/resolver_factory.h)12
-rw-r--r--src/core/lib/client_config/resolver_registry.c (renamed from src/core/client_config/resolver_registry.c)4
-rw-r--r--src/core/lib/client_config/resolver_registry.h (renamed from src/core/client_config/resolver_registry.h)8
-rw-r--r--src/core/lib/client_config/resolvers/dns_resolver.c (renamed from src/core/client_config/resolvers/dns_resolver.c)37
-rw-r--r--src/core/lib/client_config/resolvers/dns_resolver.h (renamed from src/core/client_config/resolvers/dns_resolver.h)8
-rw-r--r--src/core/lib/client_config/resolvers/sockaddr_resolver.c (renamed from src/core/client_config/resolvers/sockaddr_resolver.c)43
-rw-r--r--src/core/lib/client_config/resolvers/sockaddr_resolver.h (renamed from src/core/client_config/resolvers/sockaddr_resolver.h)8
-rw-r--r--src/core/lib/client_config/resolvers/zookeeper_resolver.c (renamed from src/core/client_config/resolvers/zookeeper_resolver.c)14
-rw-r--r--src/core/lib/client_config/resolvers/zookeeper_resolver.h (renamed from src/core/client_config/resolvers/zookeeper_resolver.h)8
-rw-r--r--src/core/lib/client_config/subchannel.c (renamed from src/core/client_config/subchannel.c)40
-rw-r--r--src/core/lib/client_config/subchannel.h (renamed from src/core/client_config/subchannel.h)28
-rw-r--r--src/core/lib/client_config/subchannel_factory.c (renamed from src/core/client_config/subchannel_factory.c)4
-rw-r--r--src/core/lib/client_config/subchannel_factory.h (renamed from src/core/client_config/subchannel_factory.h)10
-rw-r--r--src/core/lib/client_config/subchannel_index.c (renamed from src/core/client_config/subchannel_index.c)4
-rw-r--r--src/core/lib/client_config/subchannel_index.h (renamed from src/core/client_config/subchannel_index.h)10
-rw-r--r--src/core/lib/client_config/uri_parser.c (renamed from src/core/client_config/uri_parser.c)4
-rw-r--r--src/core/lib/client_config/uri_parser.h (renamed from src/core/client_config/uri_parser.h)6
-rw-r--r--src/core/lib/compression/algorithm_metadata.h (renamed from src/core/compression/algorithm_metadata.h)8
-rw-r--r--src/core/lib/compression/compression_algorithm.c (renamed from src/core/compression/compression_algorithm.c)6
-rw-r--r--src/core/lib/compression/message_compress.c (renamed from src/core/compression/message_compress.c)4
-rw-r--r--src/core/lib/compression/message_compress.h (renamed from src/core/compression/message_compress.h)6
-rw-r--r--src/core/lib/debug/trace.c (renamed from src/core/debug/trace.c)6
-rw-r--r--src/core/lib/debug/trace.h (renamed from src/core/debug/trace.h)6
-rw-r--r--src/core/lib/http/format_request.c (renamed from src/core/httpcli/format_request.c)18
-rw-r--r--src/core/lib/http/format_request.h (renamed from src/core/httpcli/format_request.h)8
-rw-r--r--src/core/lib/http/httpcli.c (renamed from src/core/httpcli/httpcli.c)39
-rw-r--r--src/core/lib/http/httpcli.h (renamed from src/core/httpcli/httpcli.h)45
-rw-r--r--src/core/lib/http/httpcli_security_connector.c (renamed from src/core/httpcli/httpcli_security_connector.c)8
-rw-r--r--src/core/lib/http/parser.c313
-rw-r--r--src/core/lib/http/parser.h116
-rw-r--r--src/core/lib/iomgr/closure.c (renamed from src/core/iomgr/closure.c)2
-rw-r--r--src/core/lib/iomgr/closure.h (renamed from src/core/iomgr/closure.h)6
-rw-r--r--src/core/lib/iomgr/endpoint.c (renamed from src/core/iomgr/endpoint.c)4
-rw-r--r--src/core/lib/iomgr/endpoint.h (renamed from src/core/iomgr/endpoint.h)10
-rw-r--r--src/core/lib/iomgr/endpoint_pair.h (renamed from src/core/iomgr/endpoint_pair.h)8
-rw-r--r--src/core/lib/iomgr/endpoint_pair_posix.c (renamed from src/core/iomgr/endpoint_pair_posix.c)15
-rw-r--r--src/core/lib/iomgr/endpoint_pair_windows.c (renamed from src/core/iomgr/endpoint_pair_windows.c)10
-rw-r--r--src/core/lib/iomgr/exec_ctx.c (renamed from src/core/iomgr/exec_ctx.c)4
-rw-r--r--src/core/lib/iomgr/exec_ctx.h (renamed from src/core/iomgr/exec_ctx.h)8
-rw-r--r--src/core/lib/iomgr/executor.c (renamed from src/core/iomgr/executor.c)4
-rw-r--r--src/core/lib/iomgr/executor.h (renamed from src/core/iomgr/executor.h)8
-rw-r--r--src/core/lib/iomgr/fd_posix.c (renamed from src/core/iomgr/fd_posix.c)9
-rw-r--r--src/core/lib/iomgr/fd_posix.h (renamed from src/core/iomgr/fd_posix.h)10
-rw-r--r--src/core/lib/iomgr/iocp_windows.c (renamed from src/core/iomgr/iocp_windows.c)10
-rw-r--r--src/core/lib/iomgr/iocp_windows.h (renamed from src/core/iomgr/iocp_windows.h)8
-rw-r--r--src/core/lib/iomgr/iomgr.c (renamed from src/core/iomgr/iomgr.c)12
-rw-r--r--src/core/lib/iomgr/iomgr.h (renamed from src/core/iomgr/iomgr.h)6
-rw-r--r--src/core/lib/iomgr/iomgr_internal.h (renamed from src/core/iomgr/iomgr_internal.h)8
-rw-r--r--src/core/lib/iomgr/iomgr_posix.c (renamed from src/core/iomgr/iomgr_posix.c)10
-rw-r--r--src/core/lib/iomgr/iomgr_posix.h (renamed from src/core/iomgr/iomgr_posix.h)8
-rw-r--r--src/core/lib/iomgr/iomgr_windows.c (renamed from src/core/iomgr/iomgr_windows.c)10
-rw-r--r--src/core/lib/iomgr/pollset.h (renamed from src/core/iomgr/pollset.h)8
-rw-r--r--src/core/lib/iomgr/pollset_multipoller_with_epoll.c (renamed from src/core/iomgr/pollset_multipoller_with_epoll.c)8
-rw-r--r--src/core/lib/iomgr/pollset_multipoller_with_poll_posix.c (renamed from src/core/iomgr/pollset_multipoller_with_poll_posix.c)10
-rw-r--r--src/core/lib/iomgr/pollset_posix.c (renamed from src/core/iomgr/pollset_posix.c)12
-rw-r--r--src/core/lib/iomgr/pollset_posix.h (renamed from src/core/iomgr/pollset_posix.h)14
-rw-r--r--src/core/lib/iomgr/pollset_set.h (renamed from src/core/iomgr/pollset_set.h)8
-rw-r--r--src/core/lib/iomgr/pollset_set_posix.c (renamed from src/core/iomgr/pollset_set_posix.c)4
-rw-r--r--src/core/lib/iomgr/pollset_set_posix.h (renamed from src/core/iomgr/pollset_set_posix.h)10
-rw-r--r--src/core/lib/iomgr/pollset_set_windows.c (renamed from src/core/iomgr/pollset_set_windows.c)2
-rw-r--r--src/core/lib/iomgr/pollset_set_windows.h (renamed from src/core/iomgr/pollset_set_windows.h)8
-rw-r--r--src/core/lib/iomgr/pollset_windows.c (renamed from src/core/iomgr/pollset_windows.c)8
-rw-r--r--src/core/lib/iomgr/pollset_windows.h (renamed from src/core/iomgr/pollset_windows.h)8
-rw-r--r--src/core/lib/iomgr/resolve_address.h (renamed from src/core/iomgr/resolve_address.h)10
-rw-r--r--src/core/lib/iomgr/resolve_address_posix.c (renamed from src/core/iomgr/resolve_address_posix.c)26
-rw-r--r--src/core/lib/iomgr/resolve_address_windows.c (renamed from src/core/iomgr/resolve_address_windows.c)14
-rw-r--r--src/core/lib/iomgr/sockaddr.h (renamed from src/core/iomgr/sockaddr.h)10
-rw-r--r--src/core/lib/iomgr/sockaddr_posix.h (renamed from src/core/iomgr/sockaddr_posix.h)10
-rw-r--r--src/core/lib/iomgr/sockaddr_utils.c (renamed from src/core/iomgr/sockaddr_utils.c)25
-rw-r--r--src/core/lib/iomgr/sockaddr_utils.h (renamed from src/core/iomgr/sockaddr_utils.h)8
-rw-r--r--src/core/lib/iomgr/sockaddr_win32.h (renamed from src/core/iomgr/sockaddr_win32.h)8
-rw-r--r--src/core/lib/iomgr/socket_utils_common_posix.c (renamed from src/core/iomgr/socket_utils_common_posix.c)16
-rw-r--r--src/core/lib/iomgr/socket_utils_linux.c (renamed from src/core/iomgr/socket_utils_linux.c)6
-rw-r--r--src/core/lib/iomgr/socket_utils_posix.c (renamed from src/core/iomgr/socket_utils_posix.c)4
-rw-r--r--src/core/lib/iomgr/socket_utils_posix.h (renamed from src/core/iomgr/socket_utils_posix.h)8
-rw-r--r--src/core/lib/iomgr/socket_windows.c (renamed from src/core/iomgr/socket_windows.c)14
-rw-r--r--src/core/lib/iomgr/socket_windows.h (renamed from src/core/iomgr/socket_windows.h)12
-rw-r--r--src/core/lib/iomgr/tcp_client.h (renamed from src/core/iomgr/tcp_client.h)12
-rw-r--r--src/core/lib/iomgr/tcp_client_posix.c (renamed from src/core/iomgr/tcp_client_posix.c)22
-rw-r--r--src/core/lib/iomgr/tcp_client_windows.c (renamed from src/core/iomgr/tcp_client_windows.c)16
-rw-r--r--src/core/lib/iomgr/tcp_posix.c (renamed from src/core/iomgr/tcp_posix.c)16
-rw-r--r--src/core/lib/iomgr/tcp_posix.h (renamed from src/core/iomgr/tcp_posix.h)10
-rw-r--r--src/core/lib/iomgr/tcp_server.h (renamed from src/core/iomgr/tcp_server.h)10
-rw-r--r--src/core/lib/iomgr/tcp_server_posix.c (renamed from src/core/iomgr/tcp_server_posix.c)58
-rw-r--r--src/core/lib/iomgr/tcp_server_windows.c (renamed from src/core/iomgr/tcp_server_windows.c)12
-rw-r--r--src/core/lib/iomgr/tcp_windows.c (renamed from src/core/iomgr/tcp_windows.c)26
-rw-r--r--src/core/lib/iomgr/tcp_windows.h (renamed from src/core/iomgr/tcp_windows.h)10
-rw-r--r--src/core/lib/iomgr/time_averaged_stats.c (renamed from src/core/iomgr/time_averaged_stats.c)4
-rw-r--r--src/core/lib/iomgr/time_averaged_stats.h (renamed from src/core/iomgr/time_averaged_stats.h)6
-rw-r--r--src/core/lib/iomgr/timer.c (renamed from src/core/iomgr/timer.c)6
-rw-r--r--src/core/lib/iomgr/timer.h (renamed from src/core/iomgr/timer.h)10
-rw-r--r--src/core/lib/iomgr/timer_heap.c (renamed from src/core/iomgr/timer_heap.c)2
-rw-r--r--src/core/lib/iomgr/timer_heap.h (renamed from src/core/iomgr/timer_heap.h)8
-rw-r--r--src/core/lib/iomgr/udp_server.c (renamed from src/core/iomgr/udp_server.c)36
-rw-r--r--src/core/lib/iomgr/udp_server.h (renamed from src/core/iomgr/udp_server.h)19
-rw-r--r--src/core/lib/iomgr/unix_sockets_posix.c103
-rw-r--r--src/core/lib/iomgr/unix_sockets_posix.h (renamed from src/core/channel/client_uchannel.h)39
-rw-r--r--src/core/lib/iomgr/unix_sockets_posix_noop.c (renamed from src/core/httpcli/parser.h)45
-rw-r--r--src/core/lib/iomgr/wakeup_fd_eventfd.c (renamed from src/core/iomgr/wakeup_fd_eventfd.c)6
-rw-r--r--src/core/lib/iomgr/wakeup_fd_nospecial.c (renamed from src/core/iomgr/wakeup_fd_nospecial.c)4
-rw-r--r--src/core/lib/iomgr/wakeup_fd_pipe.c (renamed from src/core/iomgr/wakeup_fd_pipe.c)13
-rw-r--r--src/core/lib/iomgr/wakeup_fd_pipe.h (renamed from src/core/iomgr/wakeup_fd_pipe.h)8
-rw-r--r--src/core/lib/iomgr/wakeup_fd_posix.c (renamed from src/core/iomgr/wakeup_fd_posix.c)6
-rw-r--r--src/core/lib/iomgr/wakeup_fd_posix.h (renamed from src/core/iomgr/wakeup_fd_posix.h)6
-rw-r--r--src/core/lib/iomgr/workqueue.h (renamed from src/core/iomgr/workqueue.h)18
-rw-r--r--src/core/lib/iomgr/workqueue_posix.c (renamed from src/core/iomgr/workqueue_posix.c)6
-rw-r--r--src/core/lib/iomgr/workqueue_posix.h (renamed from src/core/iomgr/workqueue_posix.h)8
-rw-r--r--src/core/lib/iomgr/workqueue_windows.c (renamed from src/core/iomgr/workqueue_windows.c)4
-rw-r--r--src/core/lib/iomgr/workqueue_windows.h (renamed from src/core/iomgr/workqueue_windows.h)6
-rw-r--r--src/core/lib/json/json.c (renamed from src/core/json/json.c)4
-rw-r--r--src/core/lib/json/json.h (renamed from src/core/json/json.h)8
-rw-r--r--src/core/lib/json/json_common.h (renamed from src/core/json/json_common.h)6
-rw-r--r--src/core/lib/json/json_reader.c (renamed from src/core/json/json_reader.c)4
-rw-r--r--src/core/lib/json/json_reader.h (renamed from src/core/json/json_reader.h)8
-rw-r--r--src/core/lib/json/json_string.c (renamed from src/core/json/json_string.c)10
-rw-r--r--src/core/lib/json/json_writer.c (renamed from src/core/json/json_writer.c)4
-rw-r--r--src/core/lib/json/json_writer.h (renamed from src/core/json/json_writer.h)8
-rw-r--r--src/core/lib/profiling/basic_timers.c (renamed from src/core/profiling/basic_timers.c)6
-rw-r--r--src/core/lib/profiling/stap_probes.d (renamed from src/core/profiling/stap_probes.d)0
-rw-r--r--src/core/lib/profiling/stap_timers.c (renamed from src/core/profiling/stap_timers.c)6
-rw-r--r--src/core/lib/profiling/timers.h (renamed from src/core/profiling/timers.h)8
-rw-r--r--src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c (renamed from src/core/proto/grpc/lb/v0/load_balancer.pb.c)2
-rw-r--r--src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h (renamed from src/core/proto/grpc/lb/v0/load_balancer.pb.h)0
-rw-r--r--src/core/lib/security/auth_filters.h (renamed from src/core/security/auth_filters.h)8
-rw-r--r--src/core/lib/security/b64.c (renamed from src/core/security/b64.c)2
-rw-r--r--src/core/lib/security/b64.h (renamed from src/core/security/b64.h)6
-rw-r--r--src/core/lib/security/client_auth_filter.c (renamed from src/core/security/client_auth_filter.c)22
-rw-r--r--src/core/lib/security/credentials.c (renamed from src/core/security/credentials.c)39
-rw-r--r--src/core/lib/security/credentials.h (renamed from src/core/security/credentials.h)19
-rw-r--r--src/core/lib/security/credentials_metadata.c (renamed from src/core/security/credentials_metadata.c)4
-rw-r--r--src/core/lib/security/credentials_posix.c (renamed from src/core/security/credentials_posix.c)8
-rw-r--r--src/core/lib/security/credentials_win32.c (renamed from src/core/security/credentials_win32.c)8
-rw-r--r--src/core/lib/security/google_default_credentials.c (renamed from src/core/security/google_default_credentials.c)17
-rw-r--r--src/core/lib/security/handshake.c (renamed from src/core/security/handshake.c)6
-rw-r--r--src/core/lib/security/handshake.h (renamed from src/core/security/handshake.h)10
-rw-r--r--src/core/lib/security/json_token.c (renamed from src/core/security/json_token.c)6
-rw-r--r--src/core/lib/security/json_token.h (renamed from src/core/security/json_token.h)8
-rw-r--r--src/core/lib/security/jwt_verifier.c (renamed from src/core/security/jwt_verifier.c)26
-rw-r--r--src/core/lib/security/jwt_verifier.h (renamed from src/core/security/jwt_verifier.h)10
-rw-r--r--src/core/lib/security/secure_endpoint.c (renamed from src/core/security/secure_endpoint.c)15
-rw-r--r--src/core/lib/security/secure_endpoint.h (renamed from src/core/security/secure_endpoint.h)8
-rw-r--r--src/core/lib/security/security_connector.c (renamed from src/core/security/security_connector.c)22
-rw-r--r--src/core/lib/security/security_connector.h (renamed from src/core/security/security_connector.h)12
-rw-r--r--src/core/lib/security/security_context.c (renamed from src/core/security/security_context.c)8
-rw-r--r--src/core/lib/security/security_context.h (renamed from src/core/security/security_context.h)10
-rw-r--r--src/core/lib/security/server_auth_filter.c (renamed from src/core/security/server_auth_filter.c)12
-rw-r--r--src/core/lib/security/server_secure_chttp2.c (renamed from src/core/security/server_secure_chttp2.c)24
-rw-r--r--src/core/lib/statistics/census_init.c (renamed from src/core/statistics/census_init.c)6
-rw-r--r--src/core/lib/statistics/census_interface.h (renamed from src/core/statistics/census_interface.h)6
-rw-r--r--src/core/lib/statistics/census_log.c (renamed from src/core/statistics/census_log.c)6
-rw-r--r--src/core/lib/statistics/census_log.h (renamed from src/core/statistics/census_log.h)6
-rw-r--r--src/core/lib/statistics/census_rpc_stats.c (renamed from src/core/statistics/census_rpc_stats.c)20
-rw-r--r--src/core/lib/statistics/census_rpc_stats.h (renamed from src/core/statistics/census_rpc_stats.h)8
-rw-r--r--src/core/lib/statistics/census_tracing.c (renamed from src/core/statistics/census_tracing.c)17
-rw-r--r--src/core/lib/statistics/census_tracing.h (renamed from src/core/statistics/census_tracing.h)8
-rw-r--r--src/core/lib/statistics/hash_table.c (renamed from src/core/statistics/hash_table.c)8
-rw-r--r--src/core/lib/statistics/hash_table.h (renamed from src/core/statistics/hash_table.h)6
-rw-r--r--src/core/lib/statistics/window_stats.c (renamed from src/core/statistics/window_stats.c)10
-rw-r--r--src/core/lib/statistics/window_stats.h (renamed from src/core/statistics/window_stats.h)6
-rw-r--r--src/core/lib/support/alloc.c (renamed from src/core/support/alloc.c)4
-rw-r--r--src/core/lib/support/avl.c (renamed from src/core/support/avl.c)0
-rw-r--r--src/core/lib/support/backoff.c (renamed from src/core/support/backoff.c)7
-rw-r--r--src/core/lib/support/backoff.h (renamed from src/core/support/backoff.h)9
-rw-r--r--src/core/lib/support/block_annotate.h (renamed from src/core/support/block_annotate.h)6
-rw-r--r--src/core/lib/support/cmdline.c (renamed from src/core/support/cmdline.c)4
-rw-r--r--src/core/lib/support/cpu_iphone.c (renamed from src/core/support/cpu_iphone.c)2
-rw-r--r--src/core/lib/support/cpu_linux.c (renamed from src/core/support/cpu_linux.c)6
-rw-r--r--src/core/lib/support/cpu_posix.c (renamed from src/core/support/cpu_posix.c)2
-rw-r--r--src/core/lib/support/cpu_windows.c (renamed from src/core/support/cpu_windows.c)2
-rw-r--r--src/core/lib/support/env.h (renamed from src/core/support/env.h)6
-rw-r--r--src/core/lib/support/env_linux.c (renamed from src/core/support/env_linux.c)4
-rw-r--r--src/core/lib/support/env_posix.c (renamed from src/core/support/env_posix.c)6
-rw-r--r--src/core/lib/support/env_win32.c (renamed from src/core/support/env_win32.c)4
-rw-r--r--src/core/lib/support/histogram.c (renamed from src/core/support/histogram.c)4
-rw-r--r--src/core/lib/support/host_port.c (renamed from src/core/support/host_port.c)4
-rw-r--r--src/core/lib/support/load_file.c (renamed from src/core/support/load_file.c)6
-rw-r--r--src/core/lib/support/load_file.h (renamed from src/core/support/load_file.h)6
-rw-r--r--src/core/lib/support/log.c (renamed from src/core/support/log.c)2
-rw-r--r--src/core/lib/support/log_android.c (renamed from src/core/support/log_android.c)6
-rw-r--r--src/core/lib/support/log_linux.c (renamed from src/core/support/log_linux.c)8
-rw-r--r--src/core/lib/support/log_posix.c (renamed from src/core/support/log_posix.c)8
-rw-r--r--src/core/lib/support/log_win32.c (renamed from src/core/support/log_win32.c)10
-rw-r--r--src/core/lib/support/murmur_hash.c (renamed from src/core/support/murmur_hash.c)4
-rw-r--r--src/core/lib/support/murmur_hash.h (renamed from src/core/support/murmur_hash.h)6
-rw-r--r--src/core/lib/support/slice.c (renamed from src/core/support/slice.c)2
-rw-r--r--src/core/lib/support/slice_buffer.c (renamed from src/core/support/slice_buffer.c)2
-rw-r--r--src/core/lib/support/stack_lockfree.c (renamed from src/core/support/stack_lockfree.c)12
-rw-r--r--src/core/lib/support/stack_lockfree.h (renamed from src/core/support/stack_lockfree.h)6
-rw-r--r--src/core/lib/support/string.c (renamed from src/core/support/string.c)4
-rw-r--r--src/core/lib/support/string.h (renamed from src/core/support/string.h)8
-rw-r--r--src/core/lib/support/string_posix.c (renamed from src/core/support/string_posix.c)4
-rw-r--r--src/core/lib/support/string_win32.c (renamed from src/core/support/string_win32.c)4
-rw-r--r--src/core/lib/support/string_win32.h (renamed from src/core/support/string_win32.h)6
-rw-r--r--src/core/lib/support/subprocess_posix.c (renamed from src/core/support/subprocess_posix.c)8
-rw-r--r--src/core/lib/support/subprocess_windows.c (renamed from src/core/support/subprocess_windows.c)6
-rw-r--r--src/core/lib/support/sync.c (renamed from src/core/support/sync.c)2
-rw-r--r--src/core/lib/support/sync_posix.c (renamed from src/core/support/sync_posix.c)4
-rw-r--r--src/core/lib/support/sync_win32.c (renamed from src/core/support/sync_win32.c)0
-rw-r--r--src/core/lib/support/thd.c (renamed from src/core/support/thd.c)2
-rw-r--r--src/core/lib/support/thd_internal.h (renamed from src/core/support/thd_internal.h)6
-rw-r--r--src/core/lib/support/thd_posix.c (renamed from src/core/support/thd_posix.c)8
-rw-r--r--src/core/lib/support/thd_win32.c (renamed from src/core/support/thd_win32.c)4
-rw-r--r--src/core/lib/support/time.c (renamed from src/core/support/time.c)2
-rw-r--r--src/core/lib/support/time_posix.c (renamed from src/core/support/time_posix.c)6
-rw-r--r--src/core/lib/support/time_precise.c (renamed from src/core/support/time_precise.c)2
-rw-r--r--src/core/lib/support/time_precise.h (renamed from src/core/support/time_precise.h)6
-rw-r--r--src/core/lib/support/time_win32.c (renamed from src/core/support/time_win32.c)8
-rw-r--r--src/core/lib/support/tls_pthread.c (renamed from src/core/support/tls_pthread.c)2
-rw-r--r--src/core/lib/support/tmpfile.h (renamed from src/core/support/tmpfile.h)6
-rw-r--r--src/core/lib/support/tmpfile_posix.c (renamed from src/core/support/tmpfile_posix.c)4
-rw-r--r--src/core/lib/support/tmpfile_win32.c (renamed from src/core/support/tmpfile_win32.c)4
-rw-r--r--src/core/lib/support/wrap_memcpy.c (renamed from src/core/support/wrap_memcpy.c)0
-rw-r--r--src/core/lib/surface/alarm.c (renamed from src/core/surface/alarm.c)4
-rw-r--r--src/core/lib/surface/api_trace.c (renamed from src/core/surface/api_trace.c)4
-rw-r--r--src/core/lib/surface/api_trace.h (renamed from src/core/surface/api_trace.h)8
-rw-r--r--src/core/lib/surface/byte_buffer.c (renamed from src/core/surface/byte_buffer.c)2
-rw-r--r--src/core/lib/surface/byte_buffer_reader.c (renamed from src/core/surface/byte_buffer_reader.c)8
-rw-r--r--src/core/lib/surface/call.c (renamed from src/core/surface/call.c)20
-rw-r--r--src/core/lib/surface/call.h (renamed from src/core/surface/call.h)14
-rw-r--r--src/core/lib/surface/call_details.c (renamed from src/core/surface/call_details.c)4
-rw-r--r--src/core/lib/surface/call_log_batch.c (renamed from src/core/surface/call_log_batch.c)6
-rw-r--r--src/core/lib/surface/call_test_only.h (renamed from src/core/surface/call_test_only.h)6
-rw-r--r--src/core/lib/surface/channel.c (renamed from src/core/surface/channel.c)18
-rw-r--r--src/core/lib/surface/channel.h (renamed from src/core/surface/channel.h)12
-rw-r--r--src/core/lib/surface/channel_connectivity.c (renamed from src/core/surface/channel_connectivity.c)27
-rw-r--r--src/core/lib/surface/channel_create.c (renamed from src/core/surface/channel_create.c)20
-rw-r--r--src/core/lib/surface/channel_init.c (renamed from src/core/surface/channel_init.c)4
-rw-r--r--src/core/lib/surface/channel_init.h (renamed from src/core/surface/channel_init.h)12
-rw-r--r--src/core/lib/surface/channel_ping.c (renamed from src/core/surface/channel_ping.c)6
-rw-r--r--src/core/lib/surface/channel_stack_type.c (renamed from src/core/surface/channel_stack_type.c)6
-rw-r--r--src/core/lib/surface/channel_stack_type.h (renamed from src/core/surface/channel_stack_type.h)9
-rw-r--r--src/core/lib/surface/completion_queue.c (renamed from src/core/surface/completion_queue.c)18
-rw-r--r--src/core/lib/surface/completion_queue.h (renamed from src/core/surface/completion_queue.h)8
-rw-r--r--src/core/lib/surface/event_string.c (renamed from src/core/surface/event_string.c)6
-rw-r--r--src/core/lib/surface/event_string.h (renamed from src/core/surface/event_string.h)6
-rw-r--r--src/core/lib/surface/init.c (renamed from src/core/surface/init.c)75
-rw-r--r--src/core/lib/surface/init.h (renamed from src/core/surface/init.h)6
-rw-r--r--src/core/lib/surface/init_secure.c (renamed from src/core/surface/init_secure.c)16
-rw-r--r--src/core/lib/surface/init_unsecure.c (renamed from src/core/surface/init_unsecure.c)2
-rw-r--r--src/core/lib/surface/lame_client.c (renamed from src/core/surface/lame_client.c)27
-rw-r--r--src/core/lib/surface/lame_client.h (renamed from src/core/surface/lame_client.h)8
-rw-r--r--src/core/lib/surface/metadata_array.c (renamed from src/core/surface/metadata_array.c)4
-rw-r--r--src/core/lib/surface/secure_channel_create.c (renamed from src/core/surface/secure_channel_create.c)22
-rw-r--r--src/core/lib/surface/server.c (renamed from src/core/surface/server.c)46
-rw-r--r--src/core/lib/surface/server.h (renamed from src/core/surface/server.h)10
-rw-r--r--src/core/lib/surface/server_chttp2.c (renamed from src/core/surface/server_chttp2.c)12
-rw-r--r--src/core/lib/surface/surface_trace.h (renamed from src/core/surface/surface_trace.h)10
-rw-r--r--src/core/lib/surface/validate_metadata.c (renamed from src/core/surface/validate_metadata.c)0
-rw-r--r--src/core/lib/surface/version.c (renamed from src/core/surface/version.c)0
-rw-r--r--src/core/lib/transport/byte_stream.c (renamed from src/core/transport/byte_stream.c)4
-rw-r--r--src/core/lib/transport/byte_stream.h (renamed from src/core/transport/byte_stream.h)8
-rw-r--r--src/core/lib/transport/chttp2/alpn.c (renamed from src/core/transport/chttp2/alpn.c)4
-rw-r--r--src/core/lib/transport/chttp2/alpn.h (renamed from src/core/transport/chttp2/alpn.h)6
-rw-r--r--src/core/lib/transport/chttp2/bin_encoder.c (renamed from src/core/transport/chttp2/bin_encoder.c)80
-rw-r--r--src/core/lib/transport/chttp2/bin_encoder.h (renamed from src/core/transport/chttp2/bin_encoder.h)6
-rw-r--r--src/core/lib/transport/chttp2/frame.h (renamed from src/core/transport/chttp2/frame.h)6
-rw-r--r--src/core/lib/transport/chttp2/frame_data.c (renamed from src/core/transport/chttp2/frame_data.c)10
-rw-r--r--src/core/lib/transport/chttp2/frame_data.h (renamed from src/core/transport/chttp2/frame_data.h)12
-rw-r--r--src/core/lib/transport/chttp2/frame_goaway.c (renamed from src/core/transport/chttp2/frame_goaway.c)6
-rw-r--r--src/core/lib/transport/chttp2/frame_goaway.h (renamed from src/core/transport/chttp2/frame_goaway.h)10
-rw-r--r--src/core/lib/transport/chttp2/frame_ping.c (renamed from src/core/transport/chttp2/frame_ping.c)6
-rw-r--r--src/core/lib/transport/chttp2/frame_ping.h (renamed from src/core/transport/chttp2/frame_ping.h)10
-rw-r--r--src/core/lib/transport/chttp2/frame_rst_stream.c (renamed from src/core/transport/chttp2/frame_rst_stream.c)8
-rw-r--r--src/core/lib/transport/chttp2/frame_rst_stream.h (renamed from src/core/transport/chttp2/frame_rst_stream.h)10
-rw-r--r--src/core/lib/transport/chttp2/frame_settings.c (renamed from src/core/transport/chttp2/frame_settings.c)14
-rw-r--r--src/core/lib/transport/chttp2/frame_settings.h (renamed from src/core/transport/chttp2/frame_settings.h)10
-rw-r--r--src/core/lib/transport/chttp2/frame_window_update.c (renamed from src/core/transport/chttp2/frame_window_update.c)6
-rw-r--r--src/core/lib/transport/chttp2/frame_window_update.h (renamed from src/core/transport/chttp2/frame_window_update.h)10
-rw-r--r--src/core/lib/transport/chttp2/hpack_encoder.c (renamed from src/core/transport/chttp2/hpack_encoder.c)12
-rw-r--r--src/core/lib/transport/chttp2/hpack_encoder.h (renamed from src/core/transport/chttp2/hpack_encoder.h)12
-rw-r--r--src/core/lib/transport/chttp2/hpack_parser.c (renamed from src/core/transport/chttp2/hpack_parser.c)12
-rw-r--r--src/core/lib/transport/chttp2/hpack_parser.h (renamed from src/core/transport/chttp2/hpack_parser.h)14
-rw-r--r--src/core/lib/transport/chttp2/hpack_table.c (renamed from src/core/transport/chttp2/hpack_table.c)6
-rw-r--r--src/core/lib/transport/chttp2/hpack_table.h (renamed from src/core/transport/chttp2/hpack_table.h)8
-rw-r--r--src/core/lib/transport/chttp2/hpack_tables.txt (renamed from src/core/transport/chttp2/hpack_tables.txt)0
-rw-r--r--src/core/lib/transport/chttp2/http2_errors.h (renamed from src/core/transport/chttp2/http2_errors.h)6
-rw-r--r--src/core/lib/transport/chttp2/huffsyms.c105
-rw-r--r--src/core/lib/transport/chttp2/huffsyms.h (renamed from src/core/transport/chttp2/huffsyms.h)6
-rw-r--r--src/core/lib/transport/chttp2/incoming_metadata.c (renamed from src/core/transport/chttp2/incoming_metadata.c)6
-rw-r--r--src/core/lib/transport/chttp2/incoming_metadata.h (renamed from src/core/transport/chttp2/incoming_metadata.h)8
-rw-r--r--src/core/lib/transport/chttp2/internal.h (renamed from src/core/transport/chttp2/internal.h)34
-rw-r--r--src/core/lib/transport/chttp2/parsing.c (renamed from src/core/transport/chttp2/parsing.c)12
-rw-r--r--src/core/lib/transport/chttp2/status_conversion.c (renamed from src/core/transport/chttp2/status_conversion.c)4
-rw-r--r--src/core/lib/transport/chttp2/status_conversion.h (renamed from src/core/transport/chttp2/status_conversion.h)8
-rw-r--r--src/core/lib/transport/chttp2/stream_lists.c (renamed from src/core/transport/chttp2/stream_lists.c)2
-rw-r--r--src/core/lib/transport/chttp2/stream_map.c (renamed from src/core/transport/chttp2/stream_map.c)4
-rw-r--r--src/core/lib/transport/chttp2/stream_map.h (renamed from src/core/transport/chttp2/stream_map.h)6
-rw-r--r--src/core/lib/transport/chttp2/timeout_encoding.c (renamed from src/core/transport/chttp2/timeout_encoding.c)6
-rw-r--r--src/core/lib/transport/chttp2/timeout_encoding.h (renamed from src/core/transport/chttp2/timeout_encoding.h)8
-rw-r--r--src/core/lib/transport/chttp2/varint.c (renamed from src/core/transport/chttp2/varint.c)4
-rw-r--r--src/core/lib/transport/chttp2/varint.h (renamed from src/core/transport/chttp2/varint.h)6
-rw-r--r--src/core/lib/transport/chttp2/writing.c (renamed from src/core/transport/chttp2/writing.c)6
-rw-r--r--src/core/lib/transport/chttp2_transport.c (renamed from src/core/transport/chttp2_transport.c)42
-rw-r--r--src/core/lib/transport/chttp2_transport.h (renamed from src/core/transport/chttp2_transport.h)10
-rw-r--r--src/core/lib/transport/connectivity_state.c (renamed from src/core/transport/connectivity_state.c)2
-rw-r--r--src/core/lib/transport/connectivity_state.h (renamed from src/core/transport/connectivity_state.h)8
-rw-r--r--src/core/lib/transport/metadata.c (renamed from src/core/transport/metadata.c)14
-rw-r--r--src/core/lib/transport/metadata.h (renamed from src/core/transport/metadata.h)6
-rw-r--r--src/core/lib/transport/metadata_batch.c (renamed from src/core/transport/metadata_batch.c)6
-rw-r--r--src/core/lib/transport/metadata_batch.h (renamed from src/core/transport/metadata_batch.h)8
-rw-r--r--src/core/lib/transport/static_metadata.c (renamed from src/core/transport/static_metadata.c)118
-rw-r--r--src/core/lib/transport/static_metadata.h (renamed from src/core/transport/static_metadata.h)14
-rw-r--r--src/core/lib/transport/transport.c (renamed from src/core/transport/transport.c)4
-rw-r--r--src/core/lib/transport/transport.h (renamed from src/core/transport/transport.h)16
-rw-r--r--src/core/lib/transport/transport_impl.h (renamed from src/core/transport/transport_impl.h)8
-rw-r--r--src/core/lib/transport/transport_op_string.c (renamed from src/core/transport/transport_op_string.c)6
-rw-r--r--src/core/lib/tsi/fake_transport_security.c (renamed from src/core/tsi/fake_transport_security.c)12
-rw-r--r--src/core/lib/tsi/fake_transport_security.h (renamed from src/core/tsi/fake_transport_security.h)8
-rw-r--r--src/core/lib/tsi/ssl_transport_security.c (renamed from src/core/tsi/ssl_transport_security.c)12
-rw-r--r--src/core/lib/tsi/ssl_transport_security.h (renamed from src/core/tsi/ssl_transport_security.h)8
-rw-r--r--src/core/lib/tsi/ssl_types.h (renamed from src/core/tsi/ssl_types.h)6
-rw-r--r--src/core/lib/tsi/test_creds/README (renamed from src/core/tsi/test_creds/README)0
-rw-r--r--src/core/lib/tsi/test_creds/badclient.key (renamed from src/core/tsi/test_creds/badclient.key)0
-rw-r--r--src/core/lib/tsi/test_creds/badclient.pem (renamed from src/core/tsi/test_creds/badclient.pem)0
-rw-r--r--src/core/lib/tsi/test_creds/badserver.key (renamed from src/core/tsi/test_creds/badserver.key)0
-rw-r--r--src/core/lib/tsi/test_creds/badserver.pem (renamed from src/core/tsi/test_creds/badserver.pem)0
-rw-r--r--src/core/lib/tsi/test_creds/ca-openssl.cnf (renamed from src/core/tsi/test_creds/ca-openssl.cnf)0
-rw-r--r--src/core/lib/tsi/test_creds/ca.key (renamed from src/core/tsi/test_creds/ca.key)0
-rw-r--r--src/core/lib/tsi/test_creds/ca.pem (renamed from src/core/tsi/test_creds/ca.pem)0
-rw-r--r--src/core/lib/tsi/test_creds/client.key (renamed from src/core/tsi/test_creds/client.key)0
-rw-r--r--src/core/lib/tsi/test_creds/client.pem (renamed from src/core/tsi/test_creds/client.pem)0
-rw-r--r--src/core/lib/tsi/test_creds/server0.key (renamed from src/core/tsi/test_creds/server0.key)0
-rw-r--r--src/core/lib/tsi/test_creds/server0.pem (renamed from src/core/tsi/test_creds/server0.pem)0
-rw-r--r--src/core/lib/tsi/test_creds/server1-openssl.cnf (renamed from src/core/tsi/test_creds/server1-openssl.cnf)0
-rw-r--r--src/core/lib/tsi/test_creds/server1.key (renamed from src/core/tsi/test_creds/server1.key)0
-rw-r--r--src/core/lib/tsi/test_creds/server1.pem (renamed from src/core/tsi/test_creds/server1.pem)0
-rw-r--r--src/core/lib/tsi/transport_security.c (renamed from src/core/tsi/transport_security.c)4
-rw-r--r--src/core/lib/tsi/transport_security.h (renamed from src/core/tsi/transport_security.h)8
-rw-r--r--src/core/lib/tsi/transport_security_interface.h (renamed from src/core/tsi/transport_security_interface.h)6
-rw-r--r--src/core/transport/chttp2/huffsyms.c297
-rw-r--r--src/cpp/client/channel.cc2
-rw-r--r--src/cpp/client/client_context.cc8
-rw-r--r--src/cpp/client/insecure_credentials.cc6
-rw-r--r--src/cpp/client/secure_credentials.cc2
-rw-r--r--src/cpp/client/secure_credentials.h2
-rw-r--r--src/cpp/common/channel_arguments.cc2
-rw-r--r--src/cpp/common/core_codegen.cc2
-rw-r--r--src/cpp/common/core_codegen.h2
-rw-r--r--src/cpp/common/create_auth_context.h4
-rw-r--r--src/cpp/common/insecure_create_auth_context.cc4
-rw-r--r--src/cpp/common/secure_channel_arguments.cc4
-rw-r--r--src/cpp/common/secure_create_auth_context.cc4
-rw-r--r--src/cpp/server/server.cc2
-rw-r--r--src/cpp/server/server_builder.cc4
-rw-r--r--src/cpp/server/server_context.cc4
-rw-r--r--src/cpp/util/time.cc4
-rw-r--r--src/csharp/ext/grpc_csharp_ext.c2
-rw-r--r--src/node/README.md18
-rw-r--r--src/node/ext/call_credentials.cc81
-rw-r--r--src/node/ext/call_credentials.h18
-rw-r--r--src/node/performance/benchmark_client.js60
-rw-r--r--src/node/performance/benchmark_server.js34
-rw-r--r--src/node/performance/generic_service.js46
-rw-r--r--src/node/performance/worker_service_impl.js25
-rw-r--r--src/node/src/credentials.js2
-rw-r--r--src/node/src/server.js6
-rw-r--r--src/node/test/surface_test.js8
-rw-r--r--src/objective-c/GRPCClient/GRPCCall.m48
-rw-r--r--src/objective-c/GRPCClient/private/GRPCCompletionQueue.h7
-rw-r--r--src/objective-c/GRPCClient/private/GRPCCompletionQueue.m24
-rw-r--r--src/objective-c/GRPCClient/private/GRPCWrappedCall.m6
-rw-r--r--src/proto/grpc/testing/metrics.proto21
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi4
-rw-r--r--src/python/grpcio/grpc/_links/service.py4
-rw-r--r--src/python/grpcio/grpc/beta/_server.py4
-rw-r--r--src/python/grpcio/grpc/framework/alpha/_face_utilities.py4
-rw-r--r--src/python/grpcio/grpc/framework/alpha/_reexport.py6
-rw-r--r--src/python/grpcio/grpc/framework/crust/implementations.py6
-rw-r--r--src/python/grpcio/grpc/framework/face/implementations.py6
-rw-r--r--src/python/grpcio/grpc_core_dependencies.py409
-rw-r--r--src/python/grpcio/tests/__init__.py4
-rw-r--r--src/python/grpcio/tests/_loader.py4
-rw-r--r--src/python/grpcio/tests/_result.py10
-rw-r--r--src/python/grpcio/tests/_runner.py16
-rw-r--r--src/python/grpcio/tests/interop/methods.py4
-rw-r--r--src/python/grpcio/tests/protoc_plugin/beta_python_plugin_test.py54
-rw-r--r--src/python/grpcio/tests/unit/_adapter/_intermediary_low_test.py16
-rw-r--r--src/python/grpcio/tests/unit/_core_over_links_base_interface_test.py6
-rw-r--r--src/python/grpcio/tests/unit/_crust_over_core_over_links_face_interface_test.py8
-rw-r--r--src/python/grpcio/tests/unit/beta/_face_interface_test.py8
-rw-r--r--src/python/grpcio/tests/unit/framework/_crust_over_core_face_interface_test.py6
-rw-r--r--src/python/grpcio/tests/unit/framework/face/testing/blocking_invocation_inline_service_test_case.py26
-rw-r--r--src/python/grpcio/tests/unit/framework/face/testing/digest.py6
-rw-r--r--src/python/grpcio/tests/unit/framework/face/testing/event_invocation_synchronous_event_service_test_case.py36
-rw-r--r--src/python/grpcio/tests/unit/framework/face/testing/future_invocation_asynchronous_event_service_test_case.py36
-rw-r--r--src/python/grpcio/tests/unit/framework/interfaces/base/_control.py12
-rw-r--r--src/python/grpcio/tests/unit/framework/interfaces/face/_blocking_invocation_inline_service.py34
-rw-r--r--src/python/grpcio/tests/unit/framework/interfaces/face/_digest.py6
-rw-r--r--src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py44
-rw-r--r--src/python/grpcio/tests/unit/test_common.py6
-rw-r--r--src/ruby/ext/grpc/rb_call.c6
-rw-r--r--src/ruby/ext/grpc/rb_call_credentials.c38
-rw-r--r--src/ruby/ext/grpc/rb_channel.c22
-rw-r--r--src/ruby/ext/grpc/rb_channel_credentials.c23
457 files changed, 3368 insertions, 3205 deletions
diff --git a/src/compiler/cpp_generator.cc b/src/compiler/cpp_generator.cc
index 97295bed45..206a6e1fe5 100644
--- a/src/compiler/cpp_generator.cc
+++ b/src/compiler/cpp_generator.cc
@@ -83,6 +83,28 @@ grpc::string FilenameIdentifier(const grpc::string &filename) {
}
} // namespace
+template<class T, size_t N>
+T *array_end(T (&array)[N]) { return array + N; }
+
+void PrintIncludes(grpc::protobuf::io::Printer *printer, const std::vector<grpc::string>& headers, const Parameters &params) {
+ std::map<grpc::string, grpc::string> vars;
+
+ vars["l"] = params.use_system_headers ? '<' : '"';
+ vars["r"] = params.use_system_headers ? '>' : '"';
+
+ if (!params.grpc_search_path.empty()) {
+ vars["l"] += params.grpc_search_path;
+ if (params.grpc_search_path.back() != '/') {
+ vars["l"] += '/';
+ }
+ }
+
+ for (auto i = headers.begin(); i != headers.end(); i++) {
+ vars["h"] = *i;
+ printer->Print(vars, "#include $l$$h$$r$\n");
+ }
+}
+
grpc::string GetHeaderPrologue(const grpc::protobuf::FileDescriptor *file,
const Parameters &params) {
grpc::string output;
@@ -111,36 +133,46 @@ grpc::string GetHeaderPrologue(const grpc::protobuf::FileDescriptor *file,
grpc::string GetHeaderIncludes(const grpc::protobuf::FileDescriptor *file,
const Parameters &params) {
- grpc::string temp =
- "#include <grpc++/impl/codegen/async_stream.h>\n"
- "#include <grpc++/impl/codegen/async_unary_call.h>\n"
- "#include <grpc++/impl/codegen/proto_utils.h>\n"
- "#include <grpc++/impl/codegen/rpc_method.h>\n"
- "#include <grpc++/impl/codegen/service_type.h>\n"
- "#include <grpc++/impl/codegen/status.h>\n"
- "#include <grpc++/impl/codegen/stub_options.h>\n"
- "#include <grpc++/impl/codegen/sync_stream.h>\n"
- "\n"
- "namespace grpc {\n"
- "class CompletionQueue;\n"
- "class RpcService;\n"
- "class ServerCompletionQueue;\n"
- "class ServerContext;\n"
- "} // namespace grpc\n\n";
+ grpc::string output;
+ {
+ // Scope the output stream so it closes and finalizes output to the string.
+ grpc::protobuf::io::StringOutputStream output_stream(&output);
+ grpc::protobuf::io::Printer printer(&output_stream, '$');
+ std::map<grpc::string, grpc::string> vars;
- if (!file->package().empty()) {
- std::vector<grpc::string> parts =
- grpc_generator::tokenize(file->package(), ".");
+ static const char *headers_strs[] = {
+ "grpc++/impl/codegen/async_stream.h",
+ "grpc++/impl/codegen/async_unary_call.h",
+ "grpc++/impl/codegen/proto_utils.h",
+ "grpc++/impl/codegen/rpc_method.h",
+ "grpc++/impl/codegen/service_type.h",
+ "grpc++/impl/codegen/status.h",
+ "grpc++/impl/codegen/stub_options.h",
+ "grpc++/impl/codegen/sync_stream.h"
+ };
+ std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
+ PrintIncludes(&printer, headers, params);
+ printer.Print(vars, "\n");
+ printer.Print(vars, "namespace grpc {\n");
+ printer.Print(vars, "class CompletionQueue;\n");
+ printer.Print(vars, "class Channel;\n");
+ printer.Print(vars, "class RpcService;\n");
+ printer.Print(vars, "class ServerCompletionQueue;\n");
+ printer.Print(vars, "class ServerContext;\n");
+ printer.Print(vars, "} // namespace grpc\n\n");
- for (auto part = parts.begin(); part != parts.end(); part++) {
- temp.append("namespace ");
- temp.append(*part);
- temp.append(" {\n");
+ if (!file->package().empty()) {
+ std::vector<grpc::string> parts =
+ grpc_generator::tokenize(file->package(), ".");
+
+ for (auto part = parts.begin(); part != parts.end(); part++) {
+ vars["part"] = *part;
+ printer.Print(vars, "namespace $part$ {\n");
+ }
+ printer.Print(vars, "\n");
}
- temp.append("\n");
}
-
- return temp;
+ return output;
}
void PrintHeaderClientMethodInterfaces(
@@ -852,7 +884,7 @@ grpc::string GetSourcePrologue(const grpc::protobuf::FileDescriptor *file,
}
grpc::string GetSourceIncludes(const grpc::protobuf::FileDescriptor *file,
- const Parameters &param) {
+ const Parameters &params) {
grpc::string output;
{
// Scope the output stream so it closes and finalizes output to the string.
@@ -860,16 +892,18 @@ grpc::string GetSourceIncludes(const grpc::protobuf::FileDescriptor *file,
grpc::protobuf::io::Printer printer(&output_stream, '$');
std::map<grpc::string, grpc::string> vars;
- printer.Print(vars, "#include <grpc++/impl/codegen/async_stream.h>\n");
- printer.Print(vars, "#include <grpc++/impl/codegen/async_unary_call.h>\n");
- printer.Print(vars, "#include <grpc++/impl/codegen/channel_interface.h>\n");
- printer.Print(vars, "#include <grpc++/impl/codegen/client_unary_call.h>\n");
- printer.Print(vars,
- "#include <grpc++/impl/codegen/method_handler_impl.h>\n");
- printer.Print(vars,
- "#include <grpc++/impl/codegen/rpc_service_method.h>\n");
- printer.Print(vars, "#include <grpc++/impl/codegen/service_type.h>\n");
- printer.Print(vars, "#include <grpc++/impl/codegen/sync_stream.h>\n");
+ static const char *headers_strs[] = {
+ "grpc++/impl/codegen/async_stream.h",
+ "grpc++/impl/codegen/async_unary_call.h",
+ "grpc++/impl/codegen/channel_interface.h",
+ "grpc++/impl/codegen/client_unary_call.h",
+ "grpc++/impl/codegen/method_handler_impl.h",
+ "grpc++/impl/codegen/rpc_service_method.h",
+ "grpc++/impl/codegen/service_type.h",
+ "grpc++/impl/codegen/sync_stream.h"
+ };
+ std::vector<grpc::string> headers(headers_strs, array_end(headers_strs));
+ PrintIncludes(&printer, headers, params);
if (!file->package().empty()) {
std::vector<grpc::string> parts =
diff --git a/src/compiler/cpp_generator.h b/src/compiler/cpp_generator.h
index 70c2e985f6..4f9de9d11a 100644
--- a/src/compiler/cpp_generator.h
+++ b/src/compiler/cpp_generator.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,10 @@ namespace grpc_cpp_generator {
struct Parameters {
// Puts the service into a namespace
grpc::string services_namespace;
+ // Use system includes (<>) or local includes ("")
+ bool use_system_headers;
+ // Prefix to any grpc include
+ grpc::string grpc_search_path;
};
// Return the prologue of the generated header file.
diff --git a/src/compiler/cpp_plugin.cc b/src/compiler/cpp_plugin.cc
index 88c704948e..d8ada4835c 100644
--- a/src/compiler/cpp_plugin.cc
+++ b/src/compiler/cpp_plugin.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -59,6 +59,7 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
}
grpc_cpp_generator::Parameters generator_parameters;
+ generator_parameters.use_system_headers = true;
if (!parameter.empty()) {
std::vector<grpc::string> parameters_list =
@@ -70,6 +71,17 @@ class CppGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
grpc_generator::tokenize(*parameter_string, "=");
if (param[0] == "services_namespace") {
generator_parameters.services_namespace = param[1];
+ } else if (param[0] == "use_system_headers") {
+ if (param[1] == "true") {
+ generator_parameters.use_system_headers = true;
+ } else if (param[1] == "false") {
+ generator_parameters.use_system_headers = false;
+ } else {
+ *error = grpc::string("Invalid parameter: ") + *parameter_string;
+ return false;
+ }
+ } else if (param[0] == "grpc_search_path") {
+ generator_parameters.grpc_search_path = param[1];
} else {
*error = grpc::string("Unknown parameter: ") + *parameter_string;
return false;
diff --git a/src/compiler/python_generator.cc b/src/compiler/python_generator.cc
index 4fd5dfbecb..5a2ecce1d4 100644
--- a/src/compiler/python_generator.cc
+++ b/src/compiler/python_generator.cc
@@ -190,11 +190,10 @@ bool PrintBetaServicer(const ServiceDescriptor* service,
"Documentation", doc,
});
out->Print("\n");
- out->Print(dict, "class Beta$Service$Servicer(object):\n");
+ out->Print(dict, "class Beta$Service$Servicer(six.with_metaclass(abc.ABCMeta, object)):\n");
{
IndentScope raii_class_indent(out);
out->Print(dict, "\"\"\"$Documentation$\"\"\"\n");
- out->Print("__metaclass__ = abc.ABCMeta\n");
for (int i = 0; i < service->method_count(); ++i) {
auto meth = service->method(i);
grpc::string arg_name = meth->client_streaming() ?
@@ -219,11 +218,10 @@ bool PrintBetaStub(const ServiceDescriptor* service,
"Documentation", doc,
});
out->Print("\n");
- out->Print(dict, "class Beta$Service$Stub(object):\n");
+ out->Print(dict, "class Beta$Service$Stub(six.with_metaclass(abc.ABCMeta, object)):\n");
{
IndentScope raii_class_indent(out);
out->Print(dict, "\"\"\"$Documentation$\"\"\"\n");
- out->Print("__metaclass__ = abc.ABCMeta\n");
for (int i = 0; i < service->method_count(); ++i) {
const MethodDescriptor* meth = service->method(i);
grpc::string arg_name = meth->client_streaming() ?
@@ -449,6 +447,7 @@ bool PrintBetaStubFactory(const grpc::string& package_qualified_service_name,
bool PrintPreamble(const FileDescriptor* file,
const GeneratorConfiguration& config, Printer* out) {
out->Print("import abc\n");
+ out->Print("import six\n");
out->Print("from $Package$ import implementations as beta_implementations\n",
"Package", config.beta_package_root);
out->Print("from grpc.framework.common import cardinality\n");
diff --git a/src/core/channel/client_uchannel.c b/src/core/channel/client_uchannel.c
deleted file mode 100644
index f0d0787b9b..0000000000
--- a/src/core/channel/client_uchannel.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- *
- * Copyright 2015-2016, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include "src/core/channel/client_uchannel.h"
-
-#include <string.h>
-
-#include "src/core/census/grpc_filter.h"
-#include "src/core/channel/channel_args.h"
-#include "src/core/channel/client_channel.h"
-#include "src/core/channel/compress_filter.h"
-#include "src/core/channel/subchannel_call_holder.h"
-#include "src/core/iomgr/iomgr.h"
-#include "src/core/support/string.h"
-#include "src/core/surface/channel.h"
-#include "src/core/transport/connectivity_state.h"
-
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/sync.h>
-#include <grpc/support/useful.h>
-
-/** Microchannel (uchannel) implementation: a lightweight channel without any
- * load-balancing mechanisms meant for communication from within the core. */
-
-typedef struct client_uchannel_channel_data {
- /** master channel - the grpc_channel instance that ultimately owns
- this channel_data via its channel stack.
- We occasionally use this to bump the refcount on the master channel
- to keep ourselves alive through an asynchronous operation. */
- grpc_channel_stack *owning_stack;
-
- /** connectivity state being tracked */
- grpc_connectivity_state_tracker state_tracker;
-
- /** the subchannel wrapped by the microchannel */
- grpc_connected_subchannel *connected_subchannel;
-
- /** the callback used to stay subscribed to subchannel connectivity
- * notifications */
- grpc_closure connectivity_cb;
-
- /** the current connectivity state of the wrapped subchannel */
- grpc_connectivity_state subchannel_connectivity;
-
- gpr_mu mu_state;
-} channel_data;
-
-typedef grpc_subchannel_call_holder call_data;
-
-static void monitor_subchannel(grpc_exec_ctx *exec_ctx, void *arg,
- bool iomgr_success) {
- channel_data *chand = arg;
- grpc_connectivity_state_set(exec_ctx, &chand->state_tracker,
- chand->subchannel_connectivity,
- "uchannel_monitor_subchannel");
- grpc_connected_subchannel_notify_on_state_change(
- exec_ctx, chand->connected_subchannel, NULL,
- &chand->subchannel_connectivity, &chand->connectivity_cb);
-}
-
-static char *cuc_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) {
- return grpc_subchannel_call_holder_get_peer(exec_ctx, elem->call_data);
-}
-
-static void cuc_start_transport_stream_op(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem,
- grpc_transport_stream_op *op) {
- GRPC_CALL_LOG_OP(GPR_INFO, elem, op);
- grpc_subchannel_call_holder_perform_op(exec_ctx, elem->call_data, op);
-}
-
-static void cuc_start_transport_op(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem,
- grpc_transport_op *op) {
- channel_data *chand = elem->channel_data;
-
- grpc_exec_ctx_enqueue(exec_ctx, op->on_consumed, true, NULL);
-
- GPR_ASSERT(op->set_accept_stream == false);
- GPR_ASSERT(op->bind_pollset == NULL);
-
- if (op->on_connectivity_state_change != NULL) {
- grpc_connectivity_state_notify_on_state_change(
- exec_ctx, &chand->state_tracker, op->connectivity_state,
- op->on_connectivity_state_change);
- op->on_connectivity_state_change = NULL;
- op->connectivity_state = NULL;
- }
-
- if (op->disconnect) {
- grpc_connectivity_state_set(exec_ctx, &chand->state_tracker,
- GRPC_CHANNEL_FATAL_FAILURE, "disconnect");
- }
-}
-
-static int cuc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_metadata_batch *initial_metadata,
- uint32_t initial_metadata_flags,
- grpc_connected_subchannel **connected_subchannel,
- grpc_closure *on_ready) {
- channel_data *chand = arg;
- GPR_ASSERT(initial_metadata != NULL);
- *connected_subchannel = chand->connected_subchannel;
- return 1;
-}
-
-/* Constructor for call_data */
-static void cuc_init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
- grpc_call_element_args *args) {
- grpc_subchannel_call_holder_init(elem->call_data, cuc_pick_subchannel,
- elem->channel_data, args->call_stack);
-}
-
-/* Destructor for call_data */
-static void cuc_destroy_call_elem(grpc_exec_ctx *exec_ctx,
- grpc_call_element *elem) {
- grpc_subchannel_call_holder_destroy(exec_ctx, elem->call_data);
-}
-
-/* Constructor for channel_data */
-static void cuc_init_channel_elem(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem,
- grpc_channel_element_args *args) {
- channel_data *chand = elem->channel_data;
- memset(chand, 0, sizeof(*chand));
- grpc_closure_init(&chand->connectivity_cb, monitor_subchannel, chand);
- GPR_ASSERT(args->is_last);
- GPR_ASSERT(elem->filter == &grpc_client_uchannel_filter);
- chand->owning_stack = args->channel_stack;
- grpc_connectivity_state_init(&chand->state_tracker, GRPC_CHANNEL_IDLE,
- "client_uchannel");
- gpr_mu_init(&chand->mu_state);
-}
-
-/* Destructor for channel_data */
-static void cuc_destroy_channel_elem(grpc_exec_ctx *exec_ctx,
- grpc_channel_element *elem) {
- channel_data *chand = elem->channel_data;
- /* cancel subscription */
- grpc_connected_subchannel_notify_on_state_change(
- exec_ctx, chand->connected_subchannel, NULL, NULL,
- &chand->connectivity_cb);
- grpc_connectivity_state_destroy(exec_ctx, &chand->state_tracker);
- gpr_mu_destroy(&chand->mu_state);
- GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, chand->connected_subchannel,
- "uchannel");
-}
-
-static void cuc_set_pollset(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
- grpc_pollset *pollset) {
- call_data *calld = elem->call_data;
- calld->pollset = pollset;
-}
-
-const grpc_channel_filter grpc_client_uchannel_filter = {
- cuc_start_transport_stream_op, cuc_start_transport_op, sizeof(call_data),
- cuc_init_call_elem, cuc_set_pollset, cuc_destroy_call_elem,
- sizeof(channel_data), cuc_init_channel_elem, cuc_destroy_channel_elem,
- cuc_get_peer, "client-uchannel",
-};
-
-grpc_connectivity_state grpc_client_uchannel_check_connectivity_state(
- grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, int try_to_connect) {
- channel_data *chand = elem->channel_data;
- grpc_connectivity_state out;
- gpr_mu_lock(&chand->mu_state);
- out = grpc_connectivity_state_check(&chand->state_tracker);
- gpr_mu_unlock(&chand->mu_state);
- return out;
-}
-
-void grpc_client_uchannel_watch_connectivity_state(
- grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_pollset *pollset,
- grpc_connectivity_state *state, grpc_closure *on_complete) {
- channel_data *chand = elem->channel_data;
- gpr_mu_lock(&chand->mu_state);
- grpc_connectivity_state_notify_on_state_change(
- exec_ctx, &chand->state_tracker, state, on_complete);
- gpr_mu_unlock(&chand->mu_state);
-}
-
-grpc_channel *grpc_client_uchannel_create(grpc_subchannel *subchannel,
- grpc_channel_args *args) {
- grpc_channel *channel = NULL;
- grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
-
- channel =
- grpc_channel_create(&exec_ctx, NULL, args, GRPC_CLIENT_UCHANNEL, NULL);
-
- return channel;
-}
-
-void grpc_client_uchannel_set_connected_subchannel(
- grpc_channel *uchannel, grpc_connected_subchannel *connected_subchannel) {
- grpc_channel_element *elem =
- grpc_channel_stack_last_element(grpc_channel_get_channel_stack(uchannel));
- channel_data *chand = elem->channel_data;
- GPR_ASSERT(elem->filter == &grpc_client_uchannel_filter);
- gpr_mu_lock(&chand->mu_state);
- chand->connected_subchannel = connected_subchannel;
- GRPC_CONNECTED_SUBCHANNEL_REF(connected_subchannel, "uchannel");
- gpr_mu_unlock(&chand->mu_state);
-}
diff --git a/src/core/httpcli/parser.c b/src/core/httpcli/parser.c
deleted file mode 100644
index c314f025a0..0000000000
--- a/src/core/httpcli/parser.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include "src/core/httpcli/parser.h"
-
-#include <string.h>
-
-#include <grpc/support/alloc.h>
-#include <grpc/support/log.h>
-#include <grpc/support/useful.h>
-
-static int handle_response_line(grpc_httpcli_parser *parser) {
- uint8_t *beg = parser->cur_line;
- uint8_t *cur = beg;
- uint8_t *end = beg + parser->cur_line_length;
-
- if (cur == end || *cur++ != 'H') goto error;
- if (cur == end || *cur++ != 'T') goto error;
- if (cur == end || *cur++ != 'T') goto error;
- if (cur == end || *cur++ != 'P') goto error;
- if (cur == end || *cur++ != '/') goto error;
- if (cur == end || *cur++ != '1') goto error;
- if (cur == end || *cur++ != '.') goto error;
- if (cur == end || *cur < '0' || *cur++ > '1') goto error;
- if (cur == end || *cur++ != ' ') goto error;
- if (cur == end || *cur < '1' || *cur++ > '9') goto error;
- if (cur == end || *cur < '0' || *cur++ > '9') goto error;
- if (cur == end || *cur < '0' || *cur++ > '9') goto error;
- parser->r.status =
- (cur[-3] - '0') * 100 + (cur[-2] - '0') * 10 + (cur[-1] - '0');
- if (cur == end || *cur++ != ' ') goto error;
-
- /* we don't really care about the status code message */
-
- return 1;
-
-error:
- gpr_log(GPR_ERROR, "Failed parsing response line");
- return 0;
-}
-
-static char *buf2str(void *buffer, size_t length) {
- char *out = gpr_malloc(length + 1);
- memcpy(out, buffer, length);
- out[length] = 0;
- return out;
-}
-
-static int add_header(grpc_httpcli_parser *parser) {
- uint8_t *beg = parser->cur_line;
- uint8_t *cur = beg;
- uint8_t *end = beg + parser->cur_line_length;
- grpc_httpcli_header hdr = {NULL, NULL};
-
- GPR_ASSERT(cur != end);
-
- if (*cur == ' ' || *cur == '\t') {
- gpr_log(GPR_ERROR, "Continued header lines not supported yet");
- goto error;
- }
-
- while (cur != end && *cur != ':') {
- cur++;
- }
- if (cur == end) {
- gpr_log(GPR_ERROR, "Didn't find ':' in header string");
- goto error;
- }
- GPR_ASSERT(cur >= beg);
- hdr.key = buf2str(beg, (size_t)(cur - beg));
- cur++; /* skip : */
-
- while (cur != end && (*cur == ' ' || *cur == '\t')) {
- cur++;
- }
- GPR_ASSERT(end - cur >= 2);
- hdr.value = buf2str(cur, (size_t)(end - cur) - 2);
-
- if (parser->r.hdr_count == parser->hdr_capacity) {
- parser->hdr_capacity =
- GPR_MAX(parser->hdr_capacity + 1, parser->hdr_capacity * 3 / 2);
- parser->r.hdrs = gpr_realloc(
- parser->r.hdrs, parser->hdr_capacity * sizeof(*parser->r.hdrs));
- }
- parser->r.hdrs[parser->r.hdr_count++] = hdr;
- return 1;
-
-error:
- gpr_free(hdr.key);
- gpr_free(hdr.value);
- return 0;
-}
-
-static int finish_line(grpc_httpcli_parser *parser) {
- switch (parser->state) {
- case GRPC_HTTPCLI_INITIAL_RESPONSE:
- if (!handle_response_line(parser)) {
- return 0;
- }
- parser->state = GRPC_HTTPCLI_HEADERS;
- break;
- case GRPC_HTTPCLI_HEADERS:
- if (parser->cur_line_length == 2) {
- parser->state = GRPC_HTTPCLI_BODY;
- break;
- }
- if (!add_header(parser)) {
- return 0;
- }
- break;
- case GRPC_HTTPCLI_BODY:
- GPR_UNREACHABLE_CODE(return 0);
- }
-
- parser->cur_line_length = 0;
- return 1;
-}
-
-static int addbyte(grpc_httpcli_parser *parser, uint8_t byte) {
- switch (parser->state) {
- case GRPC_HTTPCLI_INITIAL_RESPONSE:
- case GRPC_HTTPCLI_HEADERS:
- if (parser->cur_line_length >= GRPC_HTTPCLI_MAX_HEADER_LENGTH) {
- gpr_log(GPR_ERROR, "HTTP client max line length (%d) exceeded",
- GRPC_HTTPCLI_MAX_HEADER_LENGTH);
- return 0;
- }
- parser->cur_line[parser->cur_line_length] = byte;
- parser->cur_line_length++;
- if (parser->cur_line_length >= 2 &&
- parser->cur_line[parser->cur_line_length - 2] == '\r' &&
- parser->cur_line[parser->cur_line_length - 1] == '\n') {
- return finish_line(parser);
- } else {
- return 1;
- }
- GPR_UNREACHABLE_CODE(return 0);
- case GRPC_HTTPCLI_BODY:
- if (parser->r.body_length == parser->body_capacity) {
- parser->body_capacity = GPR_MAX(8, parser->body_capacity * 3 / 2);
- parser->r.body =
- gpr_realloc((void *)parser->r.body, parser->body_capacity);
- }
- parser->r.body[parser->r.body_length] = (char)byte;
- parser->r.body_length++;
- return 1;
- }
- GPR_UNREACHABLE_CODE(return 0);
-}
-
-void grpc_httpcli_parser_init(grpc_httpcli_parser *parser) {
- memset(parser, 0, sizeof(*parser));
- parser->state = GRPC_HTTPCLI_INITIAL_RESPONSE;
- parser->r.status = 500;
-}
-
-void grpc_httpcli_parser_destroy(grpc_httpcli_parser *parser) {
- size_t i;
- gpr_free(parser->r.body);
- for (i = 0; i < parser->r.hdr_count; i++) {
- gpr_free(parser->r.hdrs[i].key);
- gpr_free(parser->r.hdrs[i].value);
- }
- gpr_free(parser->r.hdrs);
-}
-
-int grpc_httpcli_parser_parse(grpc_httpcli_parser *parser, gpr_slice slice) {
- size_t i;
-
- for (i = 0; i < GPR_SLICE_LENGTH(slice); i++) {
- if (!addbyte(parser, GPR_SLICE_START_PTR(slice)[i])) {
- return 0;
- }
- }
-
- return 1;
-}
-
-int grpc_httpcli_parser_eof(grpc_httpcli_parser *parser) {
- return parser->state == GRPC_HTTPCLI_BODY;
-}
diff --git a/src/core/census/README.md b/src/core/lib/census/README.md
index fb615a2194..fb615a2194 100644
--- a/src/core/census/README.md
+++ b/src/core/lib/census/README.md
diff --git a/src/core/census/aggregation.h b/src/core/lib/census/aggregation.h
index e0ef9630c9..f353368b97 100644
--- a/src/core/census/aggregation.h
+++ b/src/core/lib/census/aggregation.h
@@ -33,8 +33,8 @@
#include <stddef.h>
-#ifndef GRPC_CORE_CENSUS_AGGREGATION_H
-#define GRPC_CORE_CENSUS_AGGREGATION_H
+#ifndef GRPC_CORE_LIB_CENSUS_AGGREGATION_H
+#define GRPC_CORE_LIB_CENSUS_AGGREGATION_H
/** Structure used to describe an aggregation type. */
struct census_aggregation_ops {
@@ -63,4 +63,4 @@ struct census_aggregation_ops {
size_t (*print)(const void *aggregation, char *buffer, size_t n);
};
-#endif /* GRPC_CORE_CENSUS_AGGREGATION_H */
+#endif /* GRPC_CORE_LIB_CENSUS_AGGREGATION_H */
diff --git a/src/core/census/context.c b/src/core/lib/census/context.c
index 89b8ee0b39..5a118f46a9 100644
--- a/src/core/census/context.c
+++ b/src/core/lib/census/context.c
@@ -38,7 +38,7 @@
#include <grpc/support/useful.h>
#include <stdbool.h>
#include <string.h>
-#include "src/core/support/string.h"
+#include "src/core/lib/support/string.h"
// Functions in this file support the public context API, including
// encoding/decoding as part of context propagation across RPC's. The overall
diff --git a/src/core/census/grpc_context.c b/src/core/lib/census/grpc_context.c
index 4b61382a2c..457c176355 100644
--- a/src/core/census/grpc_context.c
+++ b/src/core/lib/census/grpc_context.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,8 +33,8 @@
#include <grpc/census.h>
#include <grpc/grpc.h>
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/call.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/call.h"
void grpc_census_call_set_context(grpc_call *call, census_context *context) {
GRPC_API_TRACE("grpc_census_call_set_context(call=%p, census_context=%p)", 2,
diff --git a/src/core/census/grpc_filter.c b/src/core/lib/census/grpc_filter.c
index c8aaf31e2d..d27d789aa1 100644
--- a/src/core/census/grpc_filter.c
+++ b/src/core/lib/census/grpc_filter.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/census/grpc_filter.h"
+#include "src/core/lib/census/grpc_filter.h"
#include <stdio.h>
#include <string.h>
@@ -42,10 +42,10 @@
#include <grpc/support/slice.h>
#include <grpc/support/time.h>
-#include "src/core/channel/channel_stack.h"
-#include "src/core/statistics/census_interface.h"
-#include "src/core/statistics/census_rpc_stats.h"
-#include "src/core/transport/static_metadata.h"
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/statistics/census_interface.h"
+#include "src/core/lib/statistics/census_rpc_stats.h"
+#include "src/core/lib/transport/static_metadata.h"
typedef struct call_data {
census_op_id op_id;
@@ -172,13 +172,27 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
}
const grpc_channel_filter grpc_client_census_filter = {
- client_start_transport_op, grpc_channel_next_op, sizeof(call_data),
- client_init_call_elem, grpc_call_stack_ignore_set_pollset,
- client_destroy_call_elem, sizeof(channel_data), init_channel_elem,
- destroy_channel_elem, grpc_call_next_get_peer, "census-client"};
+ client_start_transport_op,
+ grpc_channel_next_op,
+ sizeof(call_data),
+ client_init_call_elem,
+ grpc_call_stack_ignore_set_pollset,
+ client_destroy_call_elem,
+ sizeof(channel_data),
+ init_channel_elem,
+ destroy_channel_elem,
+ grpc_call_next_get_peer,
+ "census-client"};
const grpc_channel_filter grpc_server_census_filter = {
- server_start_transport_op, grpc_channel_next_op, sizeof(call_data),
- server_init_call_elem, grpc_call_stack_ignore_set_pollset,
- server_destroy_call_elem, sizeof(channel_data), init_channel_elem,
- destroy_channel_elem, grpc_call_next_get_peer, "census-server"};
+ server_start_transport_op,
+ grpc_channel_next_op,
+ sizeof(call_data),
+ server_init_call_elem,
+ grpc_call_stack_ignore_set_pollset,
+ server_destroy_call_elem,
+ sizeof(channel_data),
+ init_channel_elem,
+ destroy_channel_elem,
+ grpc_call_next_get_peer,
+ "census-server"};
diff --git a/src/core/census/grpc_filter.h b/src/core/lib/census/grpc_filter.h
index 4699e4d692..7ceafe56e4 100644
--- a/src/core/census/grpc_filter.h
+++ b/src/core/lib/census/grpc_filter.h
@@ -31,14 +31,14 @@
*
*/
-#ifndef GRPC_CORE_CENSUS_GRPC_FILTER_H
-#define GRPC_CORE_CENSUS_GRPC_FILTER_H
+#ifndef GRPC_CORE_LIB_CENSUS_GRPC_FILTER_H
+#define GRPC_CORE_LIB_CENSUS_GRPC_FILTER_H
-#include "src/core/channel/channel_stack.h"
+#include "src/core/lib/channel/channel_stack.h"
/* Census filters: provides tracing and stats collection functionalities. It
needs to reside right below the surface filter in the channel stack. */
extern const grpc_channel_filter grpc_client_census_filter;
extern const grpc_channel_filter grpc_server_census_filter;
-#endif /* GRPC_CORE_CENSUS_GRPC_FILTER_H */
+#endif /* GRPC_CORE_LIB_CENSUS_GRPC_FILTER_H */
diff --git a/src/core/census/grpc_plugin.c b/src/core/lib/census/grpc_plugin.c
index 3be2a48eb8..12aca76745 100644
--- a/src/core/census/grpc_plugin.c
+++ b/src/core/lib/census/grpc_plugin.c
@@ -31,15 +31,15 @@
*
*/
-#include "src/core/census/grpc_plugin.h"
+#include "src/core/lib/census/grpc_plugin.h"
#include <limits.h>
#include <grpc/census.h>
-#include "src/core/census/grpc_filter.h"
-#include "src/core/surface/channel_init.h"
-#include "src/core/channel/channel_stack_builder.h"
+#include "src/core/lib/census/grpc_filter.h"
+#include "src/core/lib/channel/channel_stack_builder.h"
+#include "src/core/lib/surface/channel_init.h"
static bool maybe_add_census_filter(grpc_channel_stack_builder *builder,
void *arg_must_be_null) {
@@ -63,8 +63,6 @@ void census_grpc_plugin_init(void) {
}
grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX,
maybe_add_census_filter, NULL);
- grpc_channel_init_register_stage(GRPC_CLIENT_UCHANNEL, INT_MAX,
- maybe_add_census_filter, NULL);
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX,
maybe_add_census_filter, NULL);
}
diff --git a/src/core/census/grpc_plugin.h b/src/core/lib/census/grpc_plugin.h
index 9321c2c30f..33e5f0b701 100644
--- a/src/core/census/grpc_plugin.h
+++ b/src/core/lib/census/grpc_plugin.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_CENSUS_GRPC_PLUGIN_H
-#define GRPC_CORE_CENSUS_GRPC_PLUGIN_H
+#ifndef GRPC_CORE_LIB_CENSUS_GRPC_PLUGIN_H
+#define GRPC_CORE_LIB_CENSUS_GRPC_PLUGIN_H
void census_grpc_plugin_init(void);
void census_grpc_plugin_destroy(void);
-#endif /* GRPC_CORE_CENSUS_GRPC_PLUGIN_H */
+#endif /* GRPC_CORE_LIB_CENSUS_GRPC_PLUGIN_H */
diff --git a/src/core/census/initialize.c b/src/core/lib/census/initialize.c
index ce7ec09b89..ce7ec09b89 100644
--- a/src/core/census/initialize.c
+++ b/src/core/lib/census/initialize.c
diff --git a/src/core/census/mlog.c b/src/core/lib/census/mlog.c
index a2cc46d3f2..9d47e80297 100644
--- a/src/core/census/mlog.c
+++ b/src/core/lib/census/mlog.c
@@ -88,7 +88,7 @@
// include the name of the structure, which will be passed as the first
// argument. E.g. cl_block_initialize() will initialize a cl_block.
-#include "src/core/census/mlog.h"
+#include "src/core/lib/census/mlog.h"
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/cpu.h>
diff --git a/src/core/census/mlog.h b/src/core/lib/census/mlog.h
index bc6eaeaf28..7fbdeda986 100644
--- a/src/core/census/mlog.h
+++ b/src/core/lib/census/mlog.h
@@ -33,8 +33,8 @@
/* A very fast in-memory log, optimized for multiple writers. */
-#ifndef GRPC_CORE_CENSUS_MLOG_H
-#define GRPC_CORE_CENSUS_MLOG_H
+#ifndef GRPC_CORE_LIB_CENSUS_MLOG_H
+#define GRPC_CORE_LIB_CENSUS_MLOG_H
#include <grpc/support/port_platform.h>
#include <stddef.h>
@@ -92,4 +92,4 @@ size_t census_log_remaining_space(void);
out-of-space. */
int64_t census_log_out_of_space_count(void);
-#endif /* GRPC_CORE_CENSUS_MLOG_H */
+#endif /* GRPC_CORE_LIB_CENSUS_MLOG_H */
diff --git a/src/core/census/operation.c b/src/core/lib/census/operation.c
index 5c58704372..315f9c3534 100644
--- a/src/core/census/operation.c
+++ b/src/core/lib/census/operation.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/census/placeholders.c b/src/core/lib/census/placeholders.c
index fe23d13971..fe23d13971 100644
--- a/src/core/census/placeholders.c
+++ b/src/core/lib/census/placeholders.c
diff --git a/src/core/census/rpc_metric_id.h b/src/core/lib/census/rpc_metric_id.h
index f8d8dad0bf..aad0588fb3 100644
--- a/src/core/census/rpc_metric_id.h
+++ b/src/core/lib/census/rpc_metric_id.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_CENSUS_RPC_METRIC_ID_H
-#define GRPC_CORE_CENSUS_RPC_METRIC_ID_H
+#ifndef GRPC_CORE_LIB_CENSUS_RPC_METRIC_ID_H
+#define GRPC_CORE_LIB_CENSUS_RPC_METRIC_ID_H
/* Metric ID's used for RPC measurements. */
/* Count of client requests sent. */
@@ -48,4 +48,4 @@
/* Server side request latency. */
#define CENSUS_METRIC_RPC_SERVER_LATENCY ((uint32_t)5)
-#endif /* GRPC_CORE_CENSUS_RPC_METRIC_ID_H */
+#endif /* GRPC_CORE_LIB_CENSUS_RPC_METRIC_ID_H */
diff --git a/src/core/census/tracing.c b/src/core/lib/census/tracing.c
index 3b5d6dab2b..e508996af3 100644
--- a/src/core/census/tracing.c
+++ b/src/core/lib/census/tracing.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/channel/channel_args.c b/src/core/lib/channel/channel_args.c
index bae7a90a01..1a02f1f4aa 100644
--- a/src/core/channel/channel_args.c
+++ b/src/core/lib/channel/channel_args.c
@@ -31,9 +31,9 @@
*
*/
+#include "src/core/lib/channel/channel_args.h"
#include <grpc/grpc.h>
-#include "src/core/channel/channel_args.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/support/string.h"
#include <grpc/census.h>
#include <grpc/support/alloc.h>
diff --git a/src/core/channel/channel_args.h b/src/core/lib/channel/channel_args.h
index e19440f76f..67d287ec6b 100644
--- a/src/core/channel/channel_args.h
+++ b/src/core/lib/channel/channel_args.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_CHANNEL_CHANNEL_ARGS_H
-#define GRPC_CORE_CHANNEL_CHANNEL_ARGS_H
+#ifndef GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H
+#define GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H
#include <grpc/compression.h>
#include <grpc/grpc.h>
@@ -91,4 +91,4 @@ int grpc_channel_args_compression_algorithm_get_states(
int grpc_channel_args_compare(const grpc_channel_args *a,
const grpc_channel_args *b);
-#endif /* GRPC_CORE_CHANNEL_CHANNEL_ARGS_H */
+#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_ARGS_H */
diff --git a/src/core/channel/channel_stack.c b/src/core/lib/channel/channel_stack.c
index 3e61688364..52283e35fa 100644
--- a/src/core/channel/channel_stack.c
+++ b/src/core/lib/channel/channel_stack.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/channel/channel_stack.h"
+#include "src/core/lib/channel/channel_stack.h"
#include <grpc/support/log.h>
#include <stdlib.h>
diff --git a/src/core/channel/channel_stack.h b/src/core/lib/channel/channel_stack.h
index 52362f0b20..b29bee411d 100644
--- a/src/core/channel/channel_stack.h
+++ b/src/core/lib/channel/channel_stack.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_CHANNEL_CHANNEL_STACK_H
-#define GRPC_CORE_CHANNEL_CHANNEL_STACK_H
+#ifndef GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_H
+#define GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_H
/* A channel filter defines how operations on a channel are implemented.
Channel filters are chained together to create full channels, and if those
@@ -45,8 +45,8 @@
#include <grpc/grpc.h>
#include <grpc/support/log.h>
-#include "src/core/debug/trace.h"
-#include "src/core/transport/transport.h"
+#include "src/core/lib/debug/trace.h"
+#include "src/core/lib/transport/transport.h"
typedef struct grpc_channel_element grpc_channel_element;
typedef struct grpc_call_element grpc_call_element;
@@ -257,4 +257,4 @@ extern int grpc_trace_channel;
#define GRPC_CALL_LOG_OP(sev, elem, op) \
if (grpc_trace_channel) grpc_call_log_op(sev, elem, op)
-#endif /* GRPC_CORE_CHANNEL_CHANNEL_STACK_H */
+#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_H */
diff --git a/src/core/channel/channel_stack_builder.c b/src/core/lib/channel/channel_stack_builder.c
index 80e2e393f9..1ce0c4e07f 100644
--- a/src/core/channel/channel_stack_builder.c
+++ b/src/core/lib/channel/channel_stack_builder.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/channel/channel_stack_builder.h"
+#include "src/core/lib/channel/channel_stack_builder.h"
#include <string.h>
@@ -216,7 +216,6 @@ void *grpc_channel_stack_builder_finish(grpc_exec_ctx *exec_ctx,
// count the number of filters
size_t num_filters = 0;
for (filter_node *p = builder->begin.next; p != &builder->end; p = p->next) {
- gpr_log(GPR_DEBUG, "%d: %s", num_filters, p->filter->name);
num_filters++;
}
diff --git a/src/core/channel/channel_stack_builder.h b/src/core/lib/channel/channel_stack_builder.h
index 15f395e8b8..8532c4462a 100644
--- a/src/core/channel/channel_stack_builder.h
+++ b/src/core/lib/channel/channel_stack_builder.h
@@ -31,13 +31,13 @@
*
*/
-#ifndef GRPC_CORE_CHANNEL_CHANNEL_STACK_BUILDER_H
-#define GRPC_CORE_CHANNEL_CHANNEL_STACK_BUILDER_H
+#ifndef GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_H
+#define GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_H
#include <stdbool.h>
-#include "src/core/channel/channel_args.h"
-#include "src/core/channel/channel_stack.h"
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/channel/channel_stack.h"
/// grpc_channel_stack_builder offers a programmatic interface to selected
/// and order channel filters
@@ -152,4 +152,4 @@ void grpc_channel_stack_builder_destroy(grpc_channel_stack_builder *builder);
extern int grpc_trace_channel_stack_builder;
-#endif /* GRPC_CORE_CHANNEL_CHANNEL_STACK_BUILDER_H */
+#endif /* GRPC_CORE_LIB_CHANNEL_CHANNEL_STACK_BUILDER_H */
diff --git a/src/core/channel/client_channel.c b/src/core/lib/channel/client_channel.c
index e229a15260..58eeb9f745 100644
--- a/src/core/channel/client_channel.c
+++ b/src/core/lib/channel/client_channel.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/channel/client_channel.h"
+#include "src/core/lib/channel/client_channel.h"
#include <stdio.h>
#include <string.h>
@@ -41,14 +41,14 @@
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
-#include "src/core/channel/channel_args.h"
-#include "src/core/channel/connected_channel.h"
-#include "src/core/channel/subchannel_call_holder.h"
-#include "src/core/iomgr/iomgr.h"
-#include "src/core/profiling/timers.h"
-#include "src/core/support/string.h"
-#include "src/core/surface/channel.h"
-#include "src/core/transport/connectivity_state.h"
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/channel/subchannel_call_holder.h"
+#include "src/core/lib/iomgr/iomgr.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/surface/channel.h"
+#include "src/core/lib/transport/connectivity_state.h"
/* Client channel implementation */
@@ -453,9 +453,17 @@ static void cc_set_pollset(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
}
const grpc_channel_filter grpc_client_channel_filter = {
- cc_start_transport_stream_op, cc_start_transport_op, sizeof(call_data),
- init_call_elem, cc_set_pollset, destroy_call_elem, sizeof(channel_data),
- init_channel_elem, destroy_channel_elem, cc_get_peer, "client-channel",
+ cc_start_transport_stream_op,
+ cc_start_transport_op,
+ sizeof(call_data),
+ init_call_elem,
+ cc_set_pollset,
+ destroy_call_elem,
+ sizeof(channel_data),
+ init_channel_elem,
+ destroy_channel_elem,
+ cc_get_peer,
+ "client-channel",
};
void grpc_client_channel_set_resolver(grpc_exec_ctx *exec_ctx,
diff --git a/src/core/channel/client_channel.h b/src/core/lib/channel/client_channel.h
index 422f7f8374..8777796fb6 100644
--- a/src/core/channel/client_channel.h
+++ b/src/core/lib/channel/client_channel.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_CHANNEL_CLIENT_CHANNEL_H
-#define GRPC_CORE_CHANNEL_CLIENT_CHANNEL_H
+#ifndef GRPC_CORE_LIB_CHANNEL_CLIENT_CHANNEL_H
+#define GRPC_CORE_LIB_CHANNEL_CLIENT_CHANNEL_H
-#include "src/core/channel/channel_stack.h"
-#include "src/core/client_config/resolver.h"
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/client_config/resolver.h"
/* A client channel is a channel that begins disconnected, and can connect
to some endpoint on demand. If that endpoint disconnects, it will be
@@ -60,4 +60,4 @@ void grpc_client_channel_watch_connectivity_state(
grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_pollset *pollset,
grpc_connectivity_state *state, grpc_closure *on_complete);
-#endif /* GRPC_CORE_CHANNEL_CLIENT_CHANNEL_H */
+#endif /* GRPC_CORE_LIB_CHANNEL_CLIENT_CHANNEL_H */
diff --git a/src/core/channel/compress_filter.c b/src/core/lib/channel/compress_filter.c
index 3e7ca08fd2..04bb7cc76f 100644
--- a/src/core/channel/compress_filter.c
+++ b/src/core/lib/channel/compress_filter.c
@@ -39,13 +39,13 @@
#include <grpc/support/log.h>
#include <grpc/support/slice_buffer.h>
-#include "src/core/channel/channel_args.h"
-#include "src/core/channel/compress_filter.h"
-#include "src/core/compression/algorithm_metadata.h"
-#include "src/core/compression/message_compress.h"
-#include "src/core/profiling/timers.h"
-#include "src/core/support/string.h"
-#include "src/core/transport/static_metadata.h"
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/channel/compress_filter.h"
+#include "src/core/lib/compression/algorithm_metadata.h"
+#include "src/core/lib/compression/message_compress.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/transport/static_metadata.h"
typedef struct call_data {
gpr_slice_buffer slices; /**< Buffers up input slices to be compressed */
@@ -291,7 +291,14 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem) {}
const grpc_channel_filter grpc_compress_filter = {
- compress_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data),
- init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem,
- sizeof(channel_data), init_channel_elem, destroy_channel_elem,
- grpc_call_next_get_peer, "compress"};
+ compress_start_transport_stream_op,
+ grpc_channel_next_op,
+ sizeof(call_data),
+ init_call_elem,
+ grpc_call_stack_ignore_set_pollset,
+ destroy_call_elem,
+ sizeof(channel_data),
+ init_channel_elem,
+ destroy_channel_elem,
+ grpc_call_next_get_peer,
+ "compress"};
diff --git a/src/core/channel/compress_filter.h b/src/core/lib/channel/compress_filter.h
index 8c208ac799..9010074335 100644
--- a/src/core/channel/compress_filter.h
+++ b/src/core/lib/channel/compress_filter.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_CHANNEL_COMPRESS_FILTER_H
-#define GRPC_CORE_CHANNEL_COMPRESS_FILTER_H
+#ifndef GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H
+#define GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H
-#include "src/core/channel/channel_stack.h"
+#include "src/core/lib/channel/channel_stack.h"
#define GRPC_COMPRESS_REQUEST_ALGORITHM_KEY "grpc-internal-encoding-request"
@@ -62,4 +62,4 @@
extern const grpc_channel_filter grpc_compress_filter;
-#endif /* GRPC_CORE_CHANNEL_COMPRESS_FILTER_H */
+#endif /* GRPC_CORE_LIB_CHANNEL_COMPRESS_FILTER_H */
diff --git a/src/core/channel/connected_channel.c b/src/core/lib/channel/connected_channel.c
index e7ed3ccfeb..5e3a8974ce 100644
--- a/src/core/channel/connected_channel.c
+++ b/src/core/lib/channel/connected_channel.c
@@ -31,19 +31,19 @@
*
*/
-#include "src/core/channel/connected_channel.h"
+#include "src/core/lib/channel/connected_channel.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include "src/core/support/string.h"
-#include "src/core/transport/transport.h"
-#include "src/core/profiling/timers.h"
#include <grpc/byte_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/slice_buffer.h>
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/transport/transport.h"
#define MAX_BUFFER_LENGTH 8192
@@ -132,9 +132,17 @@ static char *con_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) {
}
static const grpc_channel_filter connected_channel_filter = {
- con_start_transport_stream_op, con_start_transport_op, sizeof(call_data),
- init_call_elem, set_pollset, destroy_call_elem, sizeof(channel_data),
- init_channel_elem, destroy_channel_elem, con_get_peer, "connected",
+ con_start_transport_stream_op,
+ con_start_transport_op,
+ sizeof(call_data),
+ init_call_elem,
+ set_pollset,
+ destroy_call_elem,
+ sizeof(channel_data),
+ init_channel_elem,
+ destroy_channel_elem,
+ con_get_peer,
+ "connected",
};
static void bind_transport(grpc_channel_stack *channel_stack,
diff --git a/src/core/channel/connected_channel.h b/src/core/lib/channel/connected_channel.h
index 7c0c8359a4..4f20b751cc 100644
--- a/src/core/channel/connected_channel.h
+++ b/src/core/lib/channel/connected_channel.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_CHANNEL_CONNECTED_CHANNEL_H
-#define GRPC_CORE_CHANNEL_CONNECTED_CHANNEL_H
+#ifndef GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H
+#define GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H
-#include "src/core/channel/channel_stack_builder.h"
+#include "src/core/lib/channel/channel_stack_builder.h"
bool grpc_add_connected_filter(grpc_channel_stack_builder *builder,
void *arg_must_be_null);
-#endif /* GRPC_CORE_CHANNEL_CONNECTED_CHANNEL_H */
+#endif /* GRPC_CORE_LIB_CHANNEL_CONNECTED_CHANNEL_H */
diff --git a/src/core/channel/context.h b/src/core/lib/channel/context.h
index db217dc133..bca102da9a 100644
--- a/src/core/channel/context.h
+++ b/src/core/lib/channel/context.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_CHANNEL_CONTEXT_H
-#define GRPC_CORE_CHANNEL_CONTEXT_H
+#ifndef GRPC_CORE_LIB_CHANNEL_CONTEXT_H
+#define GRPC_CORE_LIB_CHANNEL_CONTEXT_H
/* Call object context pointers */
typedef enum {
@@ -46,4 +46,4 @@ typedef struct {
void (*destroy)(void *);
} grpc_call_context_element;
-#endif /* GRPC_CORE_CHANNEL_CONTEXT_H */
+#endif /* GRPC_CORE_LIB_CHANNEL_CONTEXT_H */
diff --git a/src/core/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c
index 79abfd2102..129bddcbab 100644
--- a/src/core/channel/http_client_filter.c
+++ b/src/core/lib/channel/http_client_filter.c
@@ -30,14 +30,14 @@
*
*/
-#include "src/core/channel/http_client_filter.h"
+#include "src/core/lib/channel/http_client_filter.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <string.h>
-#include "src/core/profiling/timers.h"
-#include "src/core/support/string.h"
-#include "src/core/transport/static_metadata.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/transport/static_metadata.h"
typedef struct call_data {
grpc_linked_mdelem method;
@@ -246,7 +246,14 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
}
const grpc_channel_filter grpc_http_client_filter = {
- hc_start_transport_op, grpc_channel_next_op, sizeof(call_data),
- init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem,
- sizeof(channel_data), init_channel_elem, destroy_channel_elem,
- grpc_call_next_get_peer, "http-client"};
+ hc_start_transport_op,
+ grpc_channel_next_op,
+ sizeof(call_data),
+ init_call_elem,
+ grpc_call_stack_ignore_set_pollset,
+ destroy_call_elem,
+ sizeof(channel_data),
+ init_channel_elem,
+ destroy_channel_elem,
+ grpc_call_next_get_peer,
+ "http-client"};
diff --git a/src/core/channel/http_client_filter.h b/src/core/lib/channel/http_client_filter.h
index 6f619bbf00..418426e9cc 100644
--- a/src/core/channel/http_client_filter.h
+++ b/src/core/lib/channel/http_client_filter.h
@@ -31,14 +31,14 @@
*
*/
-#ifndef GRPC_CORE_CHANNEL_HTTP_CLIENT_FILTER_H
-#define GRPC_CORE_CHANNEL_HTTP_CLIENT_FILTER_H
+#ifndef GRPC_CORE_LIB_CHANNEL_HTTP_CLIENT_FILTER_H
+#define GRPC_CORE_LIB_CHANNEL_HTTP_CLIENT_FILTER_H
-#include "src/core/channel/channel_stack.h"
+#include "src/core/lib/channel/channel_stack.h"
/* Processes metadata on the client side for HTTP2 transports */
extern const grpc_channel_filter grpc_http_client_filter;
#define GRPC_ARG_HTTP2_SCHEME "grpc.http2_scheme"
-#endif /* GRPC_CORE_CHANNEL_HTTP_CLIENT_FILTER_H */
+#endif /* GRPC_CORE_LIB_CHANNEL_HTTP_CLIENT_FILTER_H */
diff --git a/src/core/channel/http_server_filter.c b/src/core/lib/channel/http_server_filter.c
index 42ce8bc887..db1a3d5010 100644
--- a/src/core/channel/http_server_filter.c
+++ b/src/core/lib/channel/http_server_filter.c
@@ -31,13 +31,13 @@
*
*/
-#include "src/core/channel/http_server_filter.h"
+#include "src/core/lib/channel/http_server_filter.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <string.h>
-#include "src/core/profiling/timers.h"
-#include "src/core/transport/static_metadata.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/transport/static_metadata.h"
typedef struct call_data {
uint8_t seen_path;
@@ -235,7 +235,14 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem) {}
const grpc_channel_filter grpc_http_server_filter = {
- hs_start_transport_op, grpc_channel_next_op, sizeof(call_data),
- init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem,
- sizeof(channel_data), init_channel_elem, destroy_channel_elem,
- grpc_call_next_get_peer, "http-server"};
+ hs_start_transport_op,
+ grpc_channel_next_op,
+ sizeof(call_data),
+ init_call_elem,
+ grpc_call_stack_ignore_set_pollset,
+ destroy_call_elem,
+ sizeof(channel_data),
+ init_channel_elem,
+ destroy_channel_elem,
+ grpc_call_next_get_peer,
+ "http-server"};
diff --git a/src/core/channel/http_server_filter.h b/src/core/lib/channel/http_server_filter.h
index 528c8648fd..c8cf920ded 100644
--- a/src/core/channel/http_server_filter.h
+++ b/src/core/lib/channel/http_server_filter.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_CHANNEL_HTTP_SERVER_FILTER_H
-#define GRPC_CORE_CHANNEL_HTTP_SERVER_FILTER_H
+#ifndef GRPC_CORE_LIB_CHANNEL_HTTP_SERVER_FILTER_H
+#define GRPC_CORE_LIB_CHANNEL_HTTP_SERVER_FILTER_H
-#include "src/core/channel/channel_stack.h"
+#include "src/core/lib/channel/channel_stack.h"
/* Processes metadata on the client side for HTTP2 transports */
extern const grpc_channel_filter grpc_http_server_filter;
-#endif /* GRPC_CORE_CHANNEL_HTTP_SERVER_FILTER_H */
+#endif /* GRPC_CORE_LIB_CHANNEL_HTTP_SERVER_FILTER_H */
diff --git a/src/core/channel/subchannel_call_holder.c b/src/core/lib/channel/subchannel_call_holder.c
index 788d3ab21b..d7f71c0767 100644
--- a/src/core/channel/subchannel_call_holder.c
+++ b/src/core/lib/channel/subchannel_call_holder.c
@@ -31,11 +31,11 @@
*
*/
-#include "src/core/channel/subchannel_call_holder.h"
+#include "src/core/lib/channel/subchannel_call_holder.h"
#include <grpc/support/alloc.h>
-#include "src/core/profiling/timers.h"
+#include "src/core/lib/profiling/timers.h"
#define GET_CALL(holder) \
((grpc_subchannel_call *)(gpr_atm_acq_load(&(holder)->subchannel_call)))
diff --git a/src/core/channel/subchannel_call_holder.h b/src/core/lib/channel/subchannel_call_holder.h
index 47b7d1fe59..9b10786a71 100644
--- a/src/core/channel/subchannel_call_holder.h
+++ b/src/core/lib/channel/subchannel_call_holder.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_CHANNEL_SUBCHANNEL_CALL_HOLDER_H
-#define GRPC_CORE_CHANNEL_SUBCHANNEL_CALL_HOLDER_H
+#ifndef GRPC_CORE_LIB_CHANNEL_SUBCHANNEL_CALL_HOLDER_H
+#define GRPC_CORE_LIB_CHANNEL_SUBCHANNEL_CALL_HOLDER_H
-#include "src/core/client_config/subchannel.h"
+#include "src/core/lib/client_config/subchannel.h"
/** Pick a subchannel for grpc_subchannel_call_holder;
Return 1 if subchannel is available immediately (in which case on_ready
@@ -56,15 +56,14 @@ typedef enum {
for initial metadata before trying to create a call object,
and handling cancellation gracefully.
- Both the channel and uchannel filter use this as their call_data. */
+ The channel filter uses this as their call_data. */
typedef struct grpc_subchannel_call_holder {
/** either 0 for no call, 1 for cancelled, or a pointer to a
grpc_subchannel_call */
gpr_atm subchannel_call;
/** Helper function to choose the subchannel on which to create
the call object. Channel filter delegates to the load
- balancing policy (once it's ready); uchannel returns
- immediately */
+ balancing policy (once it's ready). */
grpc_subchannel_call_holder_pick_subchannel pick_subchannel;
void *pick_subchannel_arg;
@@ -96,4 +95,4 @@ void grpc_subchannel_call_holder_perform_op(grpc_exec_ctx *exec_ctx,
char *grpc_subchannel_call_holder_get_peer(grpc_exec_ctx *exec_ctx,
grpc_subchannel_call_holder *holder);
-#endif /* GRPC_CORE_CHANNEL_SUBCHANNEL_CALL_HOLDER_H */
+#endif /* GRPC_CORE_LIB_CHANNEL_SUBCHANNEL_CALL_HOLDER_H */
diff --git a/src/core/client_config/README.md b/src/core/lib/client_config/README.md
index fff7a5af5b..fff7a5af5b 100644
--- a/src/core/client_config/README.md
+++ b/src/core/lib/client_config/README.md
diff --git a/src/core/client_config/client_config.c b/src/core/lib/client_config/client_config.c
index c500af25ee..82c8d68099 100644
--- a/src/core/client_config/client_config.c
+++ b/src/core/lib/client_config/client_config.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/client_config.h"
+#include "src/core/lib/client_config/client_config.h"
#include <string.h>
diff --git a/src/core/client_config/client_config.h b/src/core/lib/client_config/client_config.h
index 9b37fdc211..404ec0d3a5 100644
--- a/src/core/client_config/client_config.h
+++ b/src/core/lib/client_config/client_config.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_CLIENT_CONFIG_H
-#define GRPC_CORE_CLIENT_CONFIG_CLIENT_CONFIG_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_CLIENT_CONFIG_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_CLIENT_CONFIG_H
-#include "src/core/client_config/lb_policy.h"
+#include "src/core/lib/client_config/lb_policy.h"
/** Total configuration for a client. Provided, and updated, by
grpc_resolver */
@@ -50,4 +50,4 @@ void grpc_client_config_set_lb_policy(grpc_client_config *client_config,
grpc_lb_policy *grpc_client_config_get_lb_policy(
grpc_client_config *client_config);
-#endif /* GRPC_CORE_CLIENT_CONFIG_CLIENT_CONFIG_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_CLIENT_CONFIG_H */
diff --git a/src/core/client_config/connector.c b/src/core/lib/client_config/connector.c
index aa34aa7fab..f51d862c6d 100644
--- a/src/core/client_config/connector.c
+++ b/src/core/lib/client_config/connector.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/connector.h"
+#include "src/core/lib/client_config/connector.h"
grpc_connector* grpc_connector_ref(grpc_connector* connector) {
connector->vtable->ref(connector);
diff --git a/src/core/client_config/connector.h b/src/core/lib/client_config/connector.h
index 93248fca4b..21b925aade 100644
--- a/src/core/client_config/connector.h
+++ b/src/core/lib/client_config/connector.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_CONNECTOR_H
-#define GRPC_CORE_CLIENT_CONFIG_CONNECTOR_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_CONNECTOR_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_CONNECTOR_H
-#include "src/core/channel/channel_stack.h"
-#include "src/core/iomgr/sockaddr.h"
-#include "src/core/transport/transport.h"
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/iomgr/sockaddr.h"
+#include "src/core/lib/transport/transport.h"
typedef struct grpc_connector grpc_connector;
typedef struct grpc_connector_vtable grpc_connector_vtable;
@@ -89,4 +89,4 @@ void grpc_connector_connect(grpc_exec_ctx *exec_ctx, grpc_connector *connector,
void grpc_connector_shutdown(grpc_exec_ctx *exec_ctx,
grpc_connector *connector);
-#endif /* GRPC_CORE_CLIENT_CONFIG_CONNECTOR_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_CONNECTOR_H */
diff --git a/src/core/client_config/default_initial_connect_string.c b/src/core/lib/client_config/default_initial_connect_string.c
index 6a4e23e6f2..86eb37de77 100644
--- a/src/core/client_config/default_initial_connect_string.c
+++ b/src/core/lib/client_config/default_initial_connect_string.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,7 +32,7 @@
*/
#include <grpc/support/slice.h>
-#include "src/core/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/sockaddr.h"
void grpc_set_default_initial_connect_string(struct sockaddr **addr,
size_t *addr_len,
diff --git a/src/core/client_config/initial_connect_string.c b/src/core/lib/client_config/initial_connect_string.c
index 19afa1675a..95ae728316 100644
--- a/src/core/client_config/initial_connect_string.c
+++ b/src/core/lib/client_config/initial_connect_string.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/initial_connect_string.h"
+#include "src/core/lib/client_config/initial_connect_string.h"
#include <stddef.h>
diff --git a/src/core/client_config/initial_connect_string.h b/src/core/lib/client_config/initial_connect_string.h
index e6d2d8f8fe..eec42fa240 100644
--- a/src/core/client_config/initial_connect_string.h
+++ b/src/core/lib/client_config/initial_connect_string.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H
-#define GRPC_CORE_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H
#include <grpc/support/slice.h>
-#include "src/core/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/sockaddr.h"
typedef void (*grpc_set_initial_connect_string_func)(struct sockaddr **addr,
size_t *addr_len,
@@ -47,4 +47,4 @@ void grpc_test_set_initial_connect_string_function(
void grpc_set_initial_connect_string(struct sockaddr **addr, size_t *addr_len,
gpr_slice *connect_string);
-#endif /* GRPC_CORE_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H */
diff --git a/src/core/client_config/lb_policies/load_balancer_api.c b/src/core/lib/client_config/lb_policies/load_balancer_api.c
index a6b5785fe4..4cbed200df 100644
--- a/src/core/client_config/lb_policies/load_balancer_api.c
+++ b/src/core/lib/client_config/lb_policies/load_balancer_api.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/lb_policies/load_balancer_api.h"
+#include "src/core/lib/client_config/lb_policies/load_balancer_api.h"
#include "third_party/nanopb/pb_decode.h"
#include "third_party/nanopb/pb_encode.h"
diff --git a/src/core/client_config/lb_policies/load_balancer_api.h b/src/core/lib/client_config/lb_policies/load_balancer_api.h
index b7a4c9c8f5..83299adfa9 100644
--- a/src/core/client_config/lb_policies/load_balancer_api.h
+++ b/src/core/lib/client_config/lb_policies/load_balancer_api.h
@@ -31,13 +31,13 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H
-#define GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H
#include <grpc/support/slice_buffer.h>
-#include "src/core/client_config/lb_policy_factory.h"
-#include "src/core/proto/grpc/lb/v0/load_balancer.pb.h"
+#include "src/core/lib/client_config/lb_policy_factory.h"
+#include "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h"
#ifdef __cplusplus
extern "C" {
@@ -82,4 +82,4 @@ void grpc_grpclb_response_destroy(grpc_grpclb_response *response);
}
#endif
-#endif /* GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_LOAD_BALANCER_API_H */
diff --git a/src/core/client_config/lb_policies/pick_first.c b/src/core/lib/client_config/lb_policies/pick_first.c
index 34571e237d..4c4ebaaefb 100644
--- a/src/core/client_config/lb_policies/pick_first.c
+++ b/src/core/lib/client_config/lb_policies/pick_first.c
@@ -31,13 +31,13 @@
*
*/
-#include "src/core/client_config/lb_policies/pick_first.h"
-#include "src/core/client_config/lb_policy_factory.h"
+#include "src/core/lib/client_config/lb_policies/pick_first.h"
+#include "src/core/lib/client_config/lb_policy_factory.h"
#include <string.h>
#include <grpc/support/alloc.h>
-#include "src/core/transport/connectivity_state.h"
+#include "src/core/lib/transport/connectivity_state.h"
typedef struct pending_pick {
struct pending_pick *next;
@@ -407,9 +407,9 @@ void pf_ping_one(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
}
static const grpc_lb_policy_vtable pick_first_lb_policy_vtable = {
- pf_destroy, pf_shutdown, pf_pick, pf_cancel_pick, pf_cancel_picks,
- pf_ping_one, pf_exit_idle, pf_check_connectivity,
- pf_notify_on_state_change};
+ pf_destroy, pf_shutdown, pf_pick,
+ pf_cancel_pick, pf_cancel_picks, pf_ping_one,
+ pf_exit_idle, pf_check_connectivity, pf_notify_on_state_change};
static void pick_first_factory_ref(grpc_lb_policy_factory *factory) {}
diff --git a/src/core/client_config/lb_policies/pick_first.h b/src/core/lib/client_config/lb_policies/pick_first.h
index 3a3f195df5..dba86ea7ad 100644
--- a/src/core/client_config/lb_policies/pick_first.h
+++ b/src/core/lib/client_config/lb_policies/pick_first.h
@@ -31,13 +31,13 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_PICK_FIRST_H
-#define GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_PICK_FIRST_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_PICK_FIRST_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_PICK_FIRST_H
-#include "src/core/client_config/lb_policy_factory.h"
+#include "src/core/lib/client_config/lb_policy_factory.h"
/** Returns a load balancing factory for the pick first policy, which picks up
* the first subchannel from \a subchannels to succesfully connect */
grpc_lb_policy_factory *grpc_pick_first_lb_factory_create();
-#endif /* GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_PICK_FIRST_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_PICK_FIRST_H */
diff --git a/src/core/client_config/lb_policies/round_robin.c b/src/core/lib/client_config/lb_policies/round_robin.c
index 6fa5b03d8c..3b002927c4 100644
--- a/src/core/client_config/lb_policies/round_robin.c
+++ b/src/core/lib/client_config/lb_policies/round_robin.c
@@ -31,12 +31,12 @@
*
*/
-#include "src/core/client_config/lb_policies/round_robin.h"
+#include "src/core/lib/client_config/lb_policies/round_robin.h"
#include <string.h>
#include <grpc/support/alloc.h>
-#include "src/core/transport/connectivity_state.h"
+#include "src/core/lib/transport/connectivity_state.h"
typedef struct round_robin_lb_policy round_robin_lb_policy;
@@ -512,9 +512,9 @@ static void rr_ping_one(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
}
static const grpc_lb_policy_vtable round_robin_lb_policy_vtable = {
- rr_destroy, rr_shutdown, rr_pick, rr_cancel_pick, rr_cancel_picks,
- rr_ping_one, rr_exit_idle, rr_check_connectivity,
- rr_notify_on_state_change};
+ rr_destroy, rr_shutdown, rr_pick,
+ rr_cancel_pick, rr_cancel_picks, rr_ping_one,
+ rr_exit_idle, rr_check_connectivity, rr_notify_on_state_change};
static void round_robin_factory_ref(grpc_lb_policy_factory *factory) {}
diff --git a/src/core/client_config/lb_policies/round_robin.h b/src/core/lib/client_config/lb_policies/round_robin.h
index 7e6f1769e4..52db1caa0c 100644
--- a/src/core/client_config/lb_policies/round_robin.h
+++ b/src/core/lib/client_config/lb_policies/round_robin.h
@@ -31,16 +31,16 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_ROUND_ROBIN_H
-#define GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_ROUND_ROBIN_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_ROUND_ROBIN_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_ROUND_ROBIN_H
-#include "src/core/client_config/lb_policy.h"
+#include "src/core/lib/client_config/lb_policy.h"
extern int grpc_lb_round_robin_trace;
-#include "src/core/client_config/lb_policy_factory.h"
+#include "src/core/lib/client_config/lb_policy_factory.h"
/** Returns a load balancing factory for the round robin policy */
grpc_lb_policy_factory *grpc_round_robin_lb_factory_create();
-#endif /* GRPC_CORE_CLIENT_CONFIG_LB_POLICIES_ROUND_ROBIN_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICIES_ROUND_ROBIN_H */
diff --git a/src/core/client_config/lb_policy.c b/src/core/lib/client_config/lb_policy.c
index d67505e618..8e6c70f86e 100644
--- a/src/core/client_config/lb_policy.c
+++ b/src/core/lib/client_config/lb_policy.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/lb_policy.h"
+#include "src/core/lib/client_config/lb_policy.h"
#define WEAK_REF_BITS 16
diff --git a/src/core/client_config/lb_policy.h b/src/core/lib/client_config/lb_policy.h
index e5aec52e7a..4762567423 100644
--- a/src/core/client_config/lb_policy.h
+++ b/src/core/lib/client_config/lb_policy.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_LB_POLICY_H
-#define GRPC_CORE_CLIENT_CONFIG_LB_POLICY_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_H
-#include "src/core/client_config/subchannel.h"
-#include "src/core/transport/connectivity_state.h"
+#include "src/core/lib/client_config/subchannel.h"
+#include "src/core/lib/transport/connectivity_state.h"
/** A load balancing policy: specified by a vtable and a struct (which
is expected to be extended to contain some parameters) */
@@ -154,4 +154,4 @@ void grpc_lb_policy_notify_on_state_change(grpc_exec_ctx *exec_ctx,
grpc_connectivity_state grpc_lb_policy_check_connectivity(
grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy);
-#endif /* GRPC_CORE_CLIENT_CONFIG_LB_POLICY_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_H */
diff --git a/src/core/client_config/lb_policy_factory.c b/src/core/lib/client_config/lb_policy_factory.c
index e49de544e3..2ca6f42f89 100644
--- a/src/core/client_config/lb_policy_factory.c
+++ b/src/core/lib/client_config/lb_policy_factory.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/lb_policy_factory.h"
+#include "src/core/lib/client_config/lb_policy_factory.h"
void grpc_lb_policy_factory_ref(grpc_lb_policy_factory* factory) {
factory->vtable->ref(factory);
diff --git a/src/core/client_config/lb_policy_factory.h b/src/core/lib/client_config/lb_policy_factory.h
index 842ba96098..36eaf178d9 100644
--- a/src/core/client_config/lb_policy_factory.h
+++ b/src/core/lib/client_config/lb_policy_factory.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_LB_POLICY_FACTORY_H
-#define GRPC_CORE_CLIENT_CONFIG_LB_POLICY_FACTORY_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_FACTORY_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_FACTORY_H
-#include "src/core/client_config/lb_policy.h"
-#include "src/core/client_config/subchannel.h"
+#include "src/core/lib/client_config/lb_policy.h"
+#include "src/core/lib/client_config/subchannel.h"
typedef struct grpc_lb_policy_factory grpc_lb_policy_factory;
typedef struct grpc_lb_policy_factory_vtable grpc_lb_policy_factory_vtable;
@@ -70,4 +70,4 @@ void grpc_lb_policy_factory_unref(grpc_lb_policy_factory *factory);
grpc_lb_policy *grpc_lb_policy_factory_create_lb_policy(
grpc_lb_policy_factory *factory, grpc_lb_policy_args *args);
-#endif /* GRPC_CORE_CLIENT_CONFIG_LB_POLICY_FACTORY_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_FACTORY_H */
diff --git a/src/core/client_config/lb_policy_registry.c b/src/core/lib/client_config/lb_policy_registry.c
index fc302e82d7..13acfe78cd 100644
--- a/src/core/client_config/lb_policy_registry.c
+++ b/src/core/lib/client_config/lb_policy_registry.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/lb_policy_registry.h"
+#include "src/core/lib/client_config/lb_policy_registry.h"
#include <string.h>
diff --git a/src/core/client_config/lb_policy_registry.h b/src/core/lib/client_config/lb_policy_registry.h
index f3a08a3558..c251fd9f08 100644
--- a/src/core/client_config/lb_policy_registry.h
+++ b/src/core/lib/client_config/lb_policy_registry.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_LB_POLICY_REGISTRY_H
-#define GRPC_CORE_CLIENT_CONFIG_LB_POLICY_REGISTRY_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_REGISTRY_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_REGISTRY_H
-#include "src/core/client_config/lb_policy_factory.h"
+#include "src/core/lib/client_config/lb_policy_factory.h"
/** Initialize the registry and set \a default_factory as the factory to be
* returned when no name is provided in a lookup */
@@ -51,4 +51,4 @@ void grpc_register_lb_policy(grpc_lb_policy_factory *factory);
grpc_lb_policy *grpc_lb_policy_create(const char *name,
grpc_lb_policy_args *args);
-#endif /* GRPC_CORE_CLIENT_CONFIG_LB_POLICY_REGISTRY_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_REGISTRY_H */
diff --git a/src/core/client_config/resolver.c b/src/core/lib/client_config/resolver.c
index eda01e72ba..32f0643adb 100644
--- a/src/core/client_config/resolver.c
+++ b/src/core/lib/client_config/resolver.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/resolver.h"
+#include "src/core/lib/client_config/resolver.h"
void grpc_resolver_init(grpc_resolver *resolver,
const grpc_resolver_vtable *vtable) {
diff --git a/src/core/client_config/resolver.h b/src/core/lib/client_config/resolver.h
index 96f88fef84..1ee879293a 100644
--- a/src/core/client_config/resolver.h
+++ b/src/core/lib/client_config/resolver.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_RESOLVER_H
-#define GRPC_CORE_CLIENT_CONFIG_RESOLVER_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_H
-#include "src/core/client_config/client_config.h"
-#include "src/core/client_config/subchannel.h"
-#include "src/core/iomgr/iomgr.h"
+#include "src/core/lib/client_config/client_config.h"
+#include "src/core/lib/client_config/subchannel.h"
+#include "src/core/lib/iomgr/iomgr.h"
typedef struct grpc_resolver grpc_resolver;
typedef struct grpc_resolver_vtable grpc_resolver_vtable;
@@ -91,4 +91,4 @@ void grpc_resolver_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
grpc_client_config **target_config,
grpc_closure *on_complete);
-#endif /* GRPC_CORE_CLIENT_CONFIG_RESOLVER_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_H */
diff --git a/src/core/client_config/resolver_factory.c b/src/core/lib/client_config/resolver_factory.c
index e7e9196ac4..0f76c664fa 100644
--- a/src/core/client_config/resolver_factory.c
+++ b/src/core/lib/client_config/resolver_factory.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/resolver_factory.h"
+#include "src/core/lib/client_config/resolver_factory.h"
void grpc_resolver_factory_ref(grpc_resolver_factory* factory) {
factory->vtable->ref(factory);
diff --git a/src/core/client_config/resolver_factory.h b/src/core/lib/client_config/resolver_factory.h
index 477f8db7f7..7765c3c844 100644
--- a/src/core/client_config/resolver_factory.h
+++ b/src/core/lib/client_config/resolver_factory.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_RESOLVER_FACTORY_H
-#define GRPC_CORE_CLIENT_CONFIG_RESOLVER_FACTORY_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_FACTORY_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_FACTORY_H
-#include "src/core/client_config/resolver.h"
-#include "src/core/client_config/subchannel_factory.h"
-#include "src/core/client_config/uri_parser.h"
+#include "src/core/lib/client_config/resolver.h"
+#include "src/core/lib/client_config/subchannel_factory.h"
+#include "src/core/lib/client_config/uri_parser.h"
typedef struct grpc_resolver_factory grpc_resolver_factory;
typedef struct grpc_resolver_factory_vtable grpc_resolver_factory_vtable;
@@ -79,4 +79,4 @@ grpc_resolver *grpc_resolver_factory_create_resolver(
char *grpc_resolver_factory_get_default_authority(
grpc_resolver_factory *factory, grpc_uri *uri);
-#endif /* GRPC_CORE_CLIENT_CONFIG_RESOLVER_FACTORY_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_FACTORY_H */
diff --git a/src/core/client_config/resolver_registry.c b/src/core/lib/client_config/resolver_registry.c
index 89a945c2d3..29bd00c284 100644
--- a/src/core/client_config/resolver_registry.c
+++ b/src/core/lib/client_config/resolver_registry.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/resolver_registry.h"
+#include "src/core/lib/client_config/resolver_registry.h"
#include <string.h>
diff --git a/src/core/client_config/resolver_registry.h b/src/core/lib/client_config/resolver_registry.h
index 1e4cebee0b..22289ca6bd 100644
--- a/src/core/client_config/resolver_registry.h
+++ b/src/core/lib/client_config/resolver_registry.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_RESOLVER_REGISTRY_H
-#define GRPC_CORE_CLIENT_CONFIG_RESOLVER_REGISTRY_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_REGISTRY_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_REGISTRY_H
-#include "src/core/client_config/resolver_factory.h"
+#include "src/core/lib/client_config/resolver_factory.h"
void grpc_resolver_registry_init(const char *default_prefix);
void grpc_resolver_registry_shutdown(void);
@@ -62,4 +62,4 @@ grpc_resolver *grpc_resolver_create(
representing the default authority to pass from a client. */
char *grpc_get_default_authority(const char *target);
-#endif /* GRPC_CORE_CLIENT_CONFIG_RESOLVER_REGISTRY_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_REGISTRY_H */
diff --git a/src/core/client_config/resolvers/dns_resolver.c b/src/core/lib/client_config/resolvers/dns_resolver.c
index e28e4757a1..ab445730ad 100644
--- a/src/core/client_config/resolvers/dns_resolver.c
+++ b/src/core/lib/client_config/resolvers/dns_resolver.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/resolvers/dns_resolver.h"
+#include "src/core/lib/client_config/resolvers/dns_resolver.h"
#include <string.h>
@@ -39,10 +39,16 @@
#include <grpc/support/host_port.h>
#include <grpc/support/string_util.h>
-#include "src/core/client_config/lb_policy_registry.h"
-#include "src/core/iomgr/resolve_address.h"
-#include "src/core/iomgr/timer.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/client_config/lb_policy_registry.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+#include "src/core/lib/iomgr/timer.h"
+#include "src/core/lib/support/backoff.h"
+#include "src/core/lib/support/string.h"
+
+#define BACKOFF_MULTIPLIER 1.6
+#define BACKOFF_JITTER 0.2
+#define BACKOFF_MIN_SECONDS 1
+#define BACKOFF_MAX_SECONDS 120
typedef struct {
/** base class: must be first */
@@ -75,6 +81,8 @@ typedef struct {
/** retry timer */
bool have_retry_timer;
grpc_timer retry_timer;
+ /** retry backoff state */
+ gpr_backoff backoff_state;
} dns_resolver;
static void dns_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *r);
@@ -111,6 +119,7 @@ static void dns_channel_saw_error(grpc_exec_ctx *exec_ctx,
dns_resolver *r = (dns_resolver *)resolver;
gpr_mu_lock(&r->mu);
if (!r->resolving) {
+ gpr_backoff_reset(&r->backoff_state);
dns_start_resolving_locked(r);
}
gpr_mu_unlock(&r->mu);
@@ -125,6 +134,7 @@ static void dns_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
r->next_completion = on_complete;
r->target_config = target_config;
if (r->resolved_version == 0 && !r->resolving) {
+ gpr_backoff_reset(&r->backoff_state);
dns_start_resolving_locked(r);
} else {
dns_maybe_finish_next_locked(exec_ctx, r);
@@ -185,17 +195,16 @@ static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
grpc_resolved_addresses_destroy(addresses);
gpr_free(subchannels);
} else {
- int retry_seconds = 15;
- gpr_log(GPR_DEBUG, "dns resolution failed: retrying in %d seconds",
- retry_seconds);
+ gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
+ gpr_timespec next_try = gpr_backoff_step(&r->backoff_state, now);
+ gpr_timespec timeout = gpr_time_sub(next_try, now);
+ gpr_log(GPR_DEBUG, "dns resolution failed: retrying in %d.%09d seconds",
+ timeout.tv_sec, timeout.tv_nsec);
GPR_ASSERT(!r->have_retry_timer);
r->have_retry_timer = true;
- gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
GRPC_RESOLVER_REF(&r->base, "retry-timer");
- grpc_timer_init(
- exec_ctx, &r->retry_timer,
- gpr_time_add(now, gpr_time_from_seconds(retry_seconds, GPR_TIMESPAN)),
- dns_on_retry_timer, r, now);
+ grpc_timer_init(exec_ctx, &r->retry_timer, next_try, dns_on_retry_timer, r,
+ now);
}
if (r->resolved_config) {
grpc_client_config_unref(exec_ctx, r->resolved_config);
@@ -263,6 +272,8 @@ static grpc_resolver *dns_create(grpc_resolver_args *args,
r->name = gpr_strdup(path);
r->default_port = gpr_strdup(default_port);
r->subchannel_factory = args->subchannel_factory;
+ gpr_backoff_init(&r->backoff_state, BACKOFF_MULTIPLIER, BACKOFF_JITTER,
+ BACKOFF_MIN_SECONDS * 1000, BACKOFF_MAX_SECONDS * 1000);
grpc_subchannel_factory_ref(r->subchannel_factory);
r->lb_policy_name = gpr_strdup(lb_policy_name);
return &r->base;
diff --git a/src/core/client_config/resolvers/dns_resolver.h b/src/core/lib/client_config/resolvers/dns_resolver.h
index b24280b507..eb46e41c77 100644
--- a/src/core/client_config/resolvers/dns_resolver.h
+++ b/src/core/lib/client_config/resolvers/dns_resolver.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_RESOLVERS_DNS_RESOLVER_H
-#define GRPC_CORE_CLIENT_CONFIG_RESOLVERS_DNS_RESOLVER_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVERS_DNS_RESOLVER_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVERS_DNS_RESOLVER_H
-#include "src/core/client_config/resolver_factory.h"
+#include "src/core/lib/client_config/resolver_factory.h"
/** Create a dns resolver factory */
grpc_resolver_factory *grpc_dns_resolver_factory_create(void);
-#endif /* GRPC_CORE_CLIENT_CONFIG_RESOLVERS_DNS_RESOLVER_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVERS_DNS_RESOLVER_H */
diff --git a/src/core/client_config/resolvers/sockaddr_resolver.c b/src/core/lib/client_config/resolvers/sockaddr_resolver.c
index 68910ad975..66cddc3ed9 100644
--- a/src/core/client_config/resolvers/sockaddr_resolver.c
+++ b/src/core/lib/client_config/resolvers/sockaddr_resolver.c
@@ -33,21 +33,19 @@
#include <grpc/support/port_platform.h>
-#include "src/core/client_config/resolvers/sockaddr_resolver.h"
+#include "src/core/lib/client_config/resolvers/sockaddr_resolver.h"
#include <stdio.h>
#include <string.h>
-#ifdef GPR_POSIX_SOCKET
-#include <sys/un.h>
-#endif
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/string_util.h>
-#include "src/core/client_config/lb_policy_registry.h"
-#include "src/core/iomgr/resolve_address.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/client_config/lb_policy_registry.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+#include "src/core/lib/iomgr/unix_sockets_posix.h"
+#include "src/core/lib/support/string.h"
typedef struct {
/** base class: must be first */
@@ -168,24 +166,6 @@ static void sockaddr_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *gr) {
gpr_free(r);
}
-#ifdef GPR_POSIX_SOCKET
-static int parse_unix(grpc_uri *uri, struct sockaddr_storage *addr,
- size_t *len) {
- struct sockaddr_un *un = (struct sockaddr_un *)addr;
-
- un->sun_family = AF_UNIX;
- strcpy(un->sun_path, uri->path);
- *len = strlen(un->sun_path) + sizeof(un->sun_family) + 1;
-
- return 1;
-}
-
-static char *unix_get_default_authority(grpc_resolver_factory *factory,
- grpc_uri *uri) {
- return gpr_strdup("localhost");
-}
-#endif
-
static char *ip_get_default_authority(grpc_uri *uri) {
const char *path = uri->path;
if (path[0] == '/') ++path;
@@ -371,21 +351,22 @@ static void sockaddr_factory_ref(grpc_resolver_factory *factory) {}
static void sockaddr_factory_unref(grpc_resolver_factory *factory) {}
-#define DECL_FACTORY(name) \
+#define DECL_FACTORY(name, prefix) \
static grpc_resolver *name##_factory_create_resolver( \
grpc_resolver_factory *factory, grpc_resolver_args *args) { \
- return sockaddr_create(args, "pick_first", parse_##name); \
+ return sockaddr_create(args, "pick_first", prefix##parse_##name); \
} \
static const grpc_resolver_factory_vtable name##_factory_vtable = { \
sockaddr_factory_ref, sockaddr_factory_unref, \
- name##_factory_create_resolver, name##_get_default_authority, #name}; \
+ name##_factory_create_resolver, prefix##name##_get_default_authority, \
+ #name}; \
static grpc_resolver_factory name##_resolver_factory = { \
&name##_factory_vtable}; \
grpc_resolver_factory *grpc_##name##_resolver_factory_create() { \
return &name##_resolver_factory; \
}
-#ifdef GPR_POSIX_SOCKET
-DECL_FACTORY(unix)
+#ifdef GPR_HAVE_UNIX_SOCKET
+DECL_FACTORY(unix, grpc_)
#endif
-DECL_FACTORY(ipv4) DECL_FACTORY(ipv6)
+DECL_FACTORY(ipv4, ) DECL_FACTORY(ipv6, )
diff --git a/src/core/client_config/resolvers/sockaddr_resolver.h b/src/core/lib/client_config/resolvers/sockaddr_resolver.h
index f050329431..45c55bd160 100644
--- a/src/core/client_config/resolvers/sockaddr_resolver.h
+++ b/src/core/lib/client_config/resolvers/sockaddr_resolver.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_RESOLVERS_SOCKADDR_RESOLVER_H
-#define GRPC_CORE_CLIENT_CONFIG_RESOLVERS_SOCKADDR_RESOLVER_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVERS_SOCKADDR_RESOLVER_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVERS_SOCKADDR_RESOLVER_H
#include <grpc/support/port_platform.h>
-#include "src/core/client_config/resolver_factory.h"
+#include "src/core/lib/client_config/resolver_factory.h"
grpc_resolver_factory *grpc_ipv4_resolver_factory_create(void);
@@ -47,4 +47,4 @@ grpc_resolver_factory *grpc_ipv6_resolver_factory_create(void);
grpc_resolver_factory *grpc_unix_resolver_factory_create(void);
#endif
-#endif /* GRPC_CORE_CLIENT_CONFIG_RESOLVERS_SOCKADDR_RESOLVER_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVERS_SOCKADDR_RESOLVER_H */
diff --git a/src/core/client_config/resolvers/zookeeper_resolver.c b/src/core/lib/client_config/resolvers/zookeeper_resolver.c
index 166738e768..3bb0bbdf5c 100644
--- a/src/core/client_config/resolvers/zookeeper_resolver.c
+++ b/src/core/lib/client_config/resolvers/zookeeper_resolver.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/resolvers/zookeeper_resolver.h"
+#include "src/core/lib/client_config/resolvers/zookeeper_resolver.h"
#include <string.h>
@@ -41,12 +41,12 @@
#include <grpc/grpc_zookeeper.h>
#include <zookeeper/zookeeper.h>
-#include "src/core/client_config/lb_policy_registry.h"
-#include "src/core/client_config/resolver_registry.h"
-#include "src/core/iomgr/resolve_address.h"
-#include "src/core/support/string.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/json/json.h"
+#include "src/core/lib/client_config/lb_policy_registry.h"
+#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+#include "src/core/lib/json/json.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/surface/api_trace.h"
/** Zookeeper session expiration time in milliseconds */
#define GRPC_ZOOKEEPER_SESSION_TIMEOUT 15000
diff --git a/src/core/client_config/resolvers/zookeeper_resolver.h b/src/core/lib/client_config/resolvers/zookeeper_resolver.h
index 04bd3ca875..7ee7604360 100644
--- a/src/core/client_config/resolvers/zookeeper_resolver.h
+++ b/src/core/lib/client_config/resolvers/zookeeper_resolver.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_RESOLVERS_ZOOKEEPER_RESOLVER_H
-#define GRPC_CORE_CLIENT_CONFIG_RESOLVERS_ZOOKEEPER_RESOLVER_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVERS_ZOOKEEPER_RESOLVER_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVERS_ZOOKEEPER_RESOLVER_H
-#include "src/core/client_config/resolver_factory.h"
+#include "src/core/lib/client_config/resolver_factory.h"
/** Create a zookeeper resolver factory */
grpc_resolver_factory *grpc_zookeeper_resolver_factory_create(void);
-#endif /* GRPC_CORE_CLIENT_CONFIG_RESOLVERS_ZOOKEEPER_RESOLVER_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVERS_ZOOKEEPER_RESOLVER_H */
diff --git a/src/core/client_config/subchannel.c b/src/core/lib/client_config/subchannel.c
index 8f150a8d81..41242f0dd7 100644
--- a/src/core/client_config/subchannel.c
+++ b/src/core/lib/client_config/subchannel.c
@@ -31,24 +31,24 @@
*
*/
-#include "src/core/client_config/subchannel.h"
+#include "src/core/lib/client_config/subchannel.h"
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/avl.h>
-#include "src/core/channel/channel_args.h"
-#include "src/core/channel/client_channel.h"
-#include "src/core/channel/connected_channel.h"
-#include "src/core/client_config/initial_connect_string.h"
-#include "src/core/client_config/subchannel_index.h"
-#include "src/core/iomgr/timer.h"
-#include "src/core/profiling/timers.h"
-#include "src/core/support/backoff.h"
-#include "src/core/surface/channel.h"
-#include "src/core/surface/channel_init.h"
-#include "src/core/transport/connectivity_state.h"
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/channel/client_channel.h"
+#include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/client_config/initial_connect_string.h"
+#include "src/core/lib/client_config/subchannel_index.h"
+#include "src/core/lib/iomgr/timer.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/support/backoff.h"
+#include "src/core/lib/surface/channel.h"
+#include "src/core/lib/surface/channel_init.h"
+#include "src/core/lib/transport/connectivity_state.h"
#define INTERNAL_REF_BITS 16
#define STRONG_REF_MASK (~(gpr_atm)((1 << INTERNAL_REF_BITS) - 1))
@@ -185,8 +185,8 @@ static void connection_destroy(grpc_exec_ctx *exec_ctx, void *arg,
gpr_free(c);
}
-void grpc_connected_subchannel_ref(grpc_connected_subchannel *c
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
+void grpc_connected_subchannel_ref(
+ grpc_connected_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
GRPC_CHANNEL_STACK_REF(CHANNEL_STACK_FROM_CONNECTION(c), REF_REASON);
}
@@ -227,8 +227,8 @@ static gpr_atm ref_mutate(grpc_subchannel *c, gpr_atm delta,
return old_val;
}
-grpc_subchannel *grpc_subchannel_ref(grpc_subchannel *c
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
+grpc_subchannel *grpc_subchannel_ref(
+ grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
gpr_atm old_refs;
old_refs = ref_mutate(c, (1 << INTERNAL_REF_BITS),
0 REF_MUTATE_PURPOSE("STRONG_REF"));
@@ -236,8 +236,8 @@ grpc_subchannel *grpc_subchannel_ref(grpc_subchannel *c
return c;
}
-grpc_subchannel *grpc_subchannel_weak_ref(grpc_subchannel *c
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
+grpc_subchannel *grpc_subchannel_weak_ref(
+ grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
gpr_atm old_refs;
old_refs = ref_mutate(c, 1, 0 REF_MUTATE_PURPOSE("WEAK_REF"));
GPR_ASSERT(old_refs != 0);
@@ -626,8 +626,8 @@ static void subchannel_call_destroy(grpc_exec_ctx *exec_ctx, void *call,
GPR_TIMER_END("grpc_subchannel_call_unref.destroy", 0);
}
-void grpc_subchannel_call_ref(grpc_subchannel_call *c
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
+void grpc_subchannel_call_ref(
+ grpc_subchannel_call *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
GRPC_CALL_STACK_REF(SUBCHANNEL_CALL_TO_CALL_STACK(c), REF_REASON);
}
diff --git a/src/core/client_config/subchannel.h b/src/core/lib/client_config/subchannel.h
index ef9f2f1d1e..b4f545be52 100644
--- a/src/core/client_config/subchannel.h
+++ b/src/core/lib/client_config/subchannel.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_H
-#define GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_H
-#include "src/core/channel/channel_stack.h"
-#include "src/core/client_config/connector.h"
-#include "src/core/transport/connectivity_state.h"
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/client_config/connector.h"
+#include "src/core/lib/transport/connectivity_state.h"
/** A (sub-)channel that knows how to connect to exactly one target
address. Provides a target for load balancing. */
@@ -83,25 +83,25 @@ typedef struct grpc_subchannel_args grpc_subchannel_args;
#define GRPC_SUBCHANNEL_REF_EXTRA_ARGS
#endif
-grpc_subchannel *grpc_subchannel_ref(grpc_subchannel *channel
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
+grpc_subchannel *grpc_subchannel_ref(
+ grpc_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
grpc_subchannel *grpc_subchannel_ref_from_weak_ref(
grpc_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
void grpc_subchannel_unref(grpc_exec_ctx *exec_ctx,
grpc_subchannel *channel
GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
-grpc_subchannel *grpc_subchannel_weak_ref(grpc_subchannel *channel
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
+grpc_subchannel *grpc_subchannel_weak_ref(
+ grpc_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
void grpc_subchannel_weak_unref(grpc_exec_ctx *exec_ctx,
grpc_subchannel *channel
GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
-void grpc_connected_subchannel_ref(grpc_connected_subchannel *channel
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
+void grpc_connected_subchannel_ref(
+ grpc_connected_subchannel *channel GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
void grpc_connected_subchannel_unref(grpc_exec_ctx *exec_ctx,
grpc_connected_subchannel *channel
GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
-void grpc_subchannel_call_ref(grpc_subchannel_call *call
- GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
+void grpc_subchannel_call_ref(
+ grpc_subchannel_call *call GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
void grpc_subchannel_call_unref(grpc_exec_ctx *exec_ctx,
grpc_subchannel_call *call
GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
@@ -171,4 +171,4 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx,
grpc_connector *connector,
grpc_subchannel_args *args);
-#endif /* GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_H */
diff --git a/src/core/client_config/subchannel_factory.c b/src/core/lib/client_config/subchannel_factory.c
index 2c64219e8b..727a48a6c8 100644
--- a/src/core/client_config/subchannel_factory.c
+++ b/src/core/lib/client_config/subchannel_factory.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/subchannel_factory.h"
+#include "src/core/lib/client_config/subchannel_factory.h"
void grpc_subchannel_factory_ref(grpc_subchannel_factory* factory) {
factory->vtable->ref(factory);
diff --git a/src/core/client_config/subchannel_factory.h b/src/core/lib/client_config/subchannel_factory.h
index c638f377a6..3ba2f860fe 100644
--- a/src/core/client_config/subchannel_factory.h
+++ b/src/core/lib/client_config/subchannel_factory.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
-#define GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
-#include "src/core/channel/channel_stack.h"
-#include "src/core/client_config/subchannel.h"
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/client_config/subchannel.h"
typedef struct grpc_subchannel_factory grpc_subchannel_factory;
typedef struct grpc_subchannel_factory_vtable grpc_subchannel_factory_vtable;
@@ -63,4 +63,4 @@ grpc_subchannel *grpc_subchannel_factory_create_subchannel(
grpc_exec_ctx *exec_ctx, grpc_subchannel_factory *factory,
grpc_subchannel_args *args);
-#endif /* GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H */
diff --git a/src/core/client_config/subchannel_index.c b/src/core/lib/client_config/subchannel_index.c
index 24cc76cf22..2c545002a2 100644
--- a/src/core/client_config/subchannel_index.c
+++ b/src/core/lib/client_config/subchannel_index.c
@@ -31,7 +31,7 @@
//
//
-#include "src/core/client_config/subchannel_index.h"
+#include "src/core/lib/client_config/subchannel_index.h"
#include <stdbool.h>
#include <string.h>
@@ -40,7 +40,7 @@
#include <grpc/support/avl.h>
#include <grpc/support/tls.h>
-#include "src/core/channel/channel_args.h"
+#include "src/core/lib/channel/channel_args.h"
// a map of subchannel_key --> subchannel, used for detecting connections
// to the same destination in order to share them
diff --git a/src/core/client_config/subchannel_index.h b/src/core/lib/client_config/subchannel_index.h
index 3cd5d12349..bc5f03beb4 100644
--- a/src/core/client_config/subchannel_index.h
+++ b/src/core/lib/client_config/subchannel_index.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_INDEX_H
-#define GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_INDEX_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_INDEX_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_INDEX_H
-#include "src/core/client_config/connector.h"
-#include "src/core/client_config/subchannel.h"
+#include "src/core/lib/client_config/connector.h"
+#include "src/core/lib/client_config/subchannel.h"
/** \file Provides an index of active subchannels so that they can be
shared amongst channels */
@@ -74,4 +74,4 @@ void grpc_subchannel_index_init(void);
/** Shutdown the subchannel index (global) */
void grpc_subchannel_index_shutdown(void);
-#endif /* GRPC_CORE_CLIENT_CONFIG_SUBCHANNEL_INDEX_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_INDEX_H */
diff --git a/src/core/client_config/uri_parser.c b/src/core/lib/client_config/uri_parser.c
index cbdfffcf8e..d3228dec5f 100644
--- a/src/core/client_config/uri_parser.c
+++ b/src/core/lib/client_config/uri_parser.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/client_config/uri_parser.h"
+#include "src/core/lib/client_config/uri_parser.h"
#include <string.h>
diff --git a/src/core/client_config/uri_parser.h b/src/core/lib/client_config/uri_parser.h
index af013d8cac..d70d451e60 100644
--- a/src/core/client_config/uri_parser.h
+++ b/src/core/lib/client_config/uri_parser.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_CLIENT_CONFIG_URI_PARSER_H
-#define GRPC_CORE_CLIENT_CONFIG_URI_PARSER_H
+#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_URI_PARSER_H
+#define GRPC_CORE_LIB_CLIENT_CONFIG_URI_PARSER_H
typedef struct {
char *scheme;
@@ -48,4 +48,4 @@ grpc_uri *grpc_uri_parse(const char *uri_text, int suppress_errors);
/** destroy a uri */
void grpc_uri_destroy(grpc_uri *uri);
-#endif /* GRPC_CORE_CLIENT_CONFIG_URI_PARSER_H */
+#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_URI_PARSER_H */
diff --git a/src/core/compression/algorithm_metadata.h b/src/core/lib/compression/algorithm_metadata.h
index 34abf1dba2..47f33abdc7 100644
--- a/src/core/compression/algorithm_metadata.h
+++ b/src/core/lib/compression/algorithm_metadata.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_COMPRESSION_ALGORITHM_METADATA_H
-#define GRPC_CORE_COMPRESSION_ALGORITHM_METADATA_H
+#ifndef GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H
+#define GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H
#include <grpc/compression.h>
-#include "src/core/transport/metadata.h"
+#include "src/core/lib/transport/metadata.h"
/** Return compression algorithm based metadata value */
grpc_mdstr *grpc_compression_algorithm_mdstr(
@@ -50,4 +50,4 @@ grpc_mdelem *grpc_compression_encoding_mdelem(
grpc_compression_algorithm grpc_compression_algorithm_from_mdstr(
grpc_mdstr *str);
-#endif /* GRPC_CORE_COMPRESSION_ALGORITHM_METADATA_H */
+#endif /* GRPC_CORE_LIB_COMPRESSION_ALGORITHM_METADATA_H */
diff --git a/src/core/compression/compression_algorithm.c b/src/core/lib/compression/compression_algorithm.c
index 2810a38b68..f781b45042 100644
--- a/src/core/compression/compression_algorithm.c
+++ b/src/core/lib/compression/compression_algorithm.c
@@ -37,9 +37,9 @@
#include <grpc/compression.h>
#include <grpc/support/useful.h>
-#include "src/core/compression/algorithm_metadata.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/transport/static_metadata.h"
+#include "src/core/lib/compression/algorithm_metadata.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/transport/static_metadata.h"
int grpc_compression_algorithm_parse(const char *name, size_t name_length,
grpc_compression_algorithm *algorithm) {
diff --git a/src/core/compression/message_compress.c b/src/core/lib/compression/message_compress.c
index edc21a9eb7..b4b6a2d75e 100644
--- a/src/core/compression/message_compress.c
+++ b/src/core/lib/compression/message_compress.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/compression/message_compress.h"
+#include "src/core/lib/compression/message_compress.h"
#include <string.h>
diff --git a/src/core/compression/message_compress.h b/src/core/lib/compression/message_compress.h
index 20b78c063b..b71608139e 100644
--- a/src/core/compression/message_compress.h
+++ b/src/core/lib/compression/message_compress.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_COMPRESSION_MESSAGE_COMPRESS_H
-#define GRPC_CORE_COMPRESSION_MESSAGE_COMPRESS_H
+#ifndef GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H
+#define GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H
#include <grpc/compression.h>
#include <grpc/support/slice_buffer.h>
@@ -49,4 +49,4 @@ int grpc_msg_compress(grpc_compression_algorithm algorithm,
int grpc_msg_decompress(grpc_compression_algorithm algorithm,
gpr_slice_buffer* input, gpr_slice_buffer* output);
-#endif /* GRPC_CORE_COMPRESSION_MESSAGE_COMPRESS_H */
+#endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */
diff --git a/src/core/debug/trace.c b/src/core/lib/debug/trace.c
index 3b35d81cd8..786dd9324f 100644
--- a/src/core/debug/trace.c
+++ b/src/core/lib/debug/trace.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,14 +31,14 @@
*
*/
-#include "src/core/debug/trace.h"
+#include "src/core/lib/debug/trace.h"
#include <string.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/support/env.h"
+#include "src/core/lib/support/env.h"
typedef struct tracer {
const char *name;
diff --git a/src/core/debug/trace.h b/src/core/lib/debug/trace.h
index 91ec14052e..76ea5a7c64 100644
--- a/src/core/debug/trace.h
+++ b/src/core/lib/debug/trace.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_DEBUG_TRACE_H
-#define GRPC_CORE_DEBUG_TRACE_H
+#ifndef GRPC_CORE_LIB_DEBUG_TRACE_H
+#define GRPC_CORE_LIB_DEBUG_TRACE_H
#include <grpc/support/port_platform.h>
@@ -40,4 +40,4 @@ void grpc_register_tracer(const char *name, int *flag);
void grpc_tracer_init(const char *env_var_name);
void grpc_tracer_shutdown(void);
-#endif /* GRPC_CORE_DEBUG_TRACE_H */
+#endif /* GRPC_CORE_LIB_DEBUG_TRACE_H */
diff --git a/src/core/httpcli/format_request.c b/src/core/lib/http/format_request.c
index 04f2a2d99a..95b3918646 100644
--- a/src/core/httpcli/format_request.c
+++ b/src/core/lib/http/format_request.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,22 +31,22 @@
*
*/
-#include "src/core/httpcli/format_request.h"
+#include "src/core/lib/http/format_request.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/slice.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
+#include "src/core/lib/support/string.h"
static void fill_common_header(const grpc_httpcli_request *request,
gpr_strvec *buf) {
size_t i;
- gpr_strvec_add(buf, gpr_strdup(request->path));
+ gpr_strvec_add(buf, gpr_strdup(request->http.path));
gpr_strvec_add(buf, gpr_strdup(" HTTP/1.0\r\n"));
/* just in case some crazy server really expects HTTP/1.1 */
gpr_strvec_add(buf, gpr_strdup("Host: "));
@@ -56,10 +56,10 @@ static void fill_common_header(const grpc_httpcli_request *request,
gpr_strvec_add(buf,
gpr_strdup("User-Agent: " GRPC_HTTPCLI_USER_AGENT "\r\n"));
/* user supplied headers */
- for (i = 0; i < request->hdr_count; i++) {
- gpr_strvec_add(buf, gpr_strdup(request->hdrs[i].key));
+ for (i = 0; i < request->http.hdr_count; i++) {
+ gpr_strvec_add(buf, gpr_strdup(request->http.hdrs[i].key));
gpr_strvec_add(buf, gpr_strdup(": "));
- gpr_strvec_add(buf, gpr_strdup(request->hdrs[i].value));
+ gpr_strvec_add(buf, gpr_strdup(request->http.hdrs[i].value));
gpr_strvec_add(buf, gpr_strdup("\r\n"));
}
}
@@ -94,8 +94,8 @@ gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
fill_common_header(request, &out);
if (body_bytes) {
uint8_t has_content_type = 0;
- for (i = 0; i < request->hdr_count; i++) {
- if (strcmp(request->hdrs[i].key, "Content-Type") == 0) {
+ for (i = 0; i < request->http.hdr_count; i++) {
+ if (strcmp(request->http.hdrs[i].key, "Content-Type") == 0) {
has_content_type = 1;
break;
}
diff --git a/src/core/httpcli/format_request.h b/src/core/lib/http/format_request.h
index eb47cc90ca..2e933d804b 100644
--- a/src/core/httpcli/format_request.h
+++ b/src/core/lib/http/format_request.h
@@ -31,15 +31,15 @@
*
*/
-#ifndef GRPC_CORE_HTTPCLI_FORMAT_REQUEST_H
-#define GRPC_CORE_HTTPCLI_FORMAT_REQUEST_H
+#ifndef GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H
+#define GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H
-#include "src/core/httpcli/httpcli.h"
#include <grpc/support/slice.h>
+#include "src/core/lib/http/httpcli.h"
gpr_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request);
gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
const char *body_bytes,
size_t body_size);
-#endif /* GRPC_CORE_HTTPCLI_FORMAT_REQUEST_H */
+#endif /* GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H */
diff --git a/src/core/httpcli/httpcli.c b/src/core/lib/http/httpcli.c
index 1219c444c7..aab28ad8b6 100644
--- a/src/core/httpcli/httpcli.c
+++ b/src/core/lib/http/httpcli.c
@@ -31,8 +31,8 @@
*
*/
-#include "src/core/httpcli/httpcli.h"
-#include "src/core/iomgr/sockaddr.h"
+#include "src/core/lib/http/httpcli.h"
+#include "src/core/lib/iomgr/sockaddr.h"
#include <string.h>
@@ -40,17 +40,17 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-#include "src/core/httpcli/format_request.h"
-#include "src/core/httpcli/parser.h"
-#include "src/core/iomgr/endpoint.h"
-#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/resolve_address.h"
-#include "src/core/iomgr/tcp_client.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/http/format_request.h"
+#include "src/core/lib/http/parser.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+#include "src/core/lib/iomgr/tcp_client.h"
+#include "src/core/lib/support/string.h"
typedef struct {
gpr_slice request_text;
- grpc_httpcli_parser parser;
+ grpc_http_parser parser;
grpc_resolved_addresses *addresses;
size_t next_address;
grpc_endpoint *ep;
@@ -99,8 +99,9 @@ static void finish(grpc_exec_ctx *exec_ctx, internal_request *req,
int success) {
grpc_pollset_set_del_pollset(exec_ctx, req->context->pollset_set,
req->pollset);
- req->on_response(exec_ctx, req->user_data, success ? &req->parser.r : NULL);
- grpc_httpcli_parser_destroy(&req->parser);
+ req->on_response(exec_ctx, req->user_data,
+ success ? &req->parser.http.response : NULL);
+ grpc_http_parser_destroy(&req->parser);
if (req->addresses != NULL) {
grpc_resolved_addresses_destroy(req->addresses);
}
@@ -129,7 +130,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, bool success) {
for (i = 0; i < req->incoming.count; i++) {
if (GPR_SLICE_LENGTH(req->incoming.slices[i])) {
req->have_read_byte = 1;
- if (!grpc_httpcli_parser_parse(&req->parser, req->incoming.slices[i])) {
+ if (!grpc_http_parser_parse(&req->parser, req->incoming.slices[i])) {
finish(exec_ctx, req, 0);
return;
}
@@ -141,7 +142,11 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data, bool success) {
} else if (!req->have_read_byte) {
next_address(exec_ctx, req);
} else {
- finish(exec_ctx, req, grpc_httpcli_parser_eof(&req->parser));
+ int parse_success = grpc_http_parser_eof(&req->parser);
+ if (parse_success && (req->parser.type != GRPC_HTTP_RESPONSE)) {
+ parse_success = 0;
+ }
+ finish(exec_ctx, req, parse_success);
}
}
@@ -223,7 +228,7 @@ static void internal_request_begin(
internal_request *req = gpr_malloc(sizeof(internal_request));
memset(req, 0, sizeof(*req));
req->request_text = request_text;
- grpc_httpcli_parser_init(&req->parser);
+ grpc_http_parser_init(&req->parser);
req->on_response = on_response;
req->user_data = user_data;
req->deadline = deadline;
@@ -255,7 +260,7 @@ void grpc_httpcli_get(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
g_get_override(exec_ctx, request, deadline, on_response, user_data)) {
return;
}
- gpr_asprintf(&name, "HTTP:GET:%s:%s", request->host, request->path);
+ gpr_asprintf(&name, "HTTP:GET:%s:%s", request->host, request->http.path);
internal_request_begin(exec_ctx, context, pollset, request, deadline,
on_response, user_data, name,
grpc_httpcli_format_get_request(request));
@@ -274,7 +279,7 @@ void grpc_httpcli_post(grpc_exec_ctx *exec_ctx, grpc_httpcli_context *context,
on_response, user_data)) {
return;
}
- gpr_asprintf(&name, "HTTP:POST:%s:%s", request->host, request->path);
+ gpr_asprintf(&name, "HTTP:POST:%s:%s", request->host, request->http.path);
internal_request_begin(
exec_ctx, context, pollset, request, deadline, on_response, user_data,
name, grpc_httpcli_format_post_request(request, body_bytes, body_size));
diff --git a/src/core/httpcli/httpcli.h b/src/core/lib/http/httpcli.h
index 1fe5782657..b8d54a8586 100644
--- a/src/core/httpcli/httpcli.h
+++ b/src/core/lib/http/httpcli.h
@@ -31,27 +31,20 @@
*
*/
-#ifndef GRPC_CORE_HTTPCLI_HTTPCLI_H
-#define GRPC_CORE_HTTPCLI_HTTPCLI_H
+#ifndef GRPC_CORE_LIB_HTTP_HTTPCLI_H
+#define GRPC_CORE_LIB_HTTP_HTTPCLI_H
#include <stddef.h>
#include <grpc/support/time.h>
-#include "src/core/iomgr/endpoint.h"
-#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/pollset_set.h"
+#include "src/core/lib/http/parser.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/pollset_set.h"
/* User agent this library reports */
#define GRPC_HTTPCLI_USER_AGENT "grpc-httpcli/0.0"
-/* Maximum length of a header string of the form 'Key: Value\r\n' */
-#define GRPC_HTTPCLI_MAX_HEADER_LENGTH 4096
-
-/* A single header to be passed in a request */
-typedef struct grpc_httpcli_header {
- char *key;
- char *value;
-} grpc_httpcli_header;
/* Tracks in-progress http requests
TODO(ctiller): allow caching and capturing multiple requests for the
@@ -77,33 +70,21 @@ typedef struct grpc_httpcli_request {
char *host;
/* The host to verify in the SSL handshake (or NULL) */
char *ssl_host_override;
- /* The path of the resource to fetch */
- char *path;
- /* Additional headers: count and key/values; the following are supplied
- automatically and MUST NOT be set here:
+ /* The main part of the request
+ The following headers are supplied automatically and MUST NOT be set here:
Host, Connection, User-Agent */
- size_t hdr_count;
- grpc_httpcli_header *hdrs;
+ grpc_http_request http;
/* handshaker to use ssl for the request */
const grpc_httpcli_handshaker *handshaker;
} grpc_httpcli_request;
-/* A response */
-typedef struct grpc_httpcli_response {
- /* HTTP status code */
- int status;
- /* Headers: count and key/values */
- size_t hdr_count;
- grpc_httpcli_header *hdrs;
- /* Body: length and contents; contents are NOT null-terminated */
- size_t body_length;
- char *body;
-} grpc_httpcli_response;
+/* Expose the parser response type as a httpcli response too */
+typedef struct grpc_http_response grpc_httpcli_response;
/* Callback for grpc_httpcli_get and grpc_httpcli_post. */
typedef void (*grpc_httpcli_response_cb)(grpc_exec_ctx *exec_ctx,
void *user_data,
- const grpc_httpcli_response *response);
+ const grpc_http_response *response);
void grpc_httpcli_context_init(grpc_httpcli_context *context);
void grpc_httpcli_context_destroy(grpc_httpcli_context *context);
@@ -160,4 +141,4 @@ typedef int (*grpc_httpcli_post_override)(
void grpc_httpcli_set_override(grpc_httpcli_get_override get,
grpc_httpcli_post_override post);
-#endif /* GRPC_CORE_HTTPCLI_HTTPCLI_H */
+#endif /* GRPC_CORE_LIB_HTTP_HTTPCLI_H */
diff --git a/src/core/httpcli/httpcli_security_connector.c b/src/core/lib/http/httpcli_security_connector.c
index 156961a377..6f1630ac1f 100644
--- a/src/core/httpcli/httpcli_security_connector.c
+++ b/src/core/lib/http/httpcli_security_connector.c
@@ -31,16 +31,16 @@
*
*/
-#include "src/core/httpcli/httpcli.h"
+#include "src/core/lib/http/httpcli.h"
#include <string.h>
-#include "src/core/security/handshake.h"
-#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-#include "src/core/tsi/ssl_transport_security.h"
+#include "src/core/lib/security/handshake.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/tsi/ssl_transport_security.h"
typedef struct {
grpc_channel_security_connector base;
diff --git a/src/core/lib/http/parser.c b/src/core/lib/http/parser.c
new file mode 100644
index 0000000000..5d4e304615
--- /dev/null
+++ b/src/core/lib/http/parser.c
@@ -0,0 +1,313 @@
+/*
+ *
+ * Copyright 2015-2016, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "src/core/lib/http/parser.h"
+
+#include <string.h>
+
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/useful.h>
+
+static char *buf2str(void *buffer, size_t length) {
+ char *out = gpr_malloc(length + 1);
+ memcpy(out, buffer, length);
+ out[length] = 0;
+ return out;
+}
+
+static int handle_response_line(grpc_http_parser *parser) {
+ uint8_t *beg = parser->cur_line;
+ uint8_t *cur = beg;
+ uint8_t *end = beg + parser->cur_line_length;
+
+ if (cur == end || *cur++ != 'H') goto error;
+ if (cur == end || *cur++ != 'T') goto error;
+ if (cur == end || *cur++ != 'T') goto error;
+ if (cur == end || *cur++ != 'P') goto error;
+ if (cur == end || *cur++ != '/') goto error;
+ if (cur == end || *cur++ != '1') goto error;
+ if (cur == end || *cur++ != '.') goto error;
+ if (cur == end || *cur < '0' || *cur++ > '1') goto error;
+ if (cur == end || *cur++ != ' ') goto error;
+ if (cur == end || *cur < '1' || *cur++ > '9') goto error;
+ if (cur == end || *cur < '0' || *cur++ > '9') goto error;
+ if (cur == end || *cur < '0' || *cur++ > '9') goto error;
+ parser->http.response.status =
+ (cur[-3] - '0') * 100 + (cur[-2] - '0') * 10 + (cur[-1] - '0');
+ if (cur == end || *cur++ != ' ') goto error;
+
+ /* we don't really care about the status code message */
+
+ return 1;
+
+error:
+ gpr_log(GPR_ERROR, "Failed parsing response line");
+ return 0;
+}
+
+static int handle_request_line(grpc_http_parser *parser) {
+ uint8_t *beg = parser->cur_line;
+ uint8_t *cur = beg;
+ uint8_t *end = beg + parser->cur_line_length;
+ uint8_t vers_major = 0;
+ uint8_t vers_minor = 0;
+
+ while (cur != end && *cur++ != ' ')
+ ;
+ if (cur == end) goto error;
+ parser->http.request.method = buf2str(beg, (size_t)(cur - beg - 1));
+
+ beg = cur;
+ while (cur != end && *cur++ != ' ')
+ ;
+ if (cur == end) goto error;
+ parser->http.request.path = buf2str(beg, (size_t)(cur - beg - 1));
+
+ if (cur == end || *cur++ != 'H') goto error;
+ if (cur == end || *cur++ != 'T') goto error;
+ if (cur == end || *cur++ != 'T') goto error;
+ if (cur == end || *cur++ != 'P') goto error;
+ if (cur == end || *cur++ != '/') goto error;
+ vers_major = (uint8_t)(*cur++ - '1' + 1);
+ ++cur;
+ if (cur == end) goto error;
+ vers_minor = (uint8_t)(*cur++ - '1' + 1);
+
+ if (vers_major == 1) {
+ if (vers_minor == 0) {
+ parser->http.request.version = GRPC_HTTP_HTTP10;
+ } else if (vers_minor == 1) {
+ parser->http.request.version = GRPC_HTTP_HTTP11;
+ } else {
+ goto error;
+ }
+ } else if (vers_major == 2) {
+ if (vers_minor == 0) {
+ parser->http.request.version = GRPC_HTTP_HTTP20;
+ } else {
+ goto error;
+ }
+ } else {
+ goto error;
+ }
+
+ return 1;
+
+error:
+ gpr_log(GPR_ERROR, "Failed parsing request line");
+ return 0;
+}
+
+static int handle_first_line(grpc_http_parser *parser) {
+ if (parser->cur_line[0] == 'H') {
+ parser->type = GRPC_HTTP_RESPONSE;
+ return handle_response_line(parser);
+ } else {
+ parser->type = GRPC_HTTP_REQUEST;
+ return handle_request_line(parser);
+ }
+}
+
+static int add_header(grpc_http_parser *parser) {
+ uint8_t *beg = parser->cur_line;
+ uint8_t *cur = beg;
+ uint8_t *end = beg + parser->cur_line_length;
+ size_t *hdr_count = NULL;
+ grpc_http_header **hdrs = NULL;
+ grpc_http_header hdr = {NULL, NULL};
+
+ GPR_ASSERT(cur != end);
+
+ if (*cur == ' ' || *cur == '\t') {
+ gpr_log(GPR_ERROR, "Continued header lines not supported yet");
+ goto error;
+ }
+
+ while (cur != end && *cur != ':') {
+ cur++;
+ }
+ if (cur == end) {
+ gpr_log(GPR_ERROR, "Didn't find ':' in header string");
+ goto error;
+ }
+ GPR_ASSERT(cur >= beg);
+ hdr.key = buf2str(beg, (size_t)(cur - beg));
+ cur++; /* skip : */
+
+ while (cur != end && (*cur == ' ' || *cur == '\t')) {
+ cur++;
+ }
+ GPR_ASSERT(end - cur >= 2);
+ hdr.value = buf2str(cur, (size_t)(end - cur) - 2);
+
+ if (parser->type == GRPC_HTTP_RESPONSE) {
+ hdr_count = &parser->http.response.hdr_count;
+ hdrs = &parser->http.response.hdrs;
+ } else if (parser->type == GRPC_HTTP_REQUEST) {
+ hdr_count = &parser->http.request.hdr_count;
+ hdrs = &parser->http.request.hdrs;
+ } else {
+ return 0;
+ }
+
+ if (*hdr_count == parser->hdr_capacity) {
+ parser->hdr_capacity =
+ GPR_MAX(parser->hdr_capacity + 1, parser->hdr_capacity * 3 / 2);
+ *hdrs = gpr_realloc(*hdrs, parser->hdr_capacity * sizeof(**hdrs));
+ }
+ (*hdrs)[(*hdr_count)++] = hdr;
+ return 1;
+
+error:
+ gpr_free(hdr.key);
+ gpr_free(hdr.value);
+ return 0;
+}
+
+static int finish_line(grpc_http_parser *parser) {
+ switch (parser->state) {
+ case GRPC_HTTP_FIRST_LINE:
+ if (!handle_first_line(parser)) {
+ return 0;
+ }
+ parser->state = GRPC_HTTP_HEADERS;
+ break;
+ case GRPC_HTTP_HEADERS:
+ if (parser->cur_line_length == 2) {
+ parser->state = GRPC_HTTP_BODY;
+ break;
+ }
+ if (!add_header(parser)) {
+ return 0;
+ }
+ break;
+ case GRPC_HTTP_BODY:
+ GPR_UNREACHABLE_CODE(return 0);
+ }
+
+ parser->cur_line_length = 0;
+ return 1;
+}
+
+static int addbyte_body(grpc_http_parser *parser, uint8_t byte) {
+ size_t *body_length = NULL;
+ char **body = NULL;
+
+ if (parser->type == GRPC_HTTP_RESPONSE) {
+ body_length = &parser->http.response.body_length;
+ body = &parser->http.response.body;
+ } else if (parser->type == GRPC_HTTP_REQUEST) {
+ body_length = &parser->http.request.body_length;
+ body = &parser->http.request.body;
+ } else {
+ return 0;
+ }
+
+ if (*body_length == parser->body_capacity) {
+ parser->body_capacity = GPR_MAX(8, parser->body_capacity * 3 / 2);
+ *body = gpr_realloc((void *)*body, parser->body_capacity);
+ }
+ (*body)[*body_length] = (char)byte;
+ (*body_length)++;
+
+ return 1;
+}
+
+static int addbyte(grpc_http_parser *parser, uint8_t byte) {
+ switch (parser->state) {
+ case GRPC_HTTP_FIRST_LINE:
+ case GRPC_HTTP_HEADERS:
+ if (parser->cur_line_length >= GRPC_HTTP_PARSER_MAX_HEADER_LENGTH) {
+ gpr_log(GPR_ERROR, "HTTP client max line length (%d) exceeded",
+ GRPC_HTTP_PARSER_MAX_HEADER_LENGTH);
+ return 0;
+ }
+ parser->cur_line[parser->cur_line_length] = byte;
+ parser->cur_line_length++;
+ if (parser->cur_line_length >= 2 &&
+ parser->cur_line[parser->cur_line_length - 2] == '\r' &&
+ parser->cur_line[parser->cur_line_length - 1] == '\n') {
+ return finish_line(parser);
+ } else {
+ return 1;
+ }
+ GPR_UNREACHABLE_CODE(return 0);
+ case GRPC_HTTP_BODY:
+ return addbyte_body(parser, byte);
+ }
+ GPR_UNREACHABLE_CODE(return 0);
+}
+
+void grpc_http_parser_init(grpc_http_parser *parser) {
+ memset(parser, 0, sizeof(*parser));
+ parser->state = GRPC_HTTP_FIRST_LINE;
+ parser->type = GRPC_HTTP_UNKNOWN;
+}
+
+void grpc_http_parser_destroy(grpc_http_parser *parser) {
+ size_t i;
+ if (parser->type == GRPC_HTTP_RESPONSE) {
+ gpr_free(parser->http.response.body);
+ for (i = 0; i < parser->http.response.hdr_count; i++) {
+ gpr_free(parser->http.response.hdrs[i].key);
+ gpr_free(parser->http.response.hdrs[i].value);
+ }
+ gpr_free(parser->http.response.hdrs);
+ } else if (parser->type == GRPC_HTTP_REQUEST) {
+ gpr_free(parser->http.request.body);
+ for (i = 0; i < parser->http.request.hdr_count; i++) {
+ gpr_free(parser->http.request.hdrs[i].key);
+ gpr_free(parser->http.request.hdrs[i].value);
+ }
+ gpr_free(parser->http.request.hdrs);
+ gpr_free(parser->http.request.method);
+ gpr_free(parser->http.request.path);
+ }
+}
+
+int grpc_http_parser_parse(grpc_http_parser *parser, gpr_slice slice) {
+ size_t i;
+
+ for (i = 0; i < GPR_SLICE_LENGTH(slice); i++) {
+ if (!addbyte(parser, GPR_SLICE_START_PTR(slice)[i])) {
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+int grpc_http_parser_eof(grpc_http_parser *parser) {
+ return parser->state == GRPC_HTTP_BODY;
+}
diff --git a/src/core/lib/http/parser.h b/src/core/lib/http/parser.h
new file mode 100644
index 0000000000..6a72174aa6
--- /dev/null
+++ b/src/core/lib/http/parser.h
@@ -0,0 +1,116 @@
+/*
+ *
+ * Copyright 2015-2016, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_HTTP_PARSER_H
+#define GRPC_CORE_LIB_HTTP_PARSER_H
+
+#include <grpc/support/port_platform.h>
+#include <grpc/support/slice.h>
+
+/* Maximum length of a header string of the form 'Key: Value\r\n' */
+#define GRPC_HTTP_PARSER_MAX_HEADER_LENGTH 4096
+
+/* A single header to be passed in a request */
+typedef struct grpc_http_header {
+ char *key;
+ char *value;
+} grpc_http_header;
+
+typedef enum {
+ GRPC_HTTP_FIRST_LINE,
+ GRPC_HTTP_HEADERS,
+ GRPC_HTTP_BODY
+} grpc_http_parser_state;
+
+typedef enum {
+ GRPC_HTTP_HTTP10,
+ GRPC_HTTP_HTTP11,
+ GRPC_HTTP_HTTP20,
+} grpc_http_version;
+
+typedef enum {
+ GRPC_HTTP_RESPONSE,
+ GRPC_HTTP_REQUEST,
+ GRPC_HTTP_UNKNOWN
+} grpc_http_type;
+
+/* A request */
+typedef struct grpc_http_request {
+ /* Method of the request (e.g. GET, POST) */
+ char *method;
+ /* The path of the resource to fetch */
+ char *path;
+ /* HTTP version to use */
+ grpc_http_version version;
+ /* Headers attached to the request */
+ size_t hdr_count;
+ grpc_http_header *hdrs;
+ /* Body: length and contents; contents are NOT null-terminated */
+ size_t body_length;
+ char *body;
+} grpc_http_request;
+
+/* A response */
+typedef struct grpc_http_response {
+ /* HTTP status code */
+ int status;
+ /* Headers: count and key/values */
+ size_t hdr_count;
+ grpc_http_header *hdrs;
+ /* Body: length and contents; contents are NOT null-terminated */
+ size_t body_length;
+ char *body;
+} grpc_http_response;
+
+typedef struct {
+ grpc_http_parser_state state;
+ grpc_http_type type;
+
+ union {
+ grpc_http_response response;
+ grpc_http_request request;
+ } http;
+ size_t body_capacity;
+ size_t hdr_capacity;
+
+ uint8_t cur_line[GRPC_HTTP_PARSER_MAX_HEADER_LENGTH];
+ size_t cur_line_length;
+} grpc_http_parser;
+
+void grpc_http_parser_init(grpc_http_parser *parser);
+void grpc_http_parser_destroy(grpc_http_parser *parser);
+
+int grpc_http_parser_parse(grpc_http_parser *parser, gpr_slice slice);
+int grpc_http_parser_eof(grpc_http_parser *parser);
+
+#endif /* GRPC_CORE_LIB_HTTP_PARSER_H */
diff --git a/src/core/iomgr/closure.c b/src/core/lib/iomgr/closure.c
index 3a96f7385f..724ebc284a 100644
--- a/src/core/iomgr/closure.c
+++ b/src/core/lib/iomgr/closure.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/iomgr/closure.h"
+#include "src/core/lib/iomgr/closure.h"
#include <grpc/support/alloc.h>
diff --git a/src/core/iomgr/closure.h b/src/core/lib/iomgr/closure.h
index d5e1f455b9..2597cf1706 100644
--- a/src/core/iomgr/closure.h
+++ b/src/core/lib/iomgr/closure.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_CLOSURE_H
-#define GRPC_CORE_IOMGR_CLOSURE_H
+#ifndef GRPC_CORE_LIB_IOMGR_CLOSURE_H
+#define GRPC_CORE_LIB_IOMGR_CLOSURE_H
#include <grpc/support/port_platform.h>
#include <stdbool.h>
@@ -95,4 +95,4 @@ bool grpc_closure_list_empty(grpc_closure_list list);
/** return the next pointer for a queued closure list */
grpc_closure *grpc_closure_next(grpc_closure *closure);
-#endif /* GRPC_CORE_IOMGR_CLOSURE_H */
+#endif /* GRPC_CORE_LIB_IOMGR_CLOSURE_H */
diff --git a/src/core/iomgr/endpoint.c b/src/core/lib/iomgr/endpoint.c
index bd64707669..576b5a6e5c 100644
--- a/src/core/iomgr/endpoint.c
+++ b/src/core/lib/iomgr/endpoint.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/endpoint.h"
void grpc_endpoint_read(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
gpr_slice_buffer* slices, grpc_closure* cb) {
diff --git a/src/core/iomgr/endpoint.h b/src/core/lib/iomgr/endpoint.h
index 788f3ac5bc..918e705fbd 100644
--- a/src/core/iomgr/endpoint.h
+++ b/src/core/lib/iomgr/endpoint.h
@@ -31,14 +31,14 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_ENDPOINT_H
-#define GRPC_CORE_IOMGR_ENDPOINT_H
+#ifndef GRPC_CORE_LIB_IOMGR_ENDPOINT_H
+#define GRPC_CORE_LIB_IOMGR_ENDPOINT_H
-#include "src/core/iomgr/pollset.h"
-#include "src/core/iomgr/pollset_set.h"
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
#include <grpc/support/time.h>
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/iomgr/pollset_set.h"
/* An endpoint caps a streaming channel between two communicating processes.
Examples may be: a tcp socket, <stdin+stdout>, or some shared memory. */
@@ -99,4 +99,4 @@ struct grpc_endpoint {
const grpc_endpoint_vtable *vtable;
};
-#endif /* GRPC_CORE_IOMGR_ENDPOINT_H */
+#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_H */
diff --git a/src/core/iomgr/endpoint_pair.h b/src/core/lib/iomgr/endpoint_pair.h
index 59015d8ffb..bef8bb3518 100644
--- a/src/core/iomgr/endpoint_pair.h
+++ b/src/core/lib/iomgr/endpoint_pair.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_ENDPOINT_PAIR_H
-#define GRPC_CORE_IOMGR_ENDPOINT_PAIR_H
+#ifndef GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H
+#define GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H
-#include "src/core/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/endpoint.h"
typedef struct {
grpc_endpoint *client;
@@ -44,4 +44,4 @@ typedef struct {
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char *name,
size_t read_slice_size);
-#endif /* GRPC_CORE_IOMGR_ENDPOINT_PAIR_H */
+#endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_PAIR_H */
diff --git a/src/core/iomgr/endpoint_pair_posix.c b/src/core/lib/iomgr/endpoint_pair_posix.c
index 56f6f146fd..e0ce47c773 100644
--- a/src/core/iomgr/endpoint_pair_posix.c
+++ b/src/core/lib/iomgr/endpoint_pair_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,24 +35,25 @@
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/endpoint_pair.h"
-#include "src/core/iomgr/socket_utils_posix.h"
+#include "src/core/lib/iomgr/endpoint_pair.h"
+#include "src/core/lib/iomgr/socket_utils_posix.h"
+#include "src/core/lib/iomgr/unix_sockets_posix.h"
#include <errno.h>
#include <fcntl.h>
#include <string.h>
-#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/types.h>
-#include "src/core/iomgr/tcp_posix.h"
-#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+#include "src/core/lib/iomgr/tcp_posix.h"
+#include "src/core/lib/support/string.h"
static void create_sockets(int sv[2]) {
int flags;
- GPR_ASSERT(socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == 0);
+ grpc_create_socketpair_if_unix(sv);
flags = fcntl(sv[0], F_GETFL, 0);
GPR_ASSERT(fcntl(sv[0], F_SETFL, flags | O_NONBLOCK) == 0);
flags = fcntl(sv[1], F_GETFL, 0);
diff --git a/src/core/iomgr/endpoint_pair_windows.c b/src/core/lib/iomgr/endpoint_pair_windows.c
index db9d092dca..cba18db81f 100644
--- a/src/core/iomgr/endpoint_pair_windows.c
+++ b/src/core/lib/iomgr/endpoint_pair_windows.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,16 +34,16 @@
#include <grpc/support/port_platform.h>
#ifdef GPR_WINSOCK_SOCKET
-#include "src/core/iomgr/sockaddr_utils.h"
-#include "src/core/iomgr/endpoint_pair.h"
+#include "src/core/lib/iomgr/endpoint_pair.h"
+#include "src/core/lib/iomgr/sockaddr_utils.h"
#include <errno.h>
#include <fcntl.h>
#include <string.h>
-#include "src/core/iomgr/tcp_windows.h"
-#include "src/core/iomgr/socket_windows.h"
#include <grpc/support/log.h>
+#include "src/core/lib/iomgr/socket_windows.h"
+#include "src/core/lib/iomgr/tcp_windows.h"
static void create_sockets(SOCKET sv[2]) {
SOCKET svr_sock = INVALID_SOCKET;
diff --git a/src/core/iomgr/exec_ctx.c b/src/core/lib/iomgr/exec_ctx.c
index 893fe4515c..1ed6da623a 100644
--- a/src/core/iomgr/exec_ctx.c
+++ b/src/core/lib/iomgr/exec_ctx.c
@@ -31,13 +31,13 @@
*
*/
-#include "src/core/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
-#include "src/core/profiling/timers.h"
+#include "src/core/lib/profiling/timers.h"
#ifndef GRPC_EXECUTION_CONTEXT_SANITIZER
bool grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx) {
diff --git a/src/core/iomgr/exec_ctx.h b/src/core/lib/iomgr/exec_ctx.h
index 07b54a0ab8..e62ea2dedf 100644
--- a/src/core/iomgr/exec_ctx.h
+++ b/src/core/lib/iomgr/exec_ctx.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_EXEC_CTX_H
-#define GRPC_CORE_IOMGR_EXEC_CTX_H
+#ifndef GRPC_CORE_LIB_IOMGR_EXEC_CTX_H
+#define GRPC_CORE_LIB_IOMGR_EXEC_CTX_H
-#include "src/core/iomgr/closure.h"
+#include "src/core/lib/iomgr/closure.h"
/* #define GRPC_EXECUTION_CONTEXT_SANITIZER 1 */
@@ -95,4 +95,4 @@ void grpc_exec_ctx_enqueue_list(grpc_exec_ctx *exec_ctx,
void grpc_exec_ctx_global_init(void);
void grpc_exec_ctx_global_shutdown(void);
-#endif /* GRPC_CORE_IOMGR_EXEC_CTX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_EXEC_CTX_H */
diff --git a/src/core/iomgr/executor.c b/src/core/lib/iomgr/executor.c
index f22d8f30ac..42a9db3cbb 100644
--- a/src/core/iomgr/executor.c
+++ b/src/core/lib/iomgr/executor.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/iomgr/executor.h"
+#include "src/core/lib/iomgr/executor.h"
#include <string.h>
@@ -39,7 +39,7 @@
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
-#include "src/core/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
typedef struct grpc_executor_data {
int busy; /**< is the thread currently running? */
diff --git a/src/core/iomgr/executor.h b/src/core/lib/iomgr/executor.h
index f66b3560e3..f1871416a0 100644
--- a/src/core/iomgr/executor.h
+++ b/src/core/lib/iomgr/executor.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_EXECUTOR_H
-#define GRPC_CORE_IOMGR_EXECUTOR_H
+#ifndef GRPC_CORE_LIB_IOMGR_EXECUTOR_H
+#define GRPC_CORE_LIB_IOMGR_EXECUTOR_H
-#include "src/core/iomgr/closure.h"
+#include "src/core/lib/iomgr/closure.h"
/** Initialize the global executor.
*
@@ -50,4 +50,4 @@ void grpc_executor_enqueue(grpc_closure *closure, bool success);
/** Shutdown the executor, running all pending work as part of the call */
void grpc_executor_shutdown();
-#endif /* GRPC_CORE_IOMGR_EXECUTOR_H */
+#endif /* GRPC_CORE_LIB_IOMGR_EXECUTOR_H */
diff --git a/src/core/iomgr/fd_posix.c b/src/core/lib/iomgr/fd_posix.c
index 4ba7c5df94..72c924bdcb 100644
--- a/src/core/iomgr/fd_posix.c
+++ b/src/core/lib/iomgr/fd_posix.c
@@ -35,7 +35,7 @@
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/fd_posix.h"
+#include "src/core/lib/iomgr/fd_posix.h"
#include <assert.h>
#include <sys/socket.h>
@@ -46,7 +46,7 @@
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
-#include "src/core/iomgr/pollset_posix.h"
+#include "src/core/lib/iomgr/pollset_posix.h"
#define CLOSURE_NOT_READY ((grpc_closure *)0)
#define CLOSURE_READY ((grpc_closure *)1)
@@ -92,7 +92,7 @@ static grpc_fd *alloc_fd(int fd) {
gpr_mu_init(&r->mu);
}
- gpr_atm_rel_store(&r->refst, 1);
+ gpr_mu_lock(&r->mu);
r->shutdown = 0;
r->read_closure = CLOSURE_NOT_READY;
r->write_closure = CLOSURE_NOT_READY;
@@ -104,6 +104,9 @@ static grpc_fd *alloc_fd(int fd) {
r->on_done_closure = NULL;
r->closed = 0;
r->released = 0;
+ gpr_atm_rel_store(&r->refst, 1);
+ gpr_mu_unlock(&r->mu);
+
return r;
}
diff --git a/src/core/iomgr/fd_posix.h b/src/core/lib/iomgr/fd_posix.h
index a5c8ff1d9a..69d09ef5e3 100644
--- a/src/core/iomgr/fd_posix.h
+++ b/src/core/lib/iomgr/fd_posix.h
@@ -31,14 +31,14 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_FD_POSIX_H
-#define GRPC_CORE_IOMGR_FD_POSIX_H
+#ifndef GRPC_CORE_LIB_IOMGR_FD_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_FD_POSIX_H
-#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/pollset.h"
#include <grpc/support/atm.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
+#include "src/core/lib/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/pollset.h"
typedef struct grpc_fd grpc_fd;
@@ -189,4 +189,4 @@ void grpc_fd_unref(grpc_fd *fd);
void grpc_fd_global_init(void);
void grpc_fd_global_shutdown(void);
-#endif /* GRPC_CORE_IOMGR_FD_POSIX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_FD_POSIX_H */
diff --git a/src/core/iomgr/iocp_windows.c b/src/core/lib/iomgr/iocp_windows.c
index fa87e5246b..682a32c0da 100644
--- a/src/core/iomgr/iocp_windows.c
+++ b/src/core/lib/iomgr/iocp_windows.c
@@ -37,15 +37,15 @@
#include <winsock2.h>
+#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/log_win32.h>
-#include <grpc/support/alloc.h>
#include <grpc/support/thd.h>
-#include "src/core/iomgr/timer.h"
-#include "src/core/iomgr/iocp_windows.h"
-#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/socket_windows.h"
+#include "src/core/lib/iomgr/iocp_windows.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/socket_windows.h"
+#include "src/core/lib/iomgr/timer.h"
static ULONG g_iocp_kick_token;
static OVERLAPPED g_iocp_custom_overlap;
diff --git a/src/core/iomgr/iocp_windows.h b/src/core/lib/iomgr/iocp_windows.h
index 570b8925aa..856c837fb4 100644
--- a/src/core/iomgr/iocp_windows.h
+++ b/src/core/lib/iomgr/iocp_windows.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_IOCP_WINDOWS_H
-#define GRPC_CORE_IOMGR_IOCP_WINDOWS_H
+#ifndef GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H
+#define GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H
#include <grpc/support/sync.h>
-#include "src/core/iomgr/socket_windows.h"
+#include "src/core/lib/iomgr/socket_windows.h"
typedef enum {
GRPC_IOCP_WORK_WORK,
@@ -60,4 +60,4 @@ void grpc_socket_notify_on_read(grpc_exec_ctx *exec_ctx,
grpc_winsocket *winsocket,
grpc_closure *closure);
-#endif /* GRPC_CORE_IOMGR_IOCP_WINDOWS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H */
diff --git a/src/core/iomgr/iomgr.c b/src/core/lib/iomgr/iomgr.c
index 3ab4430668..bb544c8280 100644
--- a/src/core/iomgr/iomgr.c
+++ b/src/core/lib/iomgr/iomgr.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/iomgr/iomgr.h"
+#include "src/core/lib/iomgr/iomgr.h"
#include <stdlib.h>
#include <string.h>
@@ -43,11 +43,11 @@
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
-#include "src/core/iomgr/exec_ctx.h"
-#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/timer.h"
-#include "src/core/support/env.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/timer.h"
+#include "src/core/lib/support/env.h"
+#include "src/core/lib/support/string.h"
static gpr_mu g_mu;
static gpr_cv g_rcv;
diff --git a/src/core/iomgr/iomgr.h b/src/core/lib/iomgr/iomgr.h
index e1237a4533..babf0a85b7 100644
--- a/src/core/iomgr/iomgr.h
+++ b/src/core/lib/iomgr/iomgr.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_IOMGR_H
-#define GRPC_CORE_IOMGR_IOMGR_H
+#ifndef GRPC_CORE_LIB_IOMGR_IOMGR_H
+#define GRPC_CORE_LIB_IOMGR_IOMGR_H
/** Initializes the iomgr. */
void grpc_iomgr_init(void);
@@ -40,4 +40,4 @@ void grpc_iomgr_init(void);
/** Signals the intention to shutdown the iomgr. */
void grpc_iomgr_shutdown(void);
-#endif /* GRPC_CORE_IOMGR_IOMGR_H */
+#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_H */
diff --git a/src/core/iomgr/iomgr_internal.h b/src/core/lib/iomgr/iomgr_internal.h
index d06b068b1c..0963630c61 100644
--- a/src/core/iomgr/iomgr_internal.h
+++ b/src/core/lib/iomgr/iomgr_internal.h
@@ -31,13 +31,13 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_IOMGR_INTERNAL_H
-#define GRPC_CORE_IOMGR_IOMGR_INTERNAL_H
+#ifndef GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H
+#define GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H
#include <stdbool.h>
-#include "src/core/iomgr/iomgr.h"
#include <grpc/support/sync.h>
+#include "src/core/lib/iomgr/iomgr.h"
typedef struct grpc_iomgr_object {
char *name;
@@ -59,4 +59,4 @@ void grpc_iomgr_platform_shutdown(void);
bool grpc_iomgr_abort_on_leaks(void);
-#endif /* GRPC_CORE_IOMGR_IOMGR_INTERNAL_H */
+#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_INTERNAL_H */
diff --git a/src/core/iomgr/iomgr_posix.c b/src/core/lib/iomgr/iomgr_posix.c
index fecb7b9760..e4990f7bce 100644
--- a/src/core/iomgr/iomgr_posix.c
+++ b/src/core/lib/iomgr/iomgr_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,10 +35,10 @@
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/iomgr_posix.h"
-#include "src/core/debug/trace.h"
-#include "src/core/iomgr/fd_posix.h"
-#include "src/core/iomgr/tcp_posix.h"
+#include "src/core/lib/debug/trace.h"
+#include "src/core/lib/iomgr/fd_posix.h"
+#include "src/core/lib/iomgr/iomgr_posix.h"
+#include "src/core/lib/iomgr/tcp_posix.h"
void grpc_iomgr_platform_init(void) {
grpc_fd_global_init();
diff --git a/src/core/iomgr/iomgr_posix.h b/src/core/lib/iomgr/iomgr_posix.h
index 698fb6aee7..6a8996e403 100644
--- a/src/core/iomgr/iomgr_posix.h
+++ b/src/core/lib/iomgr/iomgr_posix.h
@@ -31,9 +31,9 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_IOMGR_POSIX_H
-#define GRPC_CORE_IOMGR_IOMGR_POSIX_H
+#ifndef GRPC_CORE_LIB_IOMGR_IOMGR_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_IOMGR_POSIX_H
-#include "src/core/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
-#endif /* GRPC_CORE_IOMGR_IOMGR_POSIX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_IOMGR_POSIX_H */
diff --git a/src/core/iomgr/iomgr_windows.c b/src/core/lib/iomgr/iomgr_windows.c
index 14775516bb..af7e616394 100644
--- a/src/core/iomgr/iomgr_windows.c
+++ b/src/core/lib/iomgr/iomgr_windows.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,13 +35,13 @@
#ifdef GPR_WINSOCK_SOCKET
-#include "src/core/iomgr/sockaddr_win32.h"
+#include "src/core/lib/iomgr/sockaddr_win32.h"
#include <grpc/support/log.h>
-#include "src/core/iomgr/socket_windows.h"
-#include "src/core/iomgr/iocp_windows.h"
-#include "src/core/iomgr/iomgr.h"
+#include "src/core/lib/iomgr/iocp_windows.h"
+#include "src/core/lib/iomgr/iomgr.h"
+#include "src/core/lib/iomgr/socket_windows.h"
/* Windows' io manager is going to be fully designed using IO completion
ports. All of what we're doing here is basically make sure that
diff --git a/src/core/iomgr/pollset.h b/src/core/lib/iomgr/pollset.h
index 9500b1a73a..6156124862 100644
--- a/src/core/iomgr/pollset.h
+++ b/src/core/lib/iomgr/pollset.h
@@ -31,14 +31,14 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_POLLSET_H
-#define GRPC_CORE_IOMGR_POLLSET_H
+#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_H
+#define GRPC_CORE_LIB_IOMGR_POLLSET_H
#include <grpc/support/port_platform.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
-#include "src/core/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
#define GRPC_POLLSET_KICK_BROADCAST ((grpc_pollset_worker *)1)
@@ -91,4 +91,4 @@ void grpc_pollset_work(grpc_exec_ctx *exec_ctx, grpc_pollset *pollset,
void grpc_pollset_kick(grpc_pollset *pollset,
grpc_pollset_worker *specific_worker);
-#endif /* GRPC_CORE_IOMGR_POLLSET_H */
+#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_H */
diff --git a/src/core/iomgr/pollset_multipoller_with_epoll.c b/src/core/lib/iomgr/pollset_multipoller_with_epoll.c
index 2e0f27fab8..fa1b0d2d84 100644
--- a/src/core/iomgr/pollset_multipoller_with_epoll.c
+++ b/src/core/lib/iomgr/pollset_multipoller_with_epoll.c
@@ -44,10 +44,10 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
-#include "src/core/iomgr/fd_posix.h"
-#include "src/core/iomgr/pollset_posix.h"
-#include "src/core/profiling/timers.h"
-#include "src/core/support/block_annotate.h"
+#include "src/core/lib/iomgr/fd_posix.h"
+#include "src/core/lib/iomgr/pollset_posix.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/support/block_annotate.h"
struct epoll_fd_list {
int *epoll_fds;
diff --git a/src/core/iomgr/pollset_multipoller_with_poll_posix.c b/src/core/lib/iomgr/pollset_multipoller_with_poll_posix.c
index 92d6fb7241..9b33f6dbb2 100644
--- a/src/core/iomgr/pollset_multipoller_with_poll_posix.c
+++ b/src/core/lib/iomgr/pollset_multipoller_with_poll_posix.c
@@ -35,7 +35,7 @@
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/pollset_posix.h"
+#include "src/core/lib/iomgr/pollset_posix.h"
#include <errno.h>
#include <poll.h>
@@ -46,10 +46,10 @@
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
-#include "src/core/iomgr/fd_posix.h"
-#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/pollset_posix.h"
-#include "src/core/support/block_annotate.h"
+#include "src/core/lib/iomgr/fd_posix.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/pollset_posix.h"
+#include "src/core/lib/support/block_annotate.h"
typedef struct {
/* all polled fds */
diff --git a/src/core/iomgr/pollset_posix.c b/src/core/lib/iomgr/pollset_posix.c
index e895a77884..259c7bc194 100644
--- a/src/core/iomgr/pollset_posix.c
+++ b/src/core/lib/iomgr/pollset_posix.c
@@ -35,7 +35,7 @@
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/pollset_posix.h"
+#include "src/core/lib/iomgr/pollset_posix.h"
#include <errno.h>
#include <stdlib.h>
@@ -47,11 +47,11 @@
#include <grpc/support/thd.h>
#include <grpc/support/tls.h>
#include <grpc/support/useful.h>
-#include "src/core/iomgr/fd_posix.h"
-#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/socket_utils_posix.h"
-#include "src/core/profiling/timers.h"
-#include "src/core/support/block_annotate.h"
+#include "src/core/lib/iomgr/fd_posix.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/socket_utils_posix.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/support/block_annotate.h"
GPR_TLS_DECL(g_current_thread_poller);
GPR_TLS_DECL(g_current_thread_worker);
diff --git a/src/core/iomgr/pollset_posix.h b/src/core/lib/iomgr/pollset_posix.h
index e0cfc44395..7d8e9fc279 100644
--- a/src/core/iomgr/pollset_posix.h
+++ b/src/core/lib/iomgr/pollset_posix.h
@@ -31,17 +31,17 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_POLLSET_POSIX_H
-#define GRPC_CORE_IOMGR_POLLSET_POSIX_H
+#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_POLLSET_POSIX_H
#include <poll.h>
#include <grpc/support/sync.h>
-#include "src/core/iomgr/exec_ctx.h"
-#include "src/core/iomgr/iomgr.h"
-#include "src/core/iomgr/pollset.h"
-#include "src/core/iomgr/wakeup_fd_posix.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/iomgr.h"
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/iomgr/wakeup_fd_posix.h"
typedef struct grpc_pollset_vtable grpc_pollset_vtable;
@@ -150,4 +150,4 @@ typedef int (*grpc_poll_function_type)(struct pollfd *, nfds_t, int);
extern grpc_poll_function_type grpc_poll_function;
extern grpc_wakeup_fd grpc_global_wakeup_fd;
-#endif /* GRPC_CORE_IOMGR_POLLSET_POSIX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_POSIX_H */
diff --git a/src/core/iomgr/pollset_set.h b/src/core/lib/iomgr/pollset_set.h
index 204c625933..fb29d692d7 100644
--- a/src/core/iomgr/pollset_set.h
+++ b/src/core/lib/iomgr/pollset_set.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_POLLSET_SET_H
-#define GRPC_CORE_IOMGR_POLLSET_SET_H
+#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_SET_H
+#define GRPC_CORE_LIB_IOMGR_POLLSET_SET_H
-#include "src/core/iomgr/pollset.h"
+#include "src/core/lib/iomgr/pollset.h"
/* A grpc_pollset_set is a set of pollsets that are interested in an
action. Adding a pollset to a pollset_set automatically adds any
@@ -58,4 +58,4 @@ void grpc_pollset_set_del_pollset_set(grpc_exec_ctx *exec_ctx,
grpc_pollset_set *bag,
grpc_pollset_set *item);
-#endif /* GRPC_CORE_IOMGR_POLLSET_SET_H */
+#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_SET_H */
diff --git a/src/core/iomgr/pollset_set_posix.c b/src/core/lib/iomgr/pollset_set_posix.c
index 9dc9aff4a8..d6142f9b6b 100644
--- a/src/core/iomgr/pollset_set_posix.c
+++ b/src/core/lib/iomgr/pollset_set_posix.c
@@ -41,8 +41,8 @@
#include <grpc/support/alloc.h>
#include <grpc/support/useful.h>
-#include "src/core/iomgr/pollset_posix.h"
-#include "src/core/iomgr/pollset_set_posix.h"
+#include "src/core/lib/iomgr/pollset_posix.h"
+#include "src/core/lib/iomgr/pollset_set_posix.h"
struct grpc_pollset_set {
gpr_mu mu;
diff --git a/src/core/iomgr/pollset_set_posix.h b/src/core/lib/iomgr/pollset_set_posix.h
index 80f487718e..4e6b063c6f 100644
--- a/src/core/iomgr/pollset_set_posix.h
+++ b/src/core/lib/iomgr/pollset_set_posix.h
@@ -31,15 +31,15 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_POLLSET_SET_POSIX_H
-#define GRPC_CORE_IOMGR_POLLSET_SET_POSIX_H
+#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_SET_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_POLLSET_SET_POSIX_H
-#include "src/core/iomgr/fd_posix.h"
-#include "src/core/iomgr/pollset_set.h"
+#include "src/core/lib/iomgr/fd_posix.h"
+#include "src/core/lib/iomgr/pollset_set.h"
void grpc_pollset_set_add_fd(grpc_exec_ctx *exec_ctx,
grpc_pollset_set *pollset_set, grpc_fd *fd);
void grpc_pollset_set_del_fd(grpc_exec_ctx *exec_ctx,
grpc_pollset_set *pollset_set, grpc_fd *fd);
-#endif /* GRPC_CORE_IOMGR_POLLSET_SET_POSIX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_SET_POSIX_H */
diff --git a/src/core/iomgr/pollset_set_windows.c b/src/core/lib/iomgr/pollset_set_windows.c
index 3b8eca28e6..0b14e446ae 100644
--- a/src/core/iomgr/pollset_set_windows.c
+++ b/src/core/lib/iomgr/pollset_set_windows.c
@@ -35,7 +35,7 @@
#ifdef GPR_WINSOCK_SOCKET
-#include "src/core/iomgr/pollset_set_windows.h"
+#include "src/core/lib/iomgr/pollset_set_windows.h"
grpc_pollset_set* grpc_pollset_set_create(pollset_set) { return NULL; }
diff --git a/src/core/iomgr/pollset_set_windows.h b/src/core/lib/iomgr/pollset_set_windows.h
index 0f040fef82..7c2cea23de 100644
--- a/src/core/iomgr/pollset_set_windows.h
+++ b/src/core/lib/iomgr/pollset_set_windows.h
@@ -31,9 +31,9 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_POLLSET_SET_WINDOWS_H
-#define GRPC_CORE_IOMGR_POLLSET_SET_WINDOWS_H
+#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_SET_WINDOWS_H
+#define GRPC_CORE_LIB_IOMGR_POLLSET_SET_WINDOWS_H
-#include "src/core/iomgr/pollset_set.h"
+#include "src/core/lib/iomgr/pollset_set.h"
-#endif /* GRPC_CORE_IOMGR_POLLSET_SET_WINDOWS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_SET_WINDOWS_H */
diff --git a/src/core/iomgr/pollset_windows.c b/src/core/lib/iomgr/pollset_windows.c
index c7f30f435f..6b339127a8 100644
--- a/src/core/iomgr/pollset_windows.c
+++ b/src/core/lib/iomgr/pollset_windows.c
@@ -38,10 +38,10 @@
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
-#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/iocp_windows.h"
-#include "src/core/iomgr/pollset.h"
-#include "src/core/iomgr/pollset_windows.h"
+#include "src/core/lib/iomgr/iocp_windows.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/iomgr/pollset_windows.h"
gpr_mu grpc_polling_mu;
static grpc_pollset_worker *g_active_poller;
diff --git a/src/core/iomgr/pollset_windows.h b/src/core/lib/iomgr/pollset_windows.h
index f1d1585922..fa9553ffea 100644
--- a/src/core/iomgr/pollset_windows.h
+++ b/src/core/lib/iomgr/pollset_windows.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_POLLSET_WINDOWS_H
-#define GRPC_CORE_IOMGR_POLLSET_WINDOWS_H
+#ifndef GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H
+#define GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H
#include <grpc/support/sync.h>
-#include "src/core/iomgr/socket_windows.h"
+#include "src/core/lib/iomgr/socket_windows.h"
/* There isn't really any such thing as a pollset under Windows, due to the
nature of the IO completion ports. A Windows "pollset" is merely a mutex
@@ -72,4 +72,4 @@ struct grpc_pollset {
grpc_closure *on_shutdown;
};
-#endif /* GRPC_CORE_IOMGR_POLLSET_WINDOWS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H */
diff --git a/src/core/iomgr/resolve_address.h b/src/core/lib/iomgr/resolve_address.h
index aa0d7d194b..f748288685 100644
--- a/src/core/iomgr/resolve_address.h
+++ b/src/core/lib/iomgr/resolve_address.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_RESOLVE_ADDRESS_H
-#define GRPC_CORE_IOMGR_RESOLVE_ADDRESS_H
+#ifndef GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H
+#define GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H
#include <stddef.h>
-#include "src/core/iomgr/exec_ctx.h"
-#include "src/core/iomgr/iomgr.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/iomgr.h"
#define GRPC_MAX_SOCKADDR_SIZE 128
@@ -69,4 +69,4 @@ void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addresses);
extern grpc_resolved_addresses *(*grpc_blocking_resolve_address)(
const char *name, const char *default_port);
-#endif /* GRPC_CORE_IOMGR_RESOLVE_ADDRESS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H */
diff --git a/src/core/iomgr/resolve_address_posix.c b/src/core/lib/iomgr/resolve_address_posix.c
index a6c9893f23..ebecb39c16 100644
--- a/src/core/iomgr/resolve_address_posix.c
+++ b/src/core/lib/iomgr/resolve_address_posix.c
@@ -34,12 +34,11 @@
#include <grpc/support/port_platform.h>
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/resolve_address.h"
-#include "src/core/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+#include "src/core/lib/iomgr/sockaddr.h"
#include <string.h>
#include <sys/types.h>
-#include <sys/un.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
@@ -48,11 +47,12 @@
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.h>
-#include "src/core/iomgr/executor.h"
-#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/sockaddr_utils.h"
-#include "src/core/support/block_annotate.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/iomgr/executor.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/sockaddr_utils.h"
+#include "src/core/lib/iomgr/unix_sockets_posix.h"
+#include "src/core/lib/support/block_annotate.h"
+#include "src/core/lib/support/string.h"
typedef struct {
char *name;
@@ -71,18 +71,10 @@ static grpc_resolved_addresses *blocking_resolve_address_impl(
int s;
size_t i;
grpc_resolved_addresses *addrs = NULL;
- struct sockaddr_un *un;
if (name[0] == 'u' && name[1] == 'n' && name[2] == 'i' && name[3] == 'x' &&
name[4] == ':' && name[5] != 0) {
- addrs = gpr_malloc(sizeof(grpc_resolved_addresses));
- addrs->naddrs = 1;
- addrs->addrs = gpr_malloc(sizeof(grpc_resolved_address));
- un = (struct sockaddr_un *)addrs->addrs->addr;
- un->sun_family = AF_UNIX;
- strcpy(un->sun_path, name + 5);
- addrs->addrs->len = strlen(un->sun_path) + sizeof(un->sun_family) + 1;
- return addrs;
+ return grpc_resolve_unix_domain_address(name + 5);
}
/* parse name, splitting it into host and port parts */
diff --git a/src/core/iomgr/resolve_address_windows.c b/src/core/lib/iomgr/resolve_address_windows.c
index 472e797163..bde1f1b7f7 100644
--- a/src/core/iomgr/resolve_address_windows.c
+++ b/src/core/lib/iomgr/resolve_address_windows.c
@@ -34,8 +34,8 @@
#include <grpc/support/port_platform.h>
#ifdef GPR_WINSOCK_SOCKET
-#include "src/core/iomgr/resolve_address.h"
-#include "src/core/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+#include "src/core/lib/iomgr/sockaddr.h"
#include <string.h>
#include <sys/types.h>
@@ -47,11 +47,11 @@
#include <grpc/support/string_util.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
-#include "src/core/iomgr/executor.h"
-#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/sockaddr_utils.h"
-#include "src/core/support/block_annotate.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/iomgr/executor.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/sockaddr_utils.h"
+#include "src/core/lib/support/block_annotate.h"
+#include "src/core/lib/support/string.h"
typedef struct {
char *name;
diff --git a/src/core/iomgr/sockaddr.h b/src/core/lib/iomgr/sockaddr.h
index 68241bdd55..66a930ee6a 100644
--- a/src/core/iomgr/sockaddr.h
+++ b/src/core/lib/iomgr/sockaddr.h
@@ -31,17 +31,17 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_SOCKADDR_H
-#define GRPC_CORE_IOMGR_SOCKADDR_H
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_H
+#define GRPC_CORE_LIB_IOMGR_SOCKADDR_H
#include <grpc/support/port_platform.h>
#ifdef GPR_WIN32
-#include "src/core/iomgr/sockaddr_win32.h"
+#include "src/core/lib/iomgr/sockaddr_win32.h"
#endif
#ifdef GPR_POSIX_SOCKETADDR
-#include "src/core/iomgr/sockaddr_posix.h"
+#include "src/core/lib/iomgr/sockaddr_posix.h"
#endif
-#endif /* GRPC_CORE_IOMGR_SOCKADDR_H */
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_H */
diff --git a/src/core/iomgr/sockaddr_posix.h b/src/core/lib/iomgr/sockaddr_posix.h
index e4425ed735..79a7467c5d 100644
--- a/src/core/iomgr/sockaddr_posix.h
+++ b/src/core/lib/iomgr/sockaddr_posix.h
@@ -31,14 +31,14 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_SOCKADDR_POSIX_H
-#define GRPC_CORE_IOMGR_SOCKADDR_POSIX_H
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_SOCKADDR_POSIX_H
#include <arpa/inet.h>
+#include <netdb.h>
+#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
-#include <netinet/in.h>
-#include <netdb.h>
#include <unistd.h>
-#endif /* GRPC_CORE_IOMGR_SOCKADDR_POSIX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_POSIX_H */
diff --git a/src/core/iomgr/sockaddr_utils.c b/src/core/lib/iomgr/sockaddr_utils.c
index 61006d7a7a..127d95c618 100644
--- a/src/core/iomgr/sockaddr_utils.c
+++ b/src/core/lib/iomgr/sockaddr_utils.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,22 +31,19 @@
*
*/
-#include "src/core/iomgr/sockaddr_utils.h"
+#include "src/core/lib/iomgr/sockaddr_utils.h"
#include <errno.h>
#include <string.h>
-#ifdef GPR_POSIX_SOCKET
-#include <sys/un.h>
-#endif
-
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/string_util.h>
-#include "src/core/support/string.h"
+#include "src/core/lib/iomgr/unix_sockets_posix.h"
+#include "src/core/lib/support/string.h"
static const uint8_t kV4MappedPrefix[] = {0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0xff, 0xff};
@@ -191,14 +188,9 @@ char *grpc_sockaddr_to_uri(const struct sockaddr *addr) {
gpr_asprintf(&result, "ipv6:%s", temp);
gpr_free(temp);
return result;
-#ifdef GPR_POSIX_SOCKET
- case AF_UNIX:
- gpr_asprintf(&result, "unix:%s", ((struct sockaddr_un *)addr)->sun_path);
- return result;
-#endif
+ default:
+ return grpc_sockaddr_to_uri_unix_if_possible(addr);
}
-
- return NULL;
}
int grpc_sockaddr_get_port(const struct sockaddr *addr) {
@@ -207,9 +199,10 @@ int grpc_sockaddr_get_port(const struct sockaddr *addr) {
return ntohs(((struct sockaddr_in *)addr)->sin_port);
case AF_INET6:
return ntohs(((struct sockaddr_in6 *)addr)->sin6_port);
- case AF_UNIX:
- return 1;
default:
+ if (grpc_is_unix_socket(addr)) {
+ return 1;
+ }
gpr_log(GPR_ERROR, "Unknown socket family %d in grpc_sockaddr_get_port",
addr->sa_family);
return 0;
diff --git a/src/core/iomgr/sockaddr_utils.h b/src/core/lib/iomgr/sockaddr_utils.h
index 43dc7a45ec..20a3e3bec3 100644
--- a/src/core/iomgr/sockaddr_utils.h
+++ b/src/core/lib/iomgr/sockaddr_utils.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_SOCKADDR_UTILS_H
-#define GRPC_CORE_IOMGR_SOCKADDR_UTILS_H
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H
+#define GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H
-#include "src/core/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/sockaddr.h"
/* Returns true if addr is an IPv4-mapped IPv6 address within the
::ffff:0.0.0.0/96 range, or false otherwise.
@@ -86,4 +86,4 @@ int grpc_sockaddr_to_string(char **out, const struct sockaddr *addr,
char *grpc_sockaddr_to_uri(const struct sockaddr *addr);
-#endif /* GRPC_CORE_IOMGR_SOCKADDR_UTILS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_UTILS_H */
diff --git a/src/core/iomgr/sockaddr_win32.h b/src/core/lib/iomgr/sockaddr_win32.h
index 7acb8f7f57..2dd7111240 100644
--- a/src/core/iomgr/sockaddr_win32.h
+++ b/src/core/lib/iomgr/sockaddr_win32.h
@@ -31,11 +31,13 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_SOCKADDR_WIN32_H
-#define GRPC_CORE_IOMGR_SOCKADDR_WIN32_H
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_WIN32_H
+#define GRPC_CORE_LIB_IOMGR_SOCKADDR_WIN32_H
#include <winsock2.h>
#include <ws2tcpip.h>
+
+// must be included after the above
#include <mswsock.h>
-#endif /* GRPC_CORE_IOMGR_SOCKADDR_WIN32_H */
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_WIN32_H */
diff --git a/src/core/iomgr/socket_utils_common_posix.c b/src/core/lib/iomgr/socket_utils_common_posix.c
index a9af594700..9dbc2784e4 100644
--- a/src/core/iomgr/socket_utils_common_posix.c
+++ b/src/core/lib/iomgr/socket_utils_common_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,26 +35,26 @@
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/socket_utils_posix.h"
+#include "src/core/lib/iomgr/socket_utils_posix.h"
#include <arpa/inet.h>
-#include <limits.h>
+#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <stdio.h>
-#include <sys/types.h>
+#include <string.h>
#include <sys/socket.h>
+#include <sys/types.h>
#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include "src/core/iomgr/sockaddr_utils.h"
-#include "src/core/support/string.h"
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/sync.h>
+#include "src/core/lib/iomgr/sockaddr_utils.h"
+#include "src/core/lib/support/string.h"
/* set a socket to non blocking mode */
int grpc_set_socket_nonblocking(int fd, int non_blocking) {
diff --git a/src/core/iomgr/socket_utils_linux.c b/src/core/lib/iomgr/socket_utils_linux.c
index a87625262b..e7dfe892ca 100644
--- a/src/core/iomgr/socket_utils_linux.c
+++ b/src/core/lib/iomgr/socket_utils_linux.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,10 +35,10 @@
#ifdef GPR_LINUX_SOCKETUTILS
-#include "src/core/iomgr/socket_utils_posix.h"
+#include "src/core/lib/iomgr/socket_utils_posix.h"
-#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/types.h>
int grpc_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen,
int nonblock, int cloexec) {
diff --git a/src/core/iomgr/socket_utils_posix.c b/src/core/lib/iomgr/socket_utils_posix.c
index 3c56b46744..b2fa00c5c1 100644
--- a/src/core/iomgr/socket_utils_posix.c
+++ b/src/core/lib/iomgr/socket_utils_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@
#ifdef GPR_POSIX_SOCKETUTILS
-#include "src/core/iomgr/socket_utils_posix.h"
+#include "src/core/lib/iomgr/socket_utils_posix.h"
#include <fcntl.h>
#include <sys/socket.h>
diff --git a/src/core/iomgr/socket_utils_posix.h b/src/core/lib/iomgr/socket_utils_posix.h
index b01e28b6f2..063f298d72 100644
--- a/src/core/iomgr/socket_utils_posix.h
+++ b/src/core/lib/iomgr/socket_utils_posix.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_SOCKET_UTILS_POSIX_H
-#define GRPC_CORE_IOMGR_SOCKET_UTILS_POSIX_H
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H
-#include <unistd.h>
#include <sys/socket.h>
+#include <unistd.h>
/* a wrapper for accept or accept4 */
int grpc_accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen,
@@ -110,4 +110,4 @@ extern int grpc_forbid_dualstack_sockets_for_testing;
int grpc_create_dualstack_socket(const struct sockaddr *addr, int type,
int protocol, grpc_dualstack_mode *dsmode);
-#endif /* GRPC_CORE_IOMGR_SOCKET_UTILS_POSIX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_UTILS_POSIX_H */
diff --git a/src/core/iomgr/socket_windows.c b/src/core/lib/iomgr/socket_windows.c
index fafb7b6622..1023a6d4f8 100644
--- a/src/core/iomgr/socket_windows.c
+++ b/src/core/lib/iomgr/socket_windows.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,6 +36,8 @@
#ifdef GPR_WINSOCK_SOCKET
#include <winsock2.h>
+
+// must be included after winsock2.h
#include <mswsock.h>
#include <grpc/support/alloc.h>
@@ -43,11 +45,11 @@
#include <grpc/support/log_win32.h>
#include <grpc/support/string_util.h>
-#include "src/core/iomgr/iocp_windows.h"
-#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/pollset.h"
-#include "src/core/iomgr/pollset_windows.h"
-#include "src/core/iomgr/socket_windows.h"
+#include "src/core/lib/iomgr/iocp_windows.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/iomgr/pollset_windows.h"
+#include "src/core/lib/iomgr/socket_windows.h"
grpc_winsocket *grpc_winsocket_create(SOCKET socket, const char *name) {
char *final_name;
diff --git a/src/core/iomgr/socket_windows.h b/src/core/lib/iomgr/socket_windows.h
index 8e50e7a953..74447896c9 100644
--- a/src/core/iomgr/socket_windows.h
+++ b/src/core/lib/iomgr/socket_windows.h
@@ -31,17 +31,17 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_SOCKET_WINDOWS_H
-#define GRPC_CORE_IOMGR_SOCKET_WINDOWS_H
+#ifndef GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H
+#define GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H
#include <grpc/support/port_platform.h>
#include <winsock2.h>
-#include <grpc/support/sync.h>
#include <grpc/support/atm.h>
+#include <grpc/support/sync.h>
-#include "src/core/iomgr/iomgr_internal.h"
-#include "src/core/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
/* This holds the data for an outstanding read or write on a socket.
The mutex to protect the concurrent access to that data is the one
@@ -108,4 +108,4 @@ void grpc_winsocket_shutdown(grpc_winsocket *socket);
/* Destroy a socket. Should only be called if there's no pending operation. */
void grpc_winsocket_destroy(grpc_winsocket *socket);
-#endif /* GRPC_CORE_IOMGR_SOCKET_WINDOWS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H */
diff --git a/src/core/iomgr/tcp_client.h b/src/core/lib/iomgr/tcp_client.h
index 2e29833b70..6bbe26445a 100644
--- a/src/core/iomgr/tcp_client.h
+++ b/src/core/lib/iomgr/tcp_client.h
@@ -31,13 +31,13 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_TCP_CLIENT_H
-#define GRPC_CORE_IOMGR_TCP_CLIENT_H
+#ifndef GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H
+#define GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H
-#include "src/core/iomgr/endpoint.h"
-#include "src/core/iomgr/pollset_set.h"
-#include "src/core/iomgr/sockaddr.h"
#include <grpc/support/time.h>
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/pollset_set.h"
+#include "src/core/lib/iomgr/sockaddr.h"
/* Asynchronously connect to an address (specified as (addr, len)), and call
cb with arg and the completed connection when done (or call cb with arg and
@@ -50,4 +50,4 @@ void grpc_tcp_client_connect(grpc_exec_ctx *exec_ctx, grpc_closure *on_connect,
const struct sockaddr *addr, size_t addr_len,
gpr_timespec deadline);
-#endif /* GRPC_CORE_IOMGR_TCP_CLIENT_H */
+#endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H */
diff --git a/src/core/iomgr/tcp_client_posix.c b/src/core/lib/iomgr/tcp_client_posix.c
index 15727856ab..b8ef643298 100644
--- a/src/core/iomgr/tcp_client_posix.c
+++ b/src/core/lib/iomgr/tcp_client_posix.c
@@ -35,7 +35,7 @@
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/tcp_client.h"
+#include "src/core/lib/iomgr/tcp_client.h"
#include <errno.h>
#include <netinet/in.h>
@@ -47,14 +47,15 @@
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
-#include "src/core/iomgr/iomgr_posix.h"
-#include "src/core/iomgr/pollset_posix.h"
-#include "src/core/iomgr/pollset_set_posix.h"
-#include "src/core/iomgr/sockaddr_utils.h"
-#include "src/core/iomgr/socket_utils_posix.h"
-#include "src/core/iomgr/tcp_posix.h"
-#include "src/core/iomgr/timer.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/iomgr/iomgr_posix.h"
+#include "src/core/lib/iomgr/pollset_posix.h"
+#include "src/core/lib/iomgr/pollset_set_posix.h"
+#include "src/core/lib/iomgr/sockaddr_utils.h"
+#include "src/core/lib/iomgr/socket_utils_posix.h"
+#include "src/core/lib/iomgr/tcp_posix.h"
+#include "src/core/lib/iomgr/timer.h"
+#include "src/core/lib/iomgr/unix_sockets_posix.h"
+#include "src/core/lib/support/string.h"
extern int grpc_tcp_trace;
@@ -77,13 +78,12 @@ static int prepare_socket(const struct sockaddr *addr, int fd) {
}
if (!grpc_set_socket_nonblocking(fd, 1) || !grpc_set_socket_cloexec(fd, 1) ||
- (addr->sa_family != AF_UNIX && !grpc_set_socket_low_latency(fd, 1)) ||
+ (!grpc_is_unix_socket(addr) && !grpc_set_socket_low_latency(fd, 1)) ||
!grpc_set_socket_no_sigpipe_if_possible(fd)) {
gpr_log(GPR_ERROR, "Unable to configure socket %d: %s", fd,
strerror(errno));
goto error;
}
-
return 1;
error:
diff --git a/src/core/iomgr/tcp_client_windows.c b/src/core/lib/iomgr/tcp_client_windows.c
index 689c6f7b10..86b8d58975 100644
--- a/src/core/iomgr/tcp_client_windows.c
+++ b/src/core/lib/iomgr/tcp_client_windows.c
@@ -35,7 +35,7 @@
#ifdef GPR_WINSOCK_SOCKET
-#include "src/core/iomgr/sockaddr_win32.h"
+#include "src/core/lib/iomgr/sockaddr_win32.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -43,13 +43,13 @@
#include <grpc/support/slice_buffer.h>
#include <grpc/support/useful.h>
-#include "src/core/iomgr/timer.h"
-#include "src/core/iomgr/iocp_windows.h"
-#include "src/core/iomgr/tcp_client.h"
-#include "src/core/iomgr/tcp_windows.h"
-#include "src/core/iomgr/sockaddr.h"
-#include "src/core/iomgr/sockaddr_utils.h"
-#include "src/core/iomgr/socket_windows.h"
+#include "src/core/lib/iomgr/iocp_windows.h"
+#include "src/core/lib/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/sockaddr_utils.h"
+#include "src/core/lib/iomgr/socket_windows.h"
+#include "src/core/lib/iomgr/tcp_client.h"
+#include "src/core/lib/iomgr/tcp_windows.h"
+#include "src/core/lib/iomgr/timer.h"
typedef struct {
grpc_closure *on_done;
diff --git a/src/core/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c
index f74eb3fe51..1898d96901 100644
--- a/src/core/iomgr/tcp_posix.c
+++ b/src/core/lib/iomgr/tcp_posix.c
@@ -35,7 +35,7 @@
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/tcp_posix.h"
+#include "src/core/lib/iomgr/tcp_posix.h"
#include <errno.h>
#include <stdlib.h>
@@ -51,11 +51,11 @@
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
-#include "src/core/debug/trace.h"
-#include "src/core/iomgr/pollset_posix.h"
-#include "src/core/iomgr/pollset_set_posix.h"
-#include "src/core/profiling/timers.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/debug/trace.h"
+#include "src/core/lib/iomgr/pollset_posix.h"
+#include "src/core/lib/iomgr/pollset_set_posix.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/support/string.h"
#ifdef GPR_HAVE_MSG_NOSIGNAL
#define SENDMSG_FLAGS MSG_NOSIGNAL
@@ -297,7 +297,7 @@ static flush_result tcp_flush(grpc_tcp *tcp) {
unwind_slice_idx = tcp->outgoing_slice_idx;
unwind_byte_idx = tcp->outgoing_byte_idx;
for (iov_size = 0; tcp->outgoing_slice_idx != tcp->outgoing_buffer->count &&
- iov_size != MAX_WRITE_IOVEC;
+ iov_size != MAX_WRITE_IOVEC;
iov_size++) {
iov[iov_size].iov_base =
GPR_SLICE_START_PTR(
@@ -446,7 +446,7 @@ static char *tcp_get_peer(grpc_endpoint *ep) {
}
static const grpc_endpoint_vtable vtable = {
- tcp_read, tcp_write, tcp_add_to_pollset, tcp_add_to_pollset_set,
+ tcp_read, tcp_write, tcp_add_to_pollset, tcp_add_to_pollset_set,
tcp_shutdown, tcp_destroy, tcp_get_peer};
grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd, size_t slice_size,
diff --git a/src/core/iomgr/tcp_posix.h b/src/core/lib/iomgr/tcp_posix.h
index d846ec570f..09c4436f1f 100644
--- a/src/core/iomgr/tcp_posix.h
+++ b/src/core/lib/iomgr/tcp_posix.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_TCP_POSIX_H
-#define GRPC_CORE_IOMGR_TCP_POSIX_H
+#ifndef GRPC_CORE_LIB_IOMGR_TCP_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_TCP_POSIX_H
/*
Low level TCP "bottom half" implementation, for use by transports built on
top of a TCP connection.
@@ -44,8 +44,8 @@
otherwise specified.
*/
-#include "src/core/iomgr/endpoint.h"
-#include "src/core/iomgr/fd_posix.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/fd_posix.h"
#define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192
@@ -68,4 +68,4 @@ int grpc_tcp_fd(grpc_endpoint *ep);
void grpc_tcp_destroy_and_release_fd(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
int *fd, grpc_closure *done);
-#endif /* GRPC_CORE_IOMGR_TCP_POSIX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_TCP_POSIX_H */
diff --git a/src/core/iomgr/tcp_server.h b/src/core/lib/iomgr/tcp_server.h
index 93247e9e4e..81edb61997 100644
--- a/src/core/iomgr/tcp_server.h
+++ b/src/core/lib/iomgr/tcp_server.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_TCP_SERVER_H
-#define GRPC_CORE_IOMGR_TCP_SERVER_H
+#ifndef GRPC_CORE_LIB_IOMGR_TCP_SERVER_H
+#define GRPC_CORE_LIB_IOMGR_TCP_SERVER_H
-#include "src/core/iomgr/closure.h"
-#include "src/core/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/closure.h"
+#include "src/core/lib/iomgr/endpoint.h"
/* Forward decl of grpc_tcp_server */
typedef struct grpc_tcp_server grpc_tcp_server;
@@ -100,4 +100,4 @@ void grpc_tcp_server_shutdown_starting_add(grpc_tcp_server *s,
a call (exec_ctx!=NULL) to shutdown_complete. */
void grpc_tcp_server_unref(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s);
-#endif /* GRPC_CORE_IOMGR_TCP_SERVER_H */
+#endif /* GRPC_CORE_LIB_IOMGR_TCP_SERVER_H */
diff --git a/src/core/iomgr/tcp_server_posix.c b/src/core/lib/iomgr/tcp_server_posix.c
index 5e07f8261c..ef1bf9aa94 100644
--- a/src/core/iomgr/tcp_server_posix.c
+++ b/src/core/lib/iomgr/tcp_server_posix.c
@@ -40,7 +40,7 @@
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/tcp_server.h"
+#include "src/core/lib/iomgr/tcp_server.h"
#include <errno.h>
#include <fcntl.h>
@@ -52,20 +52,20 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/un.h>
#include <unistd.h>
-#include "src/core/iomgr/pollset_posix.h"
-#include "src/core/iomgr/resolve_address.h"
-#include "src/core/iomgr/sockaddr_utils.h"
-#include "src/core/iomgr/socket_utils_posix.h"
-#include "src/core/iomgr/tcp_posix.h"
-#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
+#include "src/core/lib/iomgr/pollset_posix.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+#include "src/core/lib/iomgr/sockaddr_utils.h"
+#include "src/core/lib/iomgr/socket_utils_posix.h"
+#include "src/core/lib/iomgr/tcp_posix.h"
+#include "src/core/lib/iomgr/unix_sockets_posix.h"
+#include "src/core/lib/support/string.h"
#define MIN_SAFE_ACCEPT_QUEUE_SIZE 100
@@ -81,7 +81,6 @@ struct grpc_tcp_listener {
union {
uint8_t untyped[GRPC_MAX_SOCKADDR_SIZE];
struct sockaddr sockaddr;
- struct sockaddr_un un;
} addr;
size_t addr_len;
int port;
@@ -98,14 +97,6 @@ struct grpc_tcp_listener {
int is_sibling;
};
-static void unlink_if_unix_domain_socket(const struct sockaddr_un *un) {
- struct stat st;
-
- if (stat(un->sun_path, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) {
- unlink(un->sun_path);
- }
-}
-
/* the overall server */
struct grpc_tcp_server {
gpr_refcount refs;
@@ -203,9 +194,7 @@ static void deactivated_all_ports(grpc_exec_ctx *exec_ctx, grpc_tcp_server *s) {
if (s->head) {
grpc_tcp_listener *sp;
for (sp = s->head; sp; sp = sp->next) {
- if (sp->addr.sockaddr.sa_family == AF_UNIX) {
- unlink_if_unix_domain_socket(&sp->addr.un);
- }
+ grpc_unlink_if_unix_domain_socket(&sp->addr.sockaddr);
sp->destroyed_closure.cb = destroyed_port;
sp->destroyed_closure.cb_arg = s;
grpc_fd_orphan(exec_ctx, sp->emfd, &sp->destroyed_closure, NULL,
@@ -281,7 +270,7 @@ static int prepare_socket(int fd, const struct sockaddr *addr,
}
if (!grpc_set_socket_nonblocking(fd, 1) || !grpc_set_socket_cloexec(fd, 1) ||
- (addr->sa_family != AF_UNIX && (!grpc_set_socket_low_latency(fd, 1) ||
+ (!grpc_is_unix_socket(addr) && (!grpc_set_socket_low_latency(fd, 1) ||
!grpc_set_socket_reuse_addr(fd, 1))) ||
!grpc_set_socket_no_sigpipe_if_possible(fd)) {
gpr_log(GPR_ERROR, "Unable to configure socket %d: %s", fd,
@@ -451,9 +440,7 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr,
if (s->tail != NULL) {
port_index = s->tail->port_index + 1;
}
- if (((struct sockaddr *)addr)->sa_family == AF_UNIX) {
- unlink_if_unix_domain_socket(addr);
- }
+ grpc_unlink_if_unix_domain_socket((struct sockaddr *)addr);
/* Check if this is a wildcard port, and if so, try to keep the port the same
as some previously created listener. */
@@ -499,7 +486,6 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr,
/* If we didn't get a dualstack socket, also listen on 0.0.0.0. */
if (port == 0 && sp != NULL) {
grpc_sockaddr_set_port((struct sockaddr *)&wild4, sp->port);
- sp2 = sp;
}
addr = (struct sockaddr *)&wild4;
addr_len = sizeof(wild4);
@@ -508,16 +494,18 @@ int grpc_tcp_server_add_port(grpc_tcp_server *s, const void *addr,
fd = grpc_create_dualstack_socket(addr, SOCK_STREAM, 0, &dsmode);
if (fd < 0) {
gpr_log(GPR_ERROR, "Unable to create socket: %s", strerror(errno));
- }
- if (dsmode == GRPC_DSMODE_IPV4 &&
- grpc_sockaddr_is_v4mapped(addr, &addr4_copy)) {
- addr = (struct sockaddr *)&addr4_copy;
- addr_len = sizeof(addr4_copy);
- }
- sp = add_socket_to_server(s, fd, addr, addr_len, port_index, fd_index);
- if (sp2 != NULL && sp != NULL) {
- sp2->sibling = sp;
- sp->is_sibling = 1;
+ } else {
+ if (dsmode == GRPC_DSMODE_IPV4 &&
+ grpc_sockaddr_is_v4mapped(addr, &addr4_copy)) {
+ addr = (struct sockaddr *)&addr4_copy;
+ addr_len = sizeof(addr4_copy);
+ }
+ sp2 = sp;
+ sp = add_socket_to_server(s, fd, addr, addr_len, port_index, fd_index);
+ if (sp2 != NULL && sp != NULL) {
+ sp2->sibling = sp;
+ sp->is_sibling = 1;
+ }
}
done:
diff --git a/src/core/iomgr/tcp_server_windows.c b/src/core/lib/iomgr/tcp_server_windows.c
index a4abc5b974..3d6a29b2e2 100644
--- a/src/core/iomgr/tcp_server_windows.c
+++ b/src/core/lib/iomgr/tcp_server_windows.c
@@ -37,7 +37,7 @@
#include <io.h>
-#include "src/core/iomgr/sockaddr_utils.h"
+#include "src/core/lib/iomgr/sockaddr_utils.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -46,11 +46,11 @@
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
-#include "src/core/iomgr/iocp_windows.h"
-#include "src/core/iomgr/pollset_windows.h"
-#include "src/core/iomgr/socket_windows.h"
-#include "src/core/iomgr/tcp_server.h"
-#include "src/core/iomgr/tcp_windows.h"
+#include "src/core/lib/iomgr/iocp_windows.h"
+#include "src/core/lib/iomgr/pollset_windows.h"
+#include "src/core/lib/iomgr/socket_windows.h"
+#include "src/core/lib/iomgr/tcp_server.h"
+#include "src/core/lib/iomgr/tcp_windows.h"
#define MIN_SAFE_ACCEPT_QUEUE_SIZE 100
diff --git a/src/core/iomgr/tcp_windows.c b/src/core/lib/iomgr/tcp_windows.c
index 038e4158c8..c1ce725f2c 100644
--- a/src/core/iomgr/tcp_windows.c
+++ b/src/core/lib/iomgr/tcp_windows.c
@@ -35,7 +35,7 @@
#ifdef GPR_WINSOCK_SOCKET
-#include "src/core/iomgr/sockaddr_win32.h"
+#include "src/core/lib/iomgr/sockaddr_win32.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -44,12 +44,12 @@
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
-#include "src/core/iomgr/timer.h"
-#include "src/core/iomgr/iocp_windows.h"
-#include "src/core/iomgr/sockaddr.h"
-#include "src/core/iomgr/sockaddr_utils.h"
-#include "src/core/iomgr/socket_windows.h"
-#include "src/core/iomgr/tcp_client.h"
+#include "src/core/lib/iomgr/iocp_windows.h"
+#include "src/core/lib/iomgr/sockaddr.h"
+#include "src/core/lib/iomgr/sockaddr_utils.h"
+#include "src/core/lib/iomgr/socket_windows.h"
+#include "src/core/lib/iomgr/tcp_client.h"
+#include "src/core/lib/iomgr/timer.h"
static int set_non_block(SOCKET sock) {
int status;
@@ -146,8 +146,8 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *tcpp, bool success) {
grpc_winsocket_callback_info *info = &socket->read_info;
if (success) {
- if (socket->read_info.wsa_error != 0 && !tcp->shutting_down) {
- if (socket->read_info.wsa_error != WSAECONNRESET) {
+ if (info->wsa_error != 0 && !tcp->shutting_down) {
+ if (info->wsa_error != WSAECONNRESET) {
char *utf8_message = gpr_format_message(info->wsa_error);
gpr_log(GPR_ERROR, "ReadFile overlapped error: %s", utf8_message);
gpr_free(utf8_message);
@@ -306,7 +306,7 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
ok = true;
GPR_ASSERT(bytes_sent == tcp->write_slices->length);
} else {
- if (socket->read_info.wsa_error != WSAECONNRESET) {
+ if (info->wsa_error != WSAECONNRESET) {
char *utf8_message = gpr_format_message(info->wsa_error);
gpr_log(GPR_ERROR, "WSASend error: %s", utf8_message);
gpr_free(utf8_message);
@@ -382,9 +382,9 @@ static char *win_get_peer(grpc_endpoint *ep) {
return gpr_strdup(tcp->peer_string);
}
-static grpc_endpoint_vtable vtable = {win_read, win_write, win_add_to_pollset,
- win_add_to_pollset_set, win_shutdown,
- win_destroy, win_get_peer};
+static grpc_endpoint_vtable vtable = {
+ win_read, win_write, win_add_to_pollset, win_add_to_pollset_set,
+ win_shutdown, win_destroy, win_get_peer};
grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket, char *peer_string) {
grpc_tcp *tcp = (grpc_tcp *)gpr_malloc(sizeof(grpc_tcp));
diff --git a/src/core/iomgr/tcp_windows.h b/src/core/lib/iomgr/tcp_windows.h
index 78bc13389a..7a9ebd85eb 100644
--- a/src/core/iomgr/tcp_windows.h
+++ b/src/core/lib/iomgr/tcp_windows.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_TCP_WINDOWS_H
-#define GRPC_CORE_IOMGR_TCP_WINDOWS_H
+#ifndef GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H
+#define GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H
/*
Low level TCP "bottom half" implementation, for use by transports built on
top of a TCP connection.
@@ -44,8 +44,8 @@
otherwise specified.
*/
-#include "src/core/iomgr/endpoint.h"
-#include "src/core/iomgr/socket_windows.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/socket_windows.h"
/* Create a tcp endpoint given a winsock handle.
* Takes ownership of the handle.
@@ -54,4 +54,4 @@ grpc_endpoint *grpc_tcp_create(grpc_winsocket *socket, char *peer_string);
int grpc_tcp_prepare_socket(SOCKET sock);
-#endif /* GRPC_CORE_IOMGR_TCP_WINDOWS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H */
diff --git a/src/core/iomgr/time_averaged_stats.c b/src/core/lib/iomgr/time_averaged_stats.c
index e075db4373..f24d68087e 100644
--- a/src/core/iomgr/time_averaged_stats.c
+++ b/src/core/lib/iomgr/time_averaged_stats.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/iomgr/time_averaged_stats.h"
+#include "src/core/lib/iomgr/time_averaged_stats.h"
void grpc_time_averaged_stats_init(grpc_time_averaged_stats* stats,
double init_avg, double regress_weight,
diff --git a/src/core/iomgr/time_averaged_stats.h b/src/core/lib/iomgr/time_averaged_stats.h
index 048e244bcc..4a662e17ec 100644
--- a/src/core/iomgr/time_averaged_stats.h
+++ b/src/core/lib/iomgr/time_averaged_stats.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_TIME_AVERAGED_STATS_H
-#define GRPC_CORE_IOMGR_TIME_AVERAGED_STATS_H
+#ifndef GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H
+#define GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H
/* This tracks a time-decaying weighted average. It works by collecting
batches of samples and then mixing their average into a time-decaying
@@ -85,4 +85,4 @@ void grpc_time_averaged_stats_add_sample(grpc_time_averaged_stats* stats,
value. */
double grpc_time_averaged_stats_update_average(grpc_time_averaged_stats* stats);
-#endif /* GRPC_CORE_IOMGR_TIME_AVERAGED_STATS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_TIME_AVERAGED_STATS_H */
diff --git a/src/core/iomgr/timer.c b/src/core/lib/iomgr/timer.c
index f444643428..4748f9b270 100644
--- a/src/core/iomgr/timer.c
+++ b/src/core/lib/iomgr/timer.c
@@ -31,13 +31,13 @@
*
*/
-#include "src/core/iomgr/timer.h"
+#include "src/core/lib/iomgr/timer.h"
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
-#include "src/core/iomgr/time_averaged_stats.h"
-#include "src/core/iomgr/timer_heap.h"
+#include "src/core/lib/iomgr/time_averaged_stats.h"
+#include "src/core/lib/iomgr/timer_heap.h"
#define INVALID_HEAP_INDEX 0xffffffffu
diff --git a/src/core/iomgr/timer.h b/src/core/lib/iomgr/timer.h
index 63505df427..54f301c5ed 100644
--- a/src/core/iomgr/timer.h
+++ b/src/core/lib/iomgr/timer.h
@@ -31,13 +31,13 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_TIMER_H
-#define GRPC_CORE_IOMGR_TIMER_H
+#ifndef GRPC_CORE_LIB_IOMGR_TIMER_H
+#define GRPC_CORE_LIB_IOMGR_TIMER_H
-#include "src/core/iomgr/iomgr.h"
-#include "src/core/iomgr/exec_ctx.h"
#include <grpc/support/port_platform.h>
#include <grpc/support/time.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/iomgr.h"
typedef struct grpc_timer {
gpr_timespec deadline;
@@ -105,4 +105,4 @@ void grpc_timer_list_shutdown(grpc_exec_ctx *exec_ctx);
void grpc_kick_poller(void);
-#endif /* GRPC_CORE_IOMGR_TIMER_H */
+#endif /* GRPC_CORE_LIB_IOMGR_TIMER_H */
diff --git a/src/core/iomgr/timer_heap.c b/src/core/lib/iomgr/timer_heap.c
index b5df566c45..d43b6ccf75 100644
--- a/src/core/iomgr/timer_heap.c
+++ b/src/core/lib/iomgr/timer_heap.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/iomgr/timer_heap.h"
+#include "src/core/lib/iomgr/timer_heap.h"
#include <string.h>
diff --git a/src/core/iomgr/timer_heap.h b/src/core/lib/iomgr/timer_heap.h
index c2912ef45d..d5112cf0de 100644
--- a/src/core/iomgr/timer_heap.h
+++ b/src/core/lib/iomgr/timer_heap.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_TIMER_HEAP_H
-#define GRPC_CORE_IOMGR_TIMER_HEAP_H
+#ifndef GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H
+#define GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H
-#include "src/core/iomgr/timer.h"
+#include "src/core/lib/iomgr/timer.h"
typedef struct {
grpc_timer **timers;
@@ -54,4 +54,4 @@ void grpc_timer_heap_pop(grpc_timer_heap *heap);
int grpc_timer_heap_is_empty(grpc_timer_heap *heap);
-#endif /* GRPC_CORE_IOMGR_TIMER_HEAP_H */
+#endif /* GRPC_CORE_LIB_IOMGR_TIMER_HEAP_H */
diff --git a/src/core/iomgr/udp_server.c b/src/core/lib/iomgr/udp_server.c
index ef548cfe4d..3d8bcc9c81 100644
--- a/src/core/iomgr/udp_server.c
+++ b/src/core/lib/iomgr/udp_server.c
@@ -41,7 +41,7 @@
#ifdef GRPC_NEED_UDP
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/udp_server.h"
+#include "src/core/lib/iomgr/udp_server.h"
#include <errno.h>
#include <fcntl.h>
@@ -52,20 +52,21 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/un.h>
#include <unistd.h>
-#include "src/core/iomgr/fd_posix.h"
-#include "src/core/iomgr/pollset_posix.h"
-#include "src/core/iomgr/resolve_address.h"
-#include "src/core/iomgr/sockaddr_utils.h"
-#include "src/core/iomgr/socket_utils_posix.h"
-#include "src/core/support/string.h"
+#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/sync.h>
#include <grpc/support/string_util.h>
+#include <grpc/support/sync.h>
#include <grpc/support/time.h>
+#include "src/core/lib/iomgr/fd_posix.h"
+#include "src/core/lib/iomgr/pollset_posix.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+#include "src/core/lib/iomgr/sockaddr_utils.h"
+#include "src/core/lib/iomgr/socket_utils_posix.h"
+#include "src/core/lib/iomgr/unix_sockets_posix.h"
+#include "src/core/lib/support/string.h"
#define INIT_PORT_CAP 2
@@ -77,7 +78,6 @@ typedef struct {
union {
uint8_t untyped[GRPC_MAX_SOCKADDR_SIZE];
struct sockaddr sockaddr;
- struct sockaddr_un un;
} addr;
size_t addr_len;
grpc_closure read_closure;
@@ -85,14 +85,6 @@ typedef struct {
grpc_udp_server_read_cb read_cb;
} server_port;
-static void unlink_if_unix_domain_socket(const struct sockaddr_un *un) {
- struct stat st;
-
- if (stat(un->sun_path, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) {
- unlink(un->sun_path);
- }
-}
-
/* the overall server */
struct grpc_udp_server {
gpr_mu mu;
@@ -176,9 +168,7 @@ static void deactivated_all_ports(grpc_exec_ctx *exec_ctx, grpc_udp_server *s) {
if (s->nports) {
for (i = 0; i < s->nports; i++) {
server_port *sp = &s->ports[i];
- if (sp->addr.sockaddr.sa_family == AF_UNIX) {
- unlink_if_unix_domain_socket(&sp->addr.un);
- }
+ grpc_unlink_if_unix_domain_socket(&sp->addr.sockaddr);
sp->destroyed_closure.cb = destroyed_port;
sp->destroyed_closure.cb_arg = s;
grpc_fd_orphan(exec_ctx, sp->emfd, &sp->destroyed_closure, NULL,
@@ -336,9 +326,7 @@ int grpc_udp_server_add_port(grpc_udp_server *s, const void *addr,
socklen_t sockname_len;
int port;
- if (((struct sockaddr *)addr)->sa_family == AF_UNIX) {
- unlink_if_unix_domain_socket(addr);
- }
+ grpc_unlink_if_unix_domain_socket((struct sockaddr *)addr);
/* Check if this is a wildcard port, and if so, try to keep the port the same
as some previously created listener. */
diff --git a/src/core/iomgr/udp_server.h b/src/core/lib/iomgr/udp_server.h
index 1e59a92392..316845ad66 100644
--- a/src/core/iomgr/udp_server.h
+++ b/src/core/lib/iomgr/udp_server.h
@@ -31,21 +31,22 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_UDP_SERVER_H
-#define GRPC_CORE_IOMGR_UDP_SERVER_H
+#ifndef GRPC_CORE_LIB_IOMGR_UDP_SERVER_H
+#define GRPC_CORE_LIB_IOMGR_UDP_SERVER_H
-#include "src/core/iomgr/endpoint.h"
-#include "src/core/iomgr/fd_posix.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/fd_posix.h"
-/* Forward decl of grpc_server */
-typedef struct grpc_server grpc_server;
+/* Forward decl of struct grpc_server */
+/* This is not typedef'ed to avoid a typedef-redefinition error */
+struct grpc_server;
/* Forward decl of grpc_udp_server */
typedef struct grpc_udp_server grpc_udp_server;
/* Called when data is available to read from the socket. */
typedef void (*grpc_udp_server_read_cb)(grpc_exec_ctx *exec_ctx, grpc_fd *emfd,
- grpc_server *server);
+ struct grpc_server *server);
/* Create a server, initially not bound to any ports */
grpc_udp_server *grpc_udp_server_create(void);
@@ -53,7 +54,7 @@ grpc_udp_server *grpc_udp_server_create(void);
/* Start listening to bound ports */
void grpc_udp_server_start(grpc_exec_ctx *exec_ctx, grpc_udp_server *udp_server,
grpc_pollset **pollsets, size_t pollset_count,
- grpc_server *server);
+ struct grpc_server *server);
int grpc_udp_server_get_fd(grpc_udp_server *s, unsigned index);
@@ -73,4 +74,4 @@ int grpc_udp_server_add_port(grpc_udp_server *s, const void *addr,
void grpc_udp_server_destroy(grpc_exec_ctx *exec_ctx, grpc_udp_server *server,
grpc_closure *on_done);
-#endif /* GRPC_CORE_IOMGR_UDP_SERVER_H */
+#endif /* GRPC_CORE_LIB_IOMGR_UDP_SERVER_H */
diff --git a/src/core/lib/iomgr/unix_sockets_posix.c b/src/core/lib/iomgr/unix_sockets_posix.c
new file mode 100644
index 0000000000..42e44989e0
--- /dev/null
+++ b/src/core/lib/iomgr/unix_sockets_posix.c
@@ -0,0 +1,103 @@
+/*
+ *
+ * Copyright 2016, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "src/core/lib/iomgr/unix_sockets_posix.h"
+
+#ifdef GPR_HAVE_UNIX_SOCKET
+
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/un.h>
+
+#include <grpc/support/alloc.h>
+
+void grpc_create_socketpair_if_unix(int sv[2]) {
+ GPR_ASSERT(socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == 0);
+}
+
+grpc_resolved_addresses *grpc_resolve_unix_domain_address(const char *name) {
+ struct sockaddr_un *un;
+
+ grpc_resolved_addresses *addrs = gpr_malloc(sizeof(grpc_resolved_addresses));
+ addrs->naddrs = 1;
+ addrs->addrs = gpr_malloc(sizeof(grpc_resolved_address));
+ un = (struct sockaddr_un *)addrs->addrs->addr;
+ un->sun_family = AF_UNIX;
+ strcpy(un->sun_path, name);
+ addrs->addrs->len = strlen(un->sun_path) + sizeof(un->sun_family) + 1;
+ return addrs;
+}
+
+int grpc_is_unix_socket(const struct sockaddr *addr) {
+ return addr->sa_family == AF_UNIX;
+}
+
+void grpc_unlink_if_unix_domain_socket(const struct sockaddr *addr) {
+ if (addr->sa_family != AF_UNIX) {
+ return;
+ }
+ struct sockaddr_un *un = (struct sockaddr_un *)addr;
+ struct stat st;
+
+ if (stat(un->sun_path, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) {
+ unlink(un->sun_path);
+ }
+}
+
+int grpc_parse_unix(grpc_uri *uri, struct sockaddr_storage *addr, size_t *len) {
+ struct sockaddr_un *un = (struct sockaddr_un *)addr;
+
+ un->sun_family = AF_UNIX;
+ strcpy(un->sun_path, uri->path);
+ *len = strlen(un->sun_path) + sizeof(un->sun_family) + 1;
+
+ return 1;
+}
+
+char *grpc_unix_get_default_authority(grpc_resolver_factory *factory,
+ grpc_uri *uri) {
+ return gpr_strdup("localhost");
+}
+
+char *grpc_sockaddr_to_uri_unix_if_possible(const struct sockaddr *addr) {
+ if (addr->sa_family != AF_UNIX) {
+ return NULL;
+ }
+
+ char *result;
+ gpr_asprintf(&result, "unix:%s", ((struct sockaddr_un *)addr)->sun_path);
+ return result;
+}
+
+#endif
diff --git a/src/core/channel/client_uchannel.h b/src/core/lib/iomgr/unix_sockets_posix.h
index 8bb288e7d4..752cab85a5 100644
--- a/src/core/channel/client_uchannel.h
+++ b/src/core/lib/iomgr/unix_sockets_posix.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015-2016, Google Inc.
+ * Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,30 +31,31 @@
*
*/
-#ifndef GRPC_CORE_CHANNEL_CLIENT_UCHANNEL_H
-#define GRPC_CORE_CHANNEL_CLIENT_UCHANNEL_H
+#ifndef GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H
-#include "src/core/channel/channel_stack.h"
-#include "src/core/client_config/resolver.h"
+#include <grpc/support/port_platform.h>
-#define GRPC_MICROCHANNEL_SUBCHANNEL_ARG "grpc.microchannel_subchannel_key"
+#include <grpc/support/string_util.h>
-/* A client microchannel (aka uchannel) is a channel wrapping a subchannel, for
- * the purposes of lightweight RPC communications from within the core.*/
+#include "src/core/lib/client_config/resolver_factory.h"
+#include "src/core/lib/client_config/uri_parser.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+#include "src/core/lib/iomgr/sockaddr.h"
-extern const grpc_channel_filter grpc_client_uchannel_filter;
+void grpc_create_socketpair_if_unix(int sv[2]);
-grpc_connectivity_state grpc_client_uchannel_check_connectivity_state(
- grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, int try_to_connect);
+grpc_resolved_addresses *grpc_resolve_unix_domain_address(const char *name);
-void grpc_client_uchannel_watch_connectivity_state(
- grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_pollset *pollset,
- grpc_connectivity_state *state, grpc_closure *on_complete);
+int grpc_is_unix_socket(const struct sockaddr *addr);
-grpc_channel *grpc_client_uchannel_create(grpc_subchannel *subchannel,
- grpc_channel_args *args);
+void grpc_unlink_if_unix_domain_socket(const struct sockaddr *addr);
-void grpc_client_uchannel_set_connected_subchannel(
- grpc_channel *uchannel, grpc_connected_subchannel *connected_subchannel);
+int grpc_parse_unix(grpc_uri *uri, struct sockaddr_storage *addr, size_t *len);
-#endif /* GRPC_CORE_CHANNEL_CLIENT_UCHANNEL_H */
+char *grpc_unix_get_default_authority(grpc_resolver_factory *factory,
+ grpc_uri *uri);
+
+char *grpc_sockaddr_to_uri_unix_if_possible(const struct sockaddr *addr);
+
+#endif /* GRPC_CORE_LIB_IOMGR_UNIX_SOCKETS_POSIX_H */
diff --git a/src/core/httpcli/parser.h b/src/core/lib/iomgr/unix_sockets_posix_noop.c
index cd4a737245..06f6ee05e7 100644
--- a/src/core/httpcli/parser.h
+++ b/src/core/lib/iomgr/unix_sockets_posix_noop.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015-2016, Google Inc.
+ * Copyright 2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,34 +31,31 @@
*
*/
-#ifndef GRPC_CORE_HTTPCLI_PARSER_H
-#define GRPC_CORE_HTTPCLI_PARSER_H
+#include "src/core/lib/iomgr/unix_sockets_posix.h"
-#include "src/core/httpcli/httpcli.h"
-#include <grpc/support/port_platform.h>
-#include <grpc/support/slice.h>
+#ifndef GPR_HAVE_UNIX_SOCKET
-typedef enum {
- GRPC_HTTPCLI_INITIAL_RESPONSE,
- GRPC_HTTPCLI_HEADERS,
- GRPC_HTTPCLI_BODY
-} grpc_httpcli_parser_state;
+void grpc_create_socketpair_if_unix(int sv[2]) {}
-typedef struct {
- grpc_httpcli_parser_state state;
+grpc_resolved_addresses *grpc_resolve_unix_domain_address(const char *name) {
+ return NULL;
+}
- grpc_httpcli_response r;
- size_t body_capacity;
- size_t hdr_capacity;
+int grpc_is_unix_socket(const struct sockaddr *addr) { return false; }
- uint8_t cur_line[GRPC_HTTPCLI_MAX_HEADER_LENGTH];
- size_t cur_line_length;
-} grpc_httpcli_parser;
+void grpc_unlink_if_unix_domain_socket(const struct sockaddr *addr) {}
-void grpc_httpcli_parser_init(grpc_httpcli_parser* parser);
-void grpc_httpcli_parser_destroy(grpc_httpcli_parser* parser);
+int grpc_parse_unix(grpc_uri *uri, struct sockaddr_storage *addr, size_t *len) {
+ return 0;
+}
-int grpc_httpcli_parser_parse(grpc_httpcli_parser* parser, gpr_slice slice);
-int grpc_httpcli_parser_eof(grpc_httpcli_parser* parser);
+char *grpc_unix_get_default_authority(grpc_resolver_factory *factory,
+ grpc_uri *uri) {
+ return NULL;
+}
-#endif /* GRPC_CORE_HTTPCLI_PARSER_H */
+char *grpc_sockaddr_to_uri_unix_if_possible(const struct sockaddr *addr) {
+ return NULL;
+}
+
+#endif
diff --git a/src/core/iomgr/wakeup_fd_eventfd.c b/src/core/lib/iomgr/wakeup_fd_eventfd.c
index f67379e4fc..41ded0ca4d 100644
--- a/src/core/iomgr/wakeup_fd_eventfd.c
+++ b/src/core/lib/iomgr/wakeup_fd_eventfd.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,8 @@
#include <grpc/support/log.h>
-#include "src/core/iomgr/wakeup_fd_posix.h"
-#include "src/core/profiling/timers.h"
+#include "src/core/lib/iomgr/wakeup_fd_posix.h"
+#include "src/core/lib/profiling/timers.h"
static void eventfd_create(grpc_wakeup_fd* fd_info) {
int efd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
diff --git a/src/core/iomgr/wakeup_fd_nospecial.c b/src/core/lib/iomgr/wakeup_fd_nospecial.c
index 78d763c103..39defa65c6 100644
--- a/src/core/iomgr/wakeup_fd_nospecial.c
+++ b/src/core/lib/iomgr/wakeup_fd_nospecial.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,8 +40,8 @@
#ifdef GPR_POSIX_NO_SPECIAL_WAKEUP_FD
-#include "src/core/iomgr/wakeup_fd_posix.h"
#include <stddef.h>
+#include "src/core/lib/iomgr/wakeup_fd_posix.h"
static int check_availability_invalid(void) { return 0; }
diff --git a/src/core/iomgr/wakeup_fd_pipe.c b/src/core/lib/iomgr/wakeup_fd_pipe.c
index 80de181d9d..820919e4dd 100644
--- a/src/core/iomgr/wakeup_fd_pipe.c
+++ b/src/core/lib/iomgr/wakeup_fd_pipe.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,19 +35,24 @@
#ifdef GPR_POSIX_WAKEUP_FD
-#include "src/core/iomgr/wakeup_fd_posix.h"
+#include "src/core/lib/iomgr/wakeup_fd_posix.h"
#include <errno.h>
#include <string.h>
#include <unistd.h>
-#include "src/core/iomgr/socket_utils_posix.h"
#include <grpc/support/log.h>
+#include "src/core/lib/iomgr/socket_utils_posix.h"
+
static void pipe_init(grpc_wakeup_fd* fd_info) {
int pipefd[2];
/* TODO(klempner): Make this nonfatal */
- GPR_ASSERT(0 == pipe(pipefd));
+ int r = pipe(pipefd);
+ if (0 != r) {
+ gpr_log(GPR_ERROR, "pipe creation failed (%d): %s", errno, strerror(errno));
+ abort();
+ }
GPR_ASSERT(grpc_set_socket_nonblocking(pipefd[0], 1));
GPR_ASSERT(grpc_set_socket_nonblocking(pipefd[1], 1));
fd_info->read_fd = pipefd[0];
diff --git a/src/core/iomgr/wakeup_fd_pipe.h b/src/core/lib/iomgr/wakeup_fd_pipe.h
index eb3e02b482..bbdb1fc448 100644
--- a/src/core/iomgr/wakeup_fd_pipe.h
+++ b/src/core/lib/iomgr/wakeup_fd_pipe.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_WAKEUP_FD_PIPE_H
-#define GRPC_CORE_IOMGR_WAKEUP_FD_PIPE_H
+#ifndef GRPC_CORE_LIB_IOMGR_WAKEUP_FD_PIPE_H
+#define GRPC_CORE_LIB_IOMGR_WAKEUP_FD_PIPE_H
-#include "src/core/iomgr/wakeup_fd_posix.h"
+#include "src/core/lib/iomgr/wakeup_fd_posix.h"
extern grpc_wakeup_fd_vtable grpc_pipe_wakeup_fd_vtable;
-#endif /* GRPC_CORE_IOMGR_WAKEUP_FD_PIPE_H */
+#endif /* GRPC_CORE_LIB_IOMGR_WAKEUP_FD_PIPE_H */
diff --git a/src/core/iomgr/wakeup_fd_posix.c b/src/core/lib/iomgr/wakeup_fd_posix.c
index f40be081b0..c4d174fb34 100644
--- a/src/core/iomgr/wakeup_fd_posix.c
+++ b/src/core/lib/iomgr/wakeup_fd_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,9 +35,9 @@
#ifdef GPR_POSIX_WAKEUP_FD
-#include "src/core/iomgr/wakeup_fd_posix.h"
-#include "src/core/iomgr/wakeup_fd_pipe.h"
#include <stddef.h>
+#include "src/core/lib/iomgr/wakeup_fd_pipe.h"
+#include "src/core/lib/iomgr/wakeup_fd_posix.h"
static const grpc_wakeup_fd_vtable *wakeup_fd_vtable = NULL;
int grpc_allow_specialized_wakeup_fd = 1;
diff --git a/src/core/iomgr/wakeup_fd_posix.h b/src/core/lib/iomgr/wakeup_fd_posix.h
index d7e3cf4673..20988d5fd3 100644
--- a/src/core/iomgr/wakeup_fd_posix.h
+++ b/src/core/lib/iomgr/wakeup_fd_posix.h
@@ -59,8 +59,8 @@
* 2. If the polling thread was awakened by a wakeup_fd event, call
* grpc_wakeup_fd_consume_wakeup() on it.
*/
-#ifndef GRPC_CORE_IOMGR_WAKEUP_FD_POSIX_H
-#define GRPC_CORE_IOMGR_WAKEUP_FD_POSIX_H
+#ifndef GRPC_CORE_LIB_IOMGR_WAKEUP_FD_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_WAKEUP_FD_POSIX_H
void grpc_wakeup_fd_global_init(void);
void grpc_wakeup_fd_global_destroy(void);
@@ -98,4 +98,4 @@ void grpc_wakeup_fd_destroy(grpc_wakeup_fd* fd_info);
* wakeup_fd_nospecial.c if no such implementation exists. */
extern const grpc_wakeup_fd_vtable grpc_specialized_wakeup_fd_vtable;
-#endif /* GRPC_CORE_IOMGR_WAKEUP_FD_POSIX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_WAKEUP_FD_POSIX_H */
diff --git a/src/core/iomgr/workqueue.h b/src/core/lib/iomgr/workqueue.h
index 2ba1e5d9a2..9c420c57de 100644
--- a/src/core/iomgr/workqueue.h
+++ b/src/core/lib/iomgr/workqueue.h
@@ -31,20 +31,20 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_WORKQUEUE_H
-#define GRPC_CORE_IOMGR_WORKQUEUE_H
+#ifndef GRPC_CORE_LIB_IOMGR_WORKQUEUE_H
+#define GRPC_CORE_LIB_IOMGR_WORKQUEUE_H
-#include "src/core/iomgr/iomgr.h"
-#include "src/core/iomgr/pollset.h"
-#include "src/core/iomgr/closure.h"
-#include "src/core/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/closure.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/iomgr.h"
+#include "src/core/lib/iomgr/pollset.h"
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/workqueue_posix.h"
+#include "src/core/lib/iomgr/workqueue_posix.h"
#endif
#ifdef GPR_WIN32
-#include "src/core/iomgr/workqueue_windows.h"
+#include "src/core/lib/iomgr/workqueue_windows.h"
#endif
/* grpc_workqueue is forward declared in exec_ctx.h */
@@ -80,4 +80,4 @@ void grpc_workqueue_add_to_pollset(grpc_exec_ctx *exec_ctx,
void grpc_workqueue_push(grpc_workqueue *workqueue, grpc_closure *closure,
int success);
-#endif /* GRPC_CORE_IOMGR_WORKQUEUE_H */
+#endif /* GRPC_CORE_LIB_IOMGR_WORKQUEUE_H */
diff --git a/src/core/iomgr/workqueue_posix.c b/src/core/lib/iomgr/workqueue_posix.c
index 2b42e6d4fb..76830ef12d 100644
--- a/src/core/iomgr/workqueue_posix.c
+++ b/src/core/lib/iomgr/workqueue_posix.c
@@ -35,7 +35,7 @@
#ifdef GPR_POSIX_SOCKET
-#include "src/core/iomgr/workqueue.h"
+#include "src/core/lib/iomgr/workqueue.h"
#include <stdio.h>
@@ -43,8 +43,8 @@
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
-#include "src/core/iomgr/fd_posix.h"
-#include "src/core/iomgr/pollset_posix.h"
+#include "src/core/lib/iomgr/fd_posix.h"
+#include "src/core/lib/iomgr/pollset_posix.h"
static void on_readable(grpc_exec_ctx *exec_ctx, void *arg, bool success);
diff --git a/src/core/iomgr/workqueue_posix.h b/src/core/lib/iomgr/workqueue_posix.h
index 89937b1ea8..956de8fb27 100644
--- a/src/core/iomgr/workqueue_posix.h
+++ b/src/core/lib/iomgr/workqueue_posix.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_WORKQUEUE_POSIX_H
-#define GRPC_CORE_IOMGR_WORKQUEUE_POSIX_H
+#ifndef GRPC_CORE_LIB_IOMGR_WORKQUEUE_POSIX_H
+#define GRPC_CORE_LIB_IOMGR_WORKQUEUE_POSIX_H
-#include "src/core/iomgr/wakeup_fd_posix.h"
+#include "src/core/lib/iomgr/wakeup_fd_posix.h"
struct grpc_fd;
@@ -50,4 +50,4 @@ struct grpc_workqueue {
grpc_closure read_closure;
};
-#endif /* GRPC_CORE_IOMGR_WORKQUEUE_POSIX_H */
+#endif /* GRPC_CORE_LIB_IOMGR_WORKQUEUE_POSIX_H */
diff --git a/src/core/iomgr/workqueue_windows.c b/src/core/lib/iomgr/workqueue_windows.c
index f9ca57557b..6697f93498 100644
--- a/src/core/iomgr/workqueue_windows.c
+++ b/src/core/lib/iomgr/workqueue_windows.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,6 @@
#ifdef GPR_WIN32
-#include "src/core/iomgr/workqueue.h"
+#include "src/core/lib/iomgr/workqueue.h"
#endif /* GPR_WIN32 */
diff --git a/src/core/iomgr/workqueue_windows.h b/src/core/lib/iomgr/workqueue_windows.h
index 7e8186921e..8e6980b6d9 100644
--- a/src/core/iomgr/workqueue_windows.h
+++ b/src/core/lib/iomgr/workqueue_windows.h
@@ -31,7 +31,7 @@
*
*/
-#ifndef GRPC_CORE_IOMGR_WORKQUEUE_WINDOWS_H
-#define GRPC_CORE_IOMGR_WORKQUEUE_WINDOWS_H
+#ifndef GRPC_CORE_LIB_IOMGR_WORKQUEUE_WINDOWS_H
+#define GRPC_CORE_LIB_IOMGR_WORKQUEUE_WINDOWS_H
-#endif /* GRPC_CORE_IOMGR_WORKQUEUE_WINDOWS_H */
+#endif /* GRPC_CORE_LIB_IOMGR_WORKQUEUE_WINDOWS_H */
diff --git a/src/core/json/json.c b/src/core/lib/json/json.c
index 96e11eebb1..9793045d91 100644
--- a/src/core/json/json.c
+++ b/src/core/lib/json/json.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@
#include <grpc/support/alloc.h>
-#include "src/core/json/json.h"
+#include "src/core/lib/json/json.h"
grpc_json *grpc_json_create(grpc_json_type type) {
grpc_json *json = gpr_malloc(sizeof(*json));
diff --git a/src/core/json/json.h b/src/core/lib/json/json.h
index aea9d5dadb..41d87dd5ce 100644
--- a/src/core/json/json.h
+++ b/src/core/lib/json/json.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_JSON_JSON_H
-#define GRPC_CORE_JSON_JSON_H
+#ifndef GRPC_CORE_LIB_JSON_JSON_H
+#define GRPC_CORE_LIB_JSON_JSON_H
#include <stdlib.h>
-#include "src/core/json/json_common.h"
+#include "src/core/lib/json/json_common.h"
/* A tree-like structure to hold json values. The key and value pointers
* are not owned by it.
@@ -85,4 +85,4 @@ char *grpc_json_dump_to_string(grpc_json *json, int indent);
grpc_json *grpc_json_create(grpc_json_type type);
void grpc_json_destroy(grpc_json *json);
-#endif /* GRPC_CORE_JSON_JSON_H */
+#endif /* GRPC_CORE_LIB_JSON_JSON_H */
diff --git a/src/core/json/json_common.h b/src/core/lib/json/json_common.h
index 7205a94685..ce980040f8 100644
--- a/src/core/json/json_common.h
+++ b/src/core/lib/json/json_common.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_JSON_JSON_COMMON_H
-#define GRPC_CORE_JSON_JSON_COMMON_H
+#ifndef GRPC_CORE_LIB_JSON_JSON_COMMON_H
+#define GRPC_CORE_LIB_JSON_JSON_COMMON_H
/* The various json types. */
typedef enum {
@@ -46,4 +46,4 @@ typedef enum {
GRPC_JSON_TOP_LEVEL
} grpc_json_type;
-#endif /* GRPC_CORE_JSON_JSON_COMMON_H */
+#endif /* GRPC_CORE_LIB_JSON_JSON_COMMON_H */
diff --git a/src/core/json/json_reader.c b/src/core/lib/json/json_reader.c
index 30da6f28f3..0807f029ce 100644
--- a/src/core/json/json_reader.c
+++ b/src/core/lib/json/json_reader.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,7 +37,7 @@
#include <grpc/support/log.h>
-#include "src/core/json/json_reader.h"
+#include "src/core/lib/json/json_reader.h"
static void json_reader_string_clear(grpc_json_reader *reader) {
reader->vtable->string_clear(reader->userdata);
diff --git a/src/core/json/json_reader.h b/src/core/lib/json/json_reader.h
index f25f44b2ef..37a838889d 100644
--- a/src/core/json/json_reader.h
+++ b/src/core/lib/json/json_reader.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_JSON_JSON_READER_H
-#define GRPC_CORE_JSON_JSON_READER_H
+#ifndef GRPC_CORE_LIB_JSON_JSON_READER_H
+#define GRPC_CORE_LIB_JSON_JSON_READER_H
#include <grpc/support/port_platform.h>
-#include "src/core/json/json_common.h"
+#include "src/core/lib/json/json_common.h"
typedef enum {
GRPC_JSON_STATE_OBJECT_KEY_BEGIN,
@@ -157,4 +157,4 @@ void grpc_json_reader_init(grpc_json_reader *reader,
*/
int grpc_json_reader_is_complete(grpc_json_reader *reader);
-#endif /* GRPC_CORE_JSON_JSON_READER_H */
+#endif /* GRPC_CORE_LIB_JSON_JSON_READER_H */
diff --git a/src/core/json/json_string.c b/src/core/lib/json/json_string.c
index 2bc0b513d5..8e6f1253dc 100644
--- a/src/core/json/json_string.c
+++ b/src/core/lib/json/json_string.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,15 +31,15 @@
*
*/
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/json/json.h"
-#include "src/core/json/json_reader.h"
-#include "src/core/json/json_writer.h"
+#include "src/core/lib/json/json.h"
+#include "src/core/lib/json/json_reader.h"
+#include "src/core/lib/json/json_writer.h"
/* The json reader will construct a bunch of grpc_json objects and
* link them all up together in a tree-like structure that will represent
diff --git a/src/core/json/json_writer.c b/src/core/lib/json/json_writer.c
index 326ec2d431..d614a72fc4 100644
--- a/src/core/json/json_writer.c
+++ b/src/core/lib/json/json_writer.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@
#include <grpc/support/port_platform.h>
-#include "src/core/json/json_writer.h"
+#include "src/core/lib/json/json_writer.h"
static void json_writer_output_char(grpc_json_writer *writer, char c) {
writer->vtable->output_char(writer->userdata, c);
diff --git a/src/core/json/json_writer.h b/src/core/lib/json/json_writer.h
index c392126950..f90e79cd74 100644
--- a/src/core/json/json_writer.h
+++ b/src/core/lib/json/json_writer.h
@@ -43,12 +43,12 @@
* a valid UTF-8 string overall.
*/
-#ifndef GRPC_CORE_JSON_JSON_WRITER_H
-#define GRPC_CORE_JSON_JSON_WRITER_H
+#ifndef GRPC_CORE_LIB_JSON_JSON_WRITER_H
+#define GRPC_CORE_LIB_JSON_JSON_WRITER_H
#include <stdlib.h>
-#include "src/core/json/json_common.h"
+#include "src/core/lib/json/json_common.h"
typedef struct grpc_json_writer_vtable {
/* Adds a character to the output stream. */
@@ -94,4 +94,4 @@ void grpc_json_writer_value_raw_with_len(grpc_json_writer *writer,
void grpc_json_writer_value_string(grpc_json_writer *writer,
const char *string);
-#endif /* GRPC_CORE_JSON_JSON_WRITER_H */
+#endif /* GRPC_CORE_LIB_JSON_JSON_WRITER_H */
diff --git a/src/core/profiling/basic_timers.c b/src/core/lib/profiling/basic_timers.c
index df32472d1c..15a9584981 100644
--- a/src/core/profiling/basic_timers.c
+++ b/src/core/lib/profiling/basic_timers.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,13 +35,13 @@
#ifdef GRPC_BASIC_PROFILER
-#include "src/core/profiling/timers.h"
+#include "src/core/lib/profiling/timers.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/time.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
+#include <grpc/support/time.h>
#include <stdio.h>
typedef enum { BEGIN = '{', END = '}', MARK = '.' } marker_type;
diff --git a/src/core/profiling/stap_probes.d b/src/core/lib/profiling/stap_probes.d
index 153de91752..153de91752 100644
--- a/src/core/profiling/stap_probes.d
+++ b/src/core/lib/profiling/stap_probes.d
diff --git a/src/core/profiling/stap_timers.c b/src/core/lib/profiling/stap_timers.c
index efcd1af4a1..f55c1a569a 100644
--- a/src/core/profiling/stap_timers.c
+++ b/src/core/lib/profiling/stap_timers.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,11 +35,11 @@
#ifdef GRPC_STAP_PROFILER
-#include "src/core/profiling/timers.h"
+#include "src/core/lib/profiling/timers.h"
#include <sys/sdt.h>
/* Generated from src/core/profiling/stap_probes.d */
-#include "src/core/profiling/stap_probes.h"
+#include "src/core/lib/profiling/stap_probes.h"
/* Latency profiler API implementation. */
void gpr_timer_add_mark(int tag, const char *tagstr, void *id, const char *file,
diff --git a/src/core/profiling/timers.h b/src/core/lib/profiling/timers.h
index 6a188dc566..1303593ffb 100644
--- a/src/core/profiling/timers.h
+++ b/src/core/lib/profiling/timers.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_PROFILING_TIMERS_H
-#define GRPC_CORE_PROFILING_TIMERS_H
+#ifndef GRPC_CORE_LIB_PROFILING_TIMERS_H
+#define GRPC_CORE_LIB_PROFILING_TIMERS_H
#ifdef __cplusplus
extern "C" {
@@ -116,4 +116,4 @@ class ProfileScope {
#endif
#endif
-#endif /* GRPC_CORE_PROFILING_TIMERS_H */
+#endif /* GRPC_CORE_LIB_PROFILING_TIMERS_H */
diff --git a/src/core/proto/grpc/lb/v0/load_balancer.pb.c b/src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c
index 59aae30cff..8f82141f96 100644
--- a/src/core/proto/grpc/lb/v0/load_balancer.pb.c
+++ b/src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c
@@ -33,7 +33,7 @@
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.3.5-dev */
-#include "src/core/proto/grpc/lb/v0/load_balancer.pb.h"
+#include "src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h"
#if PB_PROTO_HEADER_VERSION != 30
#error Regenerate this file with the current version of nanopb generator.
diff --git a/src/core/proto/grpc/lb/v0/load_balancer.pb.h b/src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h
index 3599f881bb..3599f881bb 100644
--- a/src/core/proto/grpc/lb/v0/load_balancer.pb.h
+++ b/src/core/lib/proto/grpc/lb/v0/load_balancer.pb.h
diff --git a/src/core/security/auth_filters.h b/src/core/lib/security/auth_filters.h
index 1154a1d914..162b60e2c8 100644
--- a/src/core/security/auth_filters.h
+++ b/src/core/lib/security/auth_filters.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_SECURITY_AUTH_FILTERS_H
-#define GRPC_CORE_SECURITY_AUTH_FILTERS_H
+#ifndef GRPC_CORE_LIB_SECURITY_AUTH_FILTERS_H
+#define GRPC_CORE_LIB_SECURITY_AUTH_FILTERS_H
-#include "src/core/channel/channel_stack.h"
+#include "src/core/lib/channel/channel_stack.h"
extern const grpc_channel_filter grpc_client_auth_filter;
extern const grpc_channel_filter grpc_server_auth_filter;
-#endif /* GRPC_CORE_SECURITY_AUTH_FILTERS_H */
+#endif /* GRPC_CORE_LIB_SECURITY_AUTH_FILTERS_H */
diff --git a/src/core/security/b64.c b/src/core/lib/security/b64.c
index c40b528e2f..1d3879534c 100644
--- a/src/core/security/b64.c
+++ b/src/core/lib/security/b64.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/security/b64.h"
+#include "src/core/lib/security/b64.h"
#include <stdint.h>
#include <string.h>
diff --git a/src/core/security/b64.h b/src/core/lib/security/b64.h
index d18f69563d..0bf372a1e7 100644
--- a/src/core/security/b64.h
+++ b/src/core/lib/security/b64.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_SECURITY_B64_H
-#define GRPC_CORE_SECURITY_B64_H
+#ifndef GRPC_CORE_LIB_SECURITY_B64_H
+#define GRPC_CORE_LIB_SECURITY_B64_H
#include <grpc/support/slice.h>
@@ -49,4 +49,4 @@ gpr_slice grpc_base64_decode(const char *b64, int url_safe);
gpr_slice grpc_base64_decode_with_len(const char *b64, size_t b64_len,
int url_safe);
-#endif /* GRPC_CORE_SECURITY_B64_H */
+#endif /* GRPC_CORE_LIB_SECURITY_B64_H */
diff --git a/src/core/security/client_auth_filter.c b/src/core/lib/security/client_auth_filter.c
index 332d4259d2..b9e5bf0339 100644
--- a/src/core/security/client_auth_filter.c
+++ b/src/core/lib/security/client_auth_filter.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/security/auth_filters.h"
+#include "src/core/lib/security/auth_filters.h"
#include <string.h>
@@ -39,13 +39,13 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-#include "src/core/channel/channel_stack.h"
-#include "src/core/security/credentials.h"
-#include "src/core/security/security_connector.h"
-#include "src/core/security/security_context.h"
-#include "src/core/support/string.h"
-#include "src/core/surface/call.h"
-#include "src/core/transport/static_metadata.h"
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/security/credentials.h"
+#include "src/core/lib/security/security_connector.h"
+#include "src/core/lib/security/security_context.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/surface/call.h"
+#include "src/core/lib/transport/static_metadata.h"
#define MAX_CREDENTIALS_METADATA_COUNT 4
@@ -331,6 +331,6 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
const grpc_channel_filter grpc_client_auth_filter = {
auth_start_transport_op, grpc_channel_next_op, sizeof(call_data),
- init_call_elem, set_pollset, destroy_call_elem, sizeof(channel_data),
- init_channel_elem, destroy_channel_elem, grpc_call_next_get_peer,
- "client-auth"};
+ init_call_elem, set_pollset, destroy_call_elem,
+ sizeof(channel_data), init_channel_elem, destroy_channel_elem,
+ grpc_call_next_get_peer, "client-auth"};
diff --git a/src/core/security/credentials.c b/src/core/lib/security/credentials.c
index b4fa616fa7..99a07e5c13 100644
--- a/src/core/security/credentials.c
+++ b/src/core/lib/security/credentials.c
@@ -31,18 +31,19 @@
*
*/
-#include "src/core/security/credentials.h"
+#include "src/core/lib/security/credentials.h"
#include <stdio.h>
#include <string.h>
-#include "src/core/channel/channel_args.h"
-#include "src/core/channel/http_client_filter.h"
-#include "src/core/httpcli/httpcli.h"
-#include "src/core/iomgr/executor.h"
-#include "src/core/json/json.h"
-#include "src/core/support/string.h"
-#include "src/core/surface/api_trace.h"
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/channel/http_client_filter.h"
+#include "src/core/lib/http/httpcli.h"
+#include "src/core/lib/http/parser.h"
+#include "src/core/lib/iomgr/executor.h"
+#include "src/core/lib/json/json.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/surface/api_trace.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -539,7 +540,7 @@ static void oauth2_token_fetcher_destruct(grpc_call_credentials *creds) {
grpc_credentials_status
grpc_oauth2_token_fetcher_credentials_parse_server_response(
- const grpc_httpcli_response *response, grpc_credentials_md_store **token_md,
+ const grpc_http_response *response, grpc_credentials_md_store **token_md,
gpr_timespec *token_lifetime) {
char *null_terminated_body = NULL;
char *new_access_token = NULL;
@@ -629,7 +630,7 @@ end:
static void on_oauth2_token_fetcher_http_response(
grpc_exec_ctx *exec_ctx, void *user_data,
- const grpc_httpcli_response *response) {
+ const grpc_http_response *response) {
grpc_credentials_metadata_request *r =
(grpc_credentials_metadata_request *)user_data;
grpc_oauth2_token_fetcher_credentials *c =
@@ -706,13 +707,13 @@ static void compute_engine_fetch_oauth2(
grpc_exec_ctx *exec_ctx, grpc_credentials_metadata_request *metadata_req,
grpc_httpcli_context *httpcli_context, grpc_pollset *pollset,
grpc_httpcli_response_cb response_cb, gpr_timespec deadline) {
- grpc_httpcli_header header = {"Metadata-Flavor", "Google"};
+ grpc_http_header header = {"Metadata-Flavor", "Google"};
grpc_httpcli_request request;
memset(&request, 0, sizeof(grpc_httpcli_request));
request.host = GRPC_COMPUTE_ENGINE_METADATA_HOST;
- request.path = GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH;
- request.hdr_count = 1;
- request.hdrs = &header;
+ request.http.path = GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH;
+ request.http.hdr_count = 1;
+ request.http.hdrs = &header;
grpc_httpcli_get(exec_ctx, httpcli_context, pollset, &request, deadline,
response_cb, metadata_req);
}
@@ -747,8 +748,8 @@ static void refresh_token_fetch_oauth2(
grpc_httpcli_response_cb response_cb, gpr_timespec deadline) {
grpc_google_refresh_token_credentials *c =
(grpc_google_refresh_token_credentials *)metadata_req->creds;
- grpc_httpcli_header header = {"Content-Type",
- "application/x-www-form-urlencoded"};
+ grpc_http_header header = {"Content-Type",
+ "application/x-www-form-urlencoded"};
grpc_httpcli_request request;
char *body = NULL;
gpr_asprintf(&body, GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING,
@@ -756,9 +757,9 @@ static void refresh_token_fetch_oauth2(
c->refresh_token.refresh_token);
memset(&request, 0, sizeof(grpc_httpcli_request));
request.host = GRPC_GOOGLE_OAUTH2_SERVICE_HOST;
- request.path = GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH;
- request.hdr_count = 1;
- request.hdrs = &header;
+ request.http.path = GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH;
+ request.http.hdr_count = 1;
+ request.http.hdrs = &header;
request.handshaker = &grpc_httpcli_ssl;
grpc_httpcli_post(exec_ctx, httpcli_context, pollset, &request, body,
strlen(body), deadline, response_cb, metadata_req);
diff --git a/src/core/security/credentials.h b/src/core/lib/security/credentials.h
index 133aa9d8d9..7168b98942 100644
--- a/src/core/security/credentials.h
+++ b/src/core/lib/security/credentials.h
@@ -31,19 +31,20 @@
*
*/
-#ifndef GRPC_CORE_SECURITY_CREDENTIALS_H
-#define GRPC_CORE_SECURITY_CREDENTIALS_H
+#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_H
+#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_H
-#include "src/core/transport/metadata_batch.h"
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/support/sync.h>
+#include "src/core/lib/transport/metadata_batch.h"
-#include "src/core/httpcli/httpcli.h"
-#include "src/core/security/json_token.h"
-#include "src/core/security/security_connector.h"
+#include "src/core/lib/http/httpcli.h"
+#include "src/core/lib/http/parser.h"
+#include "src/core/lib/security/json_token.h"
+#include "src/core/lib/security/security_connector.h"
-struct grpc_httpcli_response;
+struct grpc_http_response;
/* --- Constants. --- */
@@ -207,7 +208,7 @@ grpc_call_credentials *grpc_credentials_contains_type(
/* Exposed for testing only. */
grpc_credentials_status
grpc_oauth2_token_fetcher_credentials_parse_server_response(
- const struct grpc_httpcli_response *response,
+ const struct grpc_http_response *response,
grpc_credentials_md_store **token_md, gpr_timespec *token_lifetime);
void grpc_flush_cached_google_default_credentials(void);
@@ -373,4 +374,4 @@ typedef struct {
grpc_credentials_md_store *plugin_md;
} grpc_plugin_credentials;
-#endif /* GRPC_CORE_SECURITY_CREDENTIALS_H */
+#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_H */
diff --git a/src/core/security/credentials_metadata.c b/src/core/lib/security/credentials_metadata.c
index b8a132f1ea..c3bfcb11b5 100644
--- a/src/core/security/credentials_metadata.c
+++ b/src/core/lib/security/credentials_metadata.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/security/credentials.h"
+#include "src/core/lib/security/credentials.h"
#include <grpc/support/alloc.h>
diff --git a/src/core/security/credentials_posix.c b/src/core/lib/security/credentials_posix.c
index 0c92bd4a96..b758cd0a1a 100644
--- a/src/core/security/credentials_posix.c
+++ b/src/core/lib/security/credentials_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,14 +35,14 @@
#ifdef GPR_POSIX_FILE
-#include "src/core/security/credentials.h"
+#include "src/core/lib/security/credentials.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-#include "src/core/support/env.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/support/env.h"
+#include "src/core/lib/support/string.h"
char *grpc_get_well_known_google_credentials_file_path_impl(void) {
char *result = NULL;
diff --git a/src/core/security/credentials_win32.c b/src/core/lib/security/credentials_win32.c
index 8ee9f706a1..a225ab0d7d 100644
--- a/src/core/security/credentials_win32.c
+++ b/src/core/lib/security/credentials_win32.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,14 +35,14 @@
#ifdef GPR_WIN32
-#include "src/core/security/credentials.h"
+#include "src/core/lib/security/credentials.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-#include "src/core/support/env.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/support/env.h"
+#include "src/core/lib/support/string.h"
char *grpc_get_well_known_google_credentials_file_path_impl(void) {
char *result = NULL;
diff --git a/src/core/security/google_default_credentials.c b/src/core/lib/security/google_default_credentials.c
index 1f4f3e4aa5..5c342288cc 100644
--- a/src/core/security/google_default_credentials.c
+++ b/src/core/lib/security/google_default_credentials.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/security/credentials.h"
+#include "src/core/lib/security/credentials.h"
#include <string.h>
@@ -39,10 +39,11 @@
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
-#include "src/core/httpcli/httpcli.h"
-#include "src/core/support/env.h"
-#include "src/core/support/load_file.h"
-#include "src/core/surface/api_trace.h"
+#include "src/core/lib/http/httpcli.h"
+#include "src/core/lib/http/parser.h"
+#include "src/core/lib/support/env.h"
+#include "src/core/lib/support/load_file.h"
+#include "src/core/lib/surface/api_trace.h"
/* -- Constants. -- */
@@ -66,14 +67,14 @@ typedef struct {
static void on_compute_engine_detection_http_response(
grpc_exec_ctx *exec_ctx, void *user_data,
- const grpc_httpcli_response *response) {
+ const grpc_http_response *response) {
compute_engine_detector *detector = (compute_engine_detector *)user_data;
if (response != NULL && response->status == 200 && response->hdr_count > 0) {
/* Internet providers can return a generic response to all requests, so
it is necessary to check that metadata header is present also. */
size_t i;
for (i = 0; i < response->hdr_count; i++) {
- grpc_httpcli_header *header = &response->hdrs[i];
+ grpc_http_header *header = &response->hdrs[i];
if (strcmp(header->key, "Metadata-Flavor") == 0 &&
strcmp(header->value, "Google") == 0) {
detector->success = 1;
@@ -109,7 +110,7 @@ static int is_stack_running_on_compute_engine(void) {
memset(&request, 0, sizeof(grpc_httpcli_request));
request.host = GRPC_COMPUTE_ENGINE_DETECTION_HOST;
- request.path = "/";
+ request.http.path = "/";
grpc_httpcli_context_init(&context);
diff --git a/src/core/security/handshake.c b/src/core/lib/security/handshake.c
index b5bb6667a7..adb6d7fe4e 100644
--- a/src/core/security/handshake.c
+++ b/src/core/lib/security/handshake.c
@@ -31,16 +31,16 @@
*
*/
-#include "src/core/security/handshake.h"
+#include "src/core/lib/security/handshake.h"
#include <stdbool.h>
#include <string.h>
-#include "src/core/security/security_context.h"
-#include "src/core/security/secure_endpoint.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/slice_buffer.h>
+#include "src/core/lib/security/secure_endpoint.h"
+#include "src/core/lib/security/security_context.h"
#define GRPC_INITIAL_HANDSHAKE_BUFFER_SIZE 256
diff --git a/src/core/security/handshake.h b/src/core/lib/security/handshake.h
index 4872045874..b5d7bb3282 100644
--- a/src/core/security/handshake.h
+++ b/src/core/lib/security/handshake.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_SECURITY_HANDSHAKE_H
-#define GRPC_CORE_SECURITY_HANDSHAKE_H
+#ifndef GRPC_CORE_LIB_SECURITY_HANDSHAKE_H
+#define GRPC_CORE_LIB_SECURITY_HANDSHAKE_H
-#include "src/core/iomgr/endpoint.h"
-#include "src/core/security/security_connector.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/security/security_connector.h"
/* Calls the callback upon completion. Takes owership of handshaker. */
void grpc_do_security_handshake(grpc_exec_ctx *exec_ctx,
@@ -48,4 +48,4 @@ void grpc_do_security_handshake(grpc_exec_ctx *exec_ctx,
void grpc_security_handshake_shutdown(grpc_exec_ctx *exec_ctx, void *handshake);
-#endif /* GRPC_CORE_SECURITY_HANDSHAKE_H */
+#endif /* GRPC_CORE_LIB_SECURITY_HANDSHAKE_H */
diff --git a/src/core/security/json_token.c b/src/core/lib/security/json_token.c
index 372e5bfc5a..97054286d9 100644
--- a/src/core/security/json_token.c
+++ b/src/core/lib/security/json_token.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/security/json_token.h"
+#include "src/core/lib/security/json_token.h"
#include <string.h>
@@ -39,8 +39,8 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-#include "src/core/security/b64.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/security/b64.h"
+#include "src/core/lib/support/string.h"
#include <openssl/bio.h>
#include <openssl/evp.h>
diff --git a/src/core/security/json_token.h b/src/core/lib/security/json_token.h
index d183f9b3a3..376fb03875 100644
--- a/src/core/security/json_token.h
+++ b/src/core/lib/security/json_token.h
@@ -31,13 +31,13 @@
*
*/
-#ifndef GRPC_CORE_SECURITY_JSON_TOKEN_H
-#define GRPC_CORE_SECURITY_JSON_TOKEN_H
+#ifndef GRPC_CORE_LIB_SECURITY_JSON_TOKEN_H
+#define GRPC_CORE_LIB_SECURITY_JSON_TOKEN_H
#include <grpc/support/slice.h>
#include <openssl/rsa.h>
-#include "src/core/json/json.h"
+#include "src/core/lib/json/json.h"
/* --- Constants. --- */
@@ -115,4 +115,4 @@ grpc_auth_refresh_token grpc_auth_refresh_token_create_from_json(
/* Destructs the object. */
void grpc_auth_refresh_token_destruct(grpc_auth_refresh_token *refresh_token);
-#endif /* GRPC_CORE_SECURITY_JSON_TOKEN_H */
+#endif /* GRPC_CORE_LIB_SECURITY_JSON_TOKEN_H */
diff --git a/src/core/security/jwt_verifier.c b/src/core/lib/security/jwt_verifier.c
index 928c6c148d..460b92f9a0 100644
--- a/src/core/security/jwt_verifier.c
+++ b/src/core/lib/security/jwt_verifier.c
@@ -31,14 +31,14 @@
*
*/
-#include "src/core/security/jwt_verifier.h"
+#include "src/core/lib/security/jwt_verifier.h"
#include <limits.h>
#include <string.h>
-#include "src/core/httpcli/httpcli.h"
-#include "src/core/security/b64.h"
-#include "src/core/tsi/ssl_types.h"
+#include "src/core/lib/http/httpcli.h"
+#include "src/core/lib/security/b64.h"
+#include "src/core/lib/tsi/ssl_types.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -635,11 +635,11 @@ static void on_openid_config_retrieved(grpc_exec_ctx *exec_ctx, void *user_data,
jwks_uri += 8;
req.handshaker = &grpc_httpcli_ssl;
req.host = gpr_strdup(jwks_uri);
- req.path = strchr(jwks_uri, '/');
- if (req.path == NULL) {
- req.path = "";
+ req.http.path = strchr(jwks_uri, '/');
+ if (req.http.path == NULL) {
+ req.http.path = "";
} else {
- *(req.host + (req.path - jwks_uri)) = '\0';
+ *(req.host + (req.http.path - jwks_uri)) = '\0';
}
grpc_httpcli_get(
exec_ctx, &ctx->verifier->http_ctx, ctx->pollset, &req,
@@ -725,20 +725,20 @@ static void retrieve_key_and_verify(grpc_exec_ctx *exec_ctx,
req.host = gpr_strdup(mapping->key_url_prefix);
path_prefix = strchr(req.host, '/');
if (path_prefix == NULL) {
- gpr_asprintf(&req.path, "/%s", iss);
+ gpr_asprintf(&req.http.path, "/%s", iss);
} else {
*(path_prefix++) = '\0';
- gpr_asprintf(&req.path, "/%s/%s", path_prefix, iss);
+ gpr_asprintf(&req.http.path, "/%s/%s", path_prefix, iss);
}
http_cb = on_keys_retrieved;
} else {
req.host = gpr_strdup(strstr(iss, "https://") == iss ? iss + 8 : iss);
path_prefix = strchr(req.host, '/');
if (path_prefix == NULL) {
- req.path = gpr_strdup(GRPC_OPENID_CONFIG_URL_SUFFIX);
+ req.http.path = gpr_strdup(GRPC_OPENID_CONFIG_URL_SUFFIX);
} else {
*(path_prefix++) = 0;
- gpr_asprintf(&req.path, "/%s%s", path_prefix,
+ gpr_asprintf(&req.http.path, "/%s%s", path_prefix,
GRPC_OPENID_CONFIG_URL_SUFFIX);
}
http_cb = on_openid_config_retrieved;
@@ -749,7 +749,7 @@ static void retrieve_key_and_verify(grpc_exec_ctx *exec_ctx,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay),
http_cb, ctx);
gpr_free(req.host);
- gpr_free(req.path);
+ gpr_free(req.http.path);
return;
error:
diff --git a/src/core/security/jwt_verifier.h b/src/core/lib/security/jwt_verifier.h
index d898d2193f..28a9eff048 100644
--- a/src/core/security/jwt_verifier.h
+++ b/src/core/lib/security/jwt_verifier.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_SECURITY_JWT_VERIFIER_H
-#define GRPC_CORE_SECURITY_JWT_VERIFIER_H
+#ifndef GRPC_CORE_LIB_SECURITY_JWT_VERIFIER_H
+#define GRPC_CORE_LIB_SECURITY_JWT_VERIFIER_H
-#include "src/core/iomgr/pollset.h"
-#include "src/core/json/json.h"
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/json/json.h"
#include <grpc/support/slice.h>
#include <grpc/support/time.h>
@@ -133,4 +133,4 @@ grpc_jwt_claims *grpc_jwt_claims_from_json(grpc_json *json, gpr_slice buffer);
grpc_jwt_verifier_status grpc_jwt_claims_check(const grpc_jwt_claims *claims,
const char *audience);
-#endif /* GRPC_CORE_SECURITY_JWT_VERIFIER_H */
+#endif /* GRPC_CORE_LIB_SECURITY_JWT_VERIFIER_H */
diff --git a/src/core/security/secure_endpoint.c b/src/core/lib/security/secure_endpoint.c
index d11c43be20..e233b081ef 100644
--- a/src/core/security/secure_endpoint.c
+++ b/src/core/lib/security/secure_endpoint.c
@@ -31,15 +31,15 @@
*
*/
-#include "src/core/security/secure_endpoint.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/security/secure_endpoint.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/slice.h>
+#include <grpc/support/slice_buffer.h>
#include <grpc/support/sync.h>
-#include "src/core/tsi/transport_security_interface.h"
-#include "src/core/debug/trace.h"
+#include "src/core/lib/debug/trace.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/tsi/transport_security_interface.h"
#define STAGING_BUFFER_SIZE 8192
@@ -354,8 +354,9 @@ static char *endpoint_get_peer(grpc_endpoint *secure_ep) {
}
static const grpc_endpoint_vtable vtable = {
- endpoint_read, endpoint_write, endpoint_add_to_pollset,
- endpoint_add_to_pollset_set, endpoint_shutdown, endpoint_destroy,
+ endpoint_read, endpoint_write,
+ endpoint_add_to_pollset, endpoint_add_to_pollset_set,
+ endpoint_shutdown, endpoint_destroy,
endpoint_get_peer};
grpc_endpoint *grpc_secure_endpoint_create(
diff --git a/src/core/security/secure_endpoint.h b/src/core/lib/security/secure_endpoint.h
index 5176ef2059..57bd160a52 100644
--- a/src/core/security/secure_endpoint.h
+++ b/src/core/lib/security/secure_endpoint.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_SECURITY_SECURE_ENDPOINT_H
-#define GRPC_CORE_SECURITY_SECURE_ENDPOINT_H
+#ifndef GRPC_CORE_LIB_SECURITY_SECURE_ENDPOINT_H
+#define GRPC_CORE_LIB_SECURITY_SECURE_ENDPOINT_H
-#include "src/core/iomgr/endpoint.h"
#include <grpc/support/slice.h>
+#include "src/core/lib/iomgr/endpoint.h"
struct tsi_frame_protector;
@@ -46,4 +46,4 @@ grpc_endpoint *grpc_secure_endpoint_create(
struct tsi_frame_protector *protector, grpc_endpoint *to_wrap,
gpr_slice *leftover_slices, size_t leftover_nslices);
-#endif /* GRPC_CORE_SECURITY_SECURE_ENDPOINT_H */
+#endif /* GRPC_CORE_LIB_SECURITY_SECURE_ENDPOINT_H */
diff --git a/src/core/security/security_connector.c b/src/core/lib/security/security_connector.c
index fbec263eed..5474bc3a9e 100644
--- a/src/core/security/security_connector.c
+++ b/src/core/lib/security/security_connector.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/security/security_connector.h"
+#include "src/core/lib/security/security_connector.h"
#include <stdbool.h>
#include <string.h>
@@ -42,16 +42,16 @@
#include <grpc/support/slice_buffer.h>
#include <grpc/support/string_util.h>
-#include "src/core/security/credentials.h"
-#include "src/core/security/handshake.h"
-#include "src/core/security/secure_endpoint.h"
-#include "src/core/security/security_context.h"
-#include "src/core/support/env.h"
-#include "src/core/support/load_file.h"
-#include "src/core/support/string.h"
-#include "src/core/transport/chttp2/alpn.h"
-#include "src/core/tsi/fake_transport_security.h"
-#include "src/core/tsi/ssl_transport_security.h"
+#include "src/core/lib/security/credentials.h"
+#include "src/core/lib/security/handshake.h"
+#include "src/core/lib/security/secure_endpoint.h"
+#include "src/core/lib/security/security_context.h"
+#include "src/core/lib/support/env.h"
+#include "src/core/lib/support/load_file.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/transport/chttp2/alpn.h"
+#include "src/core/lib/tsi/fake_transport_security.h"
+#include "src/core/lib/tsi/ssl_transport_security.h"
/* -- Constants. -- */
diff --git a/src/core/security/security_connector.h b/src/core/lib/security/security_connector.h
index 6f915ebb9d..d50091c628 100644
--- a/src/core/security/security_connector.h
+++ b/src/core/lib/security/security_connector.h
@@ -31,13 +31,13 @@
*
*/
-#ifndef GRPC_CORE_SECURITY_SECURITY_CONNECTOR_H
-#define GRPC_CORE_SECURITY_SECURITY_CONNECTOR_H
+#ifndef GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_H
+#define GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_H
#include <grpc/grpc_security.h>
-#include "src/core/iomgr/endpoint.h"
-#include "src/core/iomgr/tcp_server.h"
-#include "src/core/tsi/transport_security_interface.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/tcp_server.h"
+#include "src/core/lib/tsi/transport_security_interface.h"
/* --- status enum. --- */
@@ -263,4 +263,4 @@ tsi_peer tsi_shallow_peer_from_ssl_auth_context(
const grpc_auth_context *auth_context);
void tsi_shallow_peer_destruct(tsi_peer *peer);
-#endif /* GRPC_CORE_SECURITY_SECURITY_CONNECTOR_H */
+#endif /* GRPC_CORE_LIB_SECURITY_SECURITY_CONNECTOR_H */
diff --git a/src/core/security/security_context.c b/src/core/lib/security/security_context.c
index a71b3bc915..0e66373bd8 100644
--- a/src/core/security/security_context.c
+++ b/src/core/lib/security/security_context.c
@@ -33,10 +33,10 @@
#include <string.h>
-#include "src/core/security/security_context.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/call.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/security/security_context.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/call.h"
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
diff --git a/src/core/security/security_context.h b/src/core/lib/security/security_context.h
index 61601f538b..e9e4e503bc 100644
--- a/src/core/security/security_context.h
+++ b/src/core/lib/security/security_context.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_SECURITY_SECURITY_CONTEXT_H
-#define GRPC_CORE_SECURITY_SECURITY_CONTEXT_H
+#ifndef GRPC_CORE_LIB_SECURITY_SECURITY_CONTEXT_H
+#define GRPC_CORE_LIB_SECURITY_SECURITY_CONTEXT_H
-#include "src/core/iomgr/pollset.h"
-#include "src/core/security/credentials.h"
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/security/credentials.h"
/* --- grpc_auth_context ---
@@ -111,4 +111,4 @@ grpc_auth_context *grpc_auth_context_from_arg(const grpc_arg *arg);
grpc_auth_context *grpc_find_auth_context_in_args(
const grpc_channel_args *args);
-#endif /* GRPC_CORE_SECURITY_SECURITY_CONTEXT_H */
+#endif /* GRPC_CORE_LIB_SECURITY_SECURITY_CONTEXT_H */
diff --git a/src/core/security/server_auth_filter.c b/src/core/lib/security/server_auth_filter.c
index 3d8e5e8d35..158cde0e2c 100644
--- a/src/core/security/server_auth_filter.c
+++ b/src/core/lib/security/server_auth_filter.c
@@ -33,9 +33,9 @@
#include <string.h>
-#include "src/core/security/auth_filters.h"
-#include "src/core/security/credentials.h"
-#include "src/core/security/security_context.h"
+#include "src/core/lib/security/auth_filters.h"
+#include "src/core/lib/security/credentials.h"
+#include "src/core/lib/security/security_context.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -259,6 +259,6 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
const grpc_channel_filter grpc_server_auth_filter = {
auth_start_transport_op, grpc_channel_next_op, sizeof(call_data),
- init_call_elem, set_pollset, destroy_call_elem, sizeof(channel_data),
- init_channel_elem, destroy_channel_elem, grpc_call_next_get_peer,
- "server-auth"};
+ init_call_elem, set_pollset, destroy_call_elem,
+ sizeof(channel_data), init_channel_elem, destroy_channel_elem,
+ grpc_call_next_get_peer, "server-auth"};
diff --git a/src/core/security/server_secure_chttp2.c b/src/core/lib/security/server_secure_chttp2.c
index 009ec95682..7c9dd221ed 100644
--- a/src/core/security/server_secure_chttp2.c
+++ b/src/core/lib/security/server_secure_chttp2.c
@@ -35,22 +35,22 @@
#include <string.h>
-#include "src/core/channel/channel_args.h"
-#include "src/core/channel/http_server_filter.h"
-#include "src/core/iomgr/endpoint.h"
-#include "src/core/iomgr/resolve_address.h"
-#include "src/core/iomgr/tcp_server.h"
-#include "src/core/security/auth_filters.h"
-#include "src/core/security/credentials.h"
-#include "src/core/security/security_connector.h"
-#include "src/core/security/security_context.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/server.h"
-#include "src/core/transport/chttp2_transport.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/channel/http_server_filter.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+#include "src/core/lib/iomgr/tcp_server.h"
+#include "src/core/lib/security/auth_filters.h"
+#include "src/core/lib/security/credentials.h"
+#include "src/core/lib/security/security_connector.h"
+#include "src/core/lib/security/security_context.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/server.h"
+#include "src/core/lib/transport/chttp2_transport.h"
typedef struct grpc_server_secure_state {
grpc_server *server;
diff --git a/src/core/statistics/census_init.c b/src/core/lib/statistics/census_init.c
index b6a962f228..bbecd62764 100644
--- a/src/core/statistics/census_init.c
+++ b/src/core/lib/statistics/census_init.c
@@ -31,11 +31,11 @@
*
*/
-#include "src/core/statistics/census_interface.h"
+#include "src/core/lib/statistics/census_interface.h"
#include <grpc/support/log.h>
-#include "src/core/statistics/census_rpc_stats.h"
-#include "src/core/statistics/census_tracing.h"
+#include "src/core/lib/statistics/census_rpc_stats.h"
+#include "src/core/lib/statistics/census_tracing.h"
void census_init(void) {
census_tracing_init();
diff --git a/src/core/statistics/census_interface.h b/src/core/lib/statistics/census_interface.h
index ce8ff92cd4..b3b3439072 100644
--- a/src/core/statistics/census_interface.h
+++ b/src/core/lib/statistics/census_interface.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_STATISTICS_CENSUS_INTERFACE_H
-#define GRPC_CORE_STATISTICS_CENSUS_INTERFACE_H
+#ifndef GRPC_CORE_LIB_STATISTICS_CENSUS_INTERFACE_H
+#define GRPC_CORE_LIB_STATISTICS_CENSUS_INTERFACE_H
#include <grpc/support/port_platform.h>
@@ -73,4 +73,4 @@ census_op_id census_tracing_start_op(void);
/* Ends tracing. Calling this function will invalidate the input op_id. */
void census_tracing_end_op(census_op_id op_id);
-#endif /* GRPC_CORE_STATISTICS_CENSUS_INTERFACE_H */
+#endif /* GRPC_CORE_LIB_STATISTICS_CENSUS_INTERFACE_H */
diff --git a/src/core/statistics/census_log.c b/src/core/lib/statistics/census_log.c
index 257ba586a3..1fb942a78a 100644
--- a/src/core/statistics/census_log.c
+++ b/src/core/lib/statistics/census_log.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -89,8 +89,7 @@
include the name of the structure, which will be passed as the first
argument. E.g. cl_block_initialize() will initialize a cl_block.
*/
-#include "src/core/statistics/census_log.h"
-#include <string.h>
+#include "src/core/lib/statistics/census_log.h"
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/cpu.h>
@@ -98,6 +97,7 @@
#include <grpc/support/port_platform.h>
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
+#include <string.h>
/* End of platform specific code */
diff --git a/src/core/statistics/census_log.h b/src/core/lib/statistics/census_log.h
index e7ce0d4433..c3fbd555ba 100644
--- a/src/core/statistics/census_log.h
+++ b/src/core/lib/statistics/census_log.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_STATISTICS_CENSUS_LOG_H
-#define GRPC_CORE_STATISTICS_CENSUS_LOG_H
+#ifndef GRPC_CORE_LIB_STATISTICS_CENSUS_LOG_H
+#define GRPC_CORE_LIB_STATISTICS_CENSUS_LOG_H
#include <stddef.h>
@@ -88,4 +88,4 @@ size_t census_log_remaining_space(void);
out-of-space. */
int census_log_out_of_space_count(void);
-#endif /* GRPC_CORE_STATISTICS_CENSUS_LOG_H */
+#endif /* GRPC_CORE_LIB_STATISTICS_CENSUS_LOG_H */
diff --git a/src/core/statistics/census_rpc_stats.c b/src/core/lib/statistics/census_rpc_stats.c
index 524a60793a..2182561668 100644
--- a/src/core/statistics/census_rpc_stats.c
+++ b/src/core/lib/statistics/census_rpc_stats.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,16 +33,16 @@
#include <string.h>
-#include "src/core/statistics/census_interface.h"
-#include "src/core/statistics/census_rpc_stats.h"
-#include "src/core/statistics/hash_table.h"
-#include "src/core/statistics/census_tracing.h"
-#include "src/core/statistics/window_stats.h"
-#include "src/core/support/murmur_hash.h"
-#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
+#include "src/core/lib/statistics/census_interface.h"
+#include "src/core/lib/statistics/census_rpc_stats.h"
+#include "src/core/lib/statistics/census_tracing.h"
+#include "src/core/lib/statistics/hash_table.h"
+#include "src/core/lib/statistics/window_stats.h"
+#include "src/core/lib/support/murmur_hash.h"
+#include "src/core/lib/support/string.h"
#define NUM_INTERVALS 3
#define MINUTE_INTERVAL 0
@@ -85,8 +85,8 @@ static void delete_key(void *key) { gpr_free(key); }
static const census_ht_option ht_opt = {
CENSUS_HT_POINTER /* key type */, 1999 /* n_of_buckets */,
- simple_hash /* hash function */, cmp_str_keys /* key comparator */,
- delete_stats /* data deleter */, delete_key /* key deleter */
+ simple_hash /* hash function */, cmp_str_keys /* key comparator */,
+ delete_stats /* data deleter */, delete_key /* key deleter */
};
static void init_rpc_stats(void *stats) {
diff --git a/src/core/statistics/census_rpc_stats.h b/src/core/lib/statistics/census_rpc_stats.h
index 4cf17d2e52..00bb48205e 100644
--- a/src/core/statistics/census_rpc_stats.h
+++ b/src/core/lib/statistics/census_rpc_stats.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_STATISTICS_CENSUS_RPC_STATS_H
-#define GRPC_CORE_STATISTICS_CENSUS_RPC_STATS_H
+#ifndef GRPC_CORE_LIB_STATISTICS_CENSUS_RPC_STATS_H
+#define GRPC_CORE_LIB_STATISTICS_CENSUS_RPC_STATS_H
-#include "src/core/statistics/census_interface.h"
#include <grpc/support/port_platform.h>
+#include "src/core/lib/statistics/census_interface.h"
#ifdef __cplusplus
extern "C" {
@@ -98,4 +98,4 @@ void census_stats_store_shutdown(void);
}
#endif
-#endif /* GRPC_CORE_STATISTICS_CENSUS_RPC_STATS_H */
+#endif /* GRPC_CORE_LIB_STATISTICS_CENSUS_RPC_STATS_H */
diff --git a/src/core/statistics/census_tracing.c b/src/core/lib/statistics/census_tracing.c
index dc0f8a26f5..b58ae733fc 100644
--- a/src/core/statistics/census_tracing.c
+++ b/src/core/lib/statistics/census_tracing.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,18 +31,18 @@
*
*/
-#include "src/core/statistics/census_interface.h"
-#include "src/core/statistics/census_tracing.h"
+#include "src/core/lib/statistics/census_tracing.h"
+#include "src/core/lib/statistics/census_interface.h"
#include <stdio.h>
#include <string.h>
-#include "src/core/statistics/hash_table.h"
-#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/sync.h>
+#include "src/core/lib/statistics/hash_table.h"
+#include "src/core/lib/support/string.h"
void census_trace_obj_destroy(census_trace_obj *obj) {
census_trace_annotation *p = obj->annotations;
@@ -60,8 +60,11 @@ static void delete_trace_obj(void *obj) {
}
static const census_ht_option ht_opt = {
- CENSUS_HT_UINT64 /* key type */, 571 /* n_of_buckets */, NULL /* hash */,
- NULL /* compare_keys */, delete_trace_obj /* delete data */,
+ CENSUS_HT_UINT64 /* key type */,
+ 571 /* n_of_buckets */,
+ NULL /* hash */,
+ NULL /* compare_keys */,
+ delete_trace_obj /* delete data */,
NULL /* delete key */
};
diff --git a/src/core/statistics/census_tracing.h b/src/core/lib/statistics/census_tracing.h
index b611e95bf4..a101abf3cb 100644
--- a/src/core/statistics/census_tracing.h
+++ b/src/core/lib/statistics/census_tracing.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_STATISTICS_CENSUS_TRACING_H
-#define GRPC_CORE_STATISTICS_CENSUS_TRACING_H
+#ifndef GRPC_CORE_LIB_STATISTICS_CENSUS_TRACING_H
+#define GRPC_CORE_LIB_STATISTICS_CENSUS_TRACING_H
#include <grpc/support/time.h>
-#include "src/core/statistics/census_rpc_stats.h"
+#include "src/core/lib/statistics/census_rpc_stats.h"
/* WARNING: The data structures and APIs provided by this file are for GRPC
library's internal use ONLY. They might be changed in backward-incompatible
@@ -93,4 +93,4 @@ census_trace_obj **census_get_active_ops(int *num_active_ops);
}
#endif
-#endif /* GRPC_CORE_STATISTICS_CENSUS_TRACING_H */
+#endif /* GRPC_CORE_LIB_STATISTICS_CENSUS_TRACING_H */
diff --git a/src/core/statistics/hash_table.c b/src/core/lib/statistics/hash_table.c
index 0cadcd4740..18b7442a0c 100644
--- a/src/core/statistics/hash_table.c
+++ b/src/core/lib/statistics/hash_table.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,13 +31,13 @@
*
*/
-#include "src/core/statistics/hash_table.h"
+#include "src/core/lib/statistics/hash_table.h"
-#include <stdio.h>
#include <stddef.h>
+#include <stdio.h>
-#include <grpc/support/log.h>
#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#define CENSUS_HT_NUM_BUCKETS 1999
diff --git a/src/core/statistics/hash_table.h b/src/core/lib/statistics/hash_table.h
index f4bf2ba49a..8f74ec82aa 100644
--- a/src/core/statistics/hash_table.h
+++ b/src/core/lib/statistics/hash_table.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_STATISTICS_HASH_TABLE_H
-#define GRPC_CORE_STATISTICS_HASH_TABLE_H
+#ifndef GRPC_CORE_LIB_STATISTICS_HASH_TABLE_H
+#define GRPC_CORE_LIB_STATISTICS_HASH_TABLE_H
#include <stddef.h>
@@ -128,4 +128,4 @@ typedef void (*census_ht_itr_cb)(census_ht_key key, const void *val_ptr,
should not invalidate data entries. */
uint64_t census_ht_for_all(const census_ht *ht, census_ht_itr_cb);
-#endif /* GRPC_CORE_STATISTICS_HASH_TABLE_H */
+#endif /* GRPC_CORE_LIB_STATISTICS_HASH_TABLE_H */
diff --git a/src/core/statistics/window_stats.c b/src/core/lib/statistics/window_stats.c
index 3f2940853a..53427a24bc 100644
--- a/src/core/statistics/window_stats.c
+++ b/src/core/lib/statistics/window_stats.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,14 +31,14 @@
*
*/
-#include "src/core/statistics/window_stats.h"
-#include <math.h>
-#include <stddef.h>
-#include <string.h>
+#include "src/core/lib/statistics/window_stats.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.h>
+#include <math.h>
+#include <stddef.h>
+#include <string.h>
/* typedefs make typing long names easier. Use cws (for census_window_stats) */
typedef census_window_stats_stat_info cws_stat_info;
diff --git a/src/core/statistics/window_stats.h b/src/core/lib/statistics/window_stats.h
index 774277180f..8dec50d620 100644
--- a/src/core/statistics/window_stats.h
+++ b/src/core/lib/statistics/window_stats.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_STATISTICS_WINDOW_STATS_H
-#define GRPC_CORE_STATISTICS_WINDOW_STATS_H
+#ifndef GRPC_CORE_LIB_STATISTICS_WINDOW_STATS_H
+#define GRPC_CORE_LIB_STATISTICS_WINDOW_STATS_H
#include <grpc/support/time.h>
@@ -170,4 +170,4 @@ void census_window_stats_get_sums(const struct census_window_stats *wstats,
assertion failure). This function is thread-compatible. */
void census_window_stats_destroy(struct census_window_stats *wstats);
-#endif /* GRPC_CORE_STATISTICS_WINDOW_STATS_H */
+#endif /* GRPC_CORE_LIB_STATISTICS_WINDOW_STATS_H */
diff --git a/src/core/support/alloc.c b/src/core/lib/support/alloc.c
index b99584bd20..27fa6a95ed 100644
--- a/src/core/support/alloc.c
+++ b/src/core/lib/support/alloc.c
@@ -33,10 +33,10 @@
#include <grpc/support/alloc.h>
-#include <stdlib.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
-#include "src/core/profiling/timers.h"
+#include <stdlib.h>
+#include "src/core/lib/profiling/timers.h"
static gpr_allocation_functions g_alloc_functions = {malloc, realloc, free};
diff --git a/src/core/support/avl.c b/src/core/lib/support/avl.c
index f378b3ee17..f378b3ee17 100644
--- a/src/core/support/avl.c
+++ b/src/core/lib/support/avl.c
diff --git a/src/core/support/backoff.c b/src/core/lib/support/backoff.c
index 7458219645..e89ef47220 100644
--- a/src/core/support/backoff.c
+++ b/src/core/lib/support/backoff.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/support/backoff.h"
+#include "src/core/lib/support/backoff.h"
#include <grpc/support/useful.h>
@@ -69,3 +69,8 @@ gpr_timespec gpr_backoff_step(gpr_backoff *backoff, gpr_timespec now) {
return gpr_time_add(
now, gpr_time_from_millis(backoff->current_timeout_millis, GPR_TIMESPAN));
}
+
+void gpr_backoff_reset(gpr_backoff *backoff) {
+ // forces step() to return a timeout of min_timeout_millis
+ backoff->current_timeout_millis = 0;
+}
diff --git a/src/core/support/backoff.h b/src/core/lib/support/backoff.h
index f7730fde2a..6d40c15546 100644
--- a/src/core/support/backoff.h
+++ b/src/core/lib/support/backoff.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_SUPPORT_BACKOFF_H
-#define GRPC_CORE_SUPPORT_BACKOFF_H
+#ifndef GRPC_CORE_LIB_SUPPORT_BACKOFF_H
+#define GRPC_CORE_LIB_SUPPORT_BACKOFF_H
#include <grpc/support/time.h>
@@ -61,5 +61,8 @@ void gpr_backoff_init(gpr_backoff *backoff, double multiplier, double jitter,
gpr_timespec gpr_backoff_begin(gpr_backoff *backoff, gpr_timespec now);
/// Step a retry loop: returns a timespec for the NEXT retry
gpr_timespec gpr_backoff_step(gpr_backoff *backoff, gpr_timespec now);
+/// Reset the backoff, so the next gpr_backoff_step will be a gpr_backoff_begin
+/// instead
+void gpr_backoff_reset(gpr_backoff *backoff);
-#endif /* GRPC_CORE_SUPPORT_BACKOFF_H */
+#endif /* GRPC_CORE_LIB_SUPPORT_BACKOFF_H */
diff --git a/src/core/support/block_annotate.h b/src/core/lib/support/block_annotate.h
index 79a18039f4..bd3071655e 100644
--- a/src/core/support/block_annotate.h
+++ b/src/core/lib/support/block_annotate.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_SUPPORT_BLOCK_ANNOTATE_H
-#define GRPC_CORE_SUPPORT_BLOCK_ANNOTATE_H
+#ifndef GRPC_CORE_LIB_SUPPORT_BLOCK_ANNOTATE_H
+#define GRPC_CORE_LIB_SUPPORT_BLOCK_ANNOTATE_H
/* These annotations identify the beginning and end of regions where
the code may block for reasons other than synchronization functions.
@@ -45,4 +45,4 @@
do { \
} while (0)
-#endif /* GRPC_CORE_SUPPORT_BLOCK_ANNOTATE_H */
+#endif /* GRPC_CORE_LIB_SUPPORT_BLOCK_ANNOTATE_H */
diff --git a/src/core/support/cmdline.c b/src/core/lib/support/cmdline.c
index b517f30b2d..35c4990b22 100644
--- a/src/core/support/cmdline.c
+++ b/src/core/lib/support/cmdline.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,10 +37,10 @@
#include <stdio.h>
#include <string.h>
-#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+#include "src/core/lib/support/string.h"
typedef enum { ARGTYPE_INT, ARGTYPE_BOOL, ARGTYPE_STRING } argtype;
diff --git a/src/core/support/cpu_iphone.c b/src/core/lib/support/cpu_iphone.c
index 82b49b47bc..e83191bada 100644
--- a/src/core/support/cpu_iphone.c
+++ b/src/core/lib/support/cpu_iphone.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/support/cpu_linux.c b/src/core/lib/support/cpu_linux.c
index 7af6a8f009..5597df2d03 100644
--- a/src/core/support/cpu_linux.c
+++ b/src/core/lib/support/cpu_linux.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -39,10 +39,10 @@
#ifdef GPR_CPU_LINUX
-#include <sched.h>
#include <errno.h>
-#include <unistd.h>
+#include <sched.h>
#include <string.h>
+#include <unistd.h>
#include <grpc/support/cpu.h>
#include <grpc/support/log.h>
diff --git a/src/core/support/cpu_posix.c b/src/core/lib/support/cpu_posix.c
index 8f01c284ca..e508ddd8ca 100644
--- a/src/core/support/cpu_posix.c
+++ b/src/core/lib/support/cpu_posix.c
@@ -36,8 +36,8 @@
#ifdef GPR_CPU_POSIX
#include <errno.h>
-#include <unistd.h>
#include <string.h>
+#include <unistd.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
diff --git a/src/core/support/cpu_windows.c b/src/core/lib/support/cpu_windows.c
index ce32eb0a9d..0f84a9e5ea 100644
--- a/src/core/support/cpu_windows.c
+++ b/src/core/lib/support/cpu_windows.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/support/env.h b/src/core/lib/support/env.h
index 2902456947..ddc4ee3c6d 100644
--- a/src/core/support/env.h
+++ b/src/core/lib/support/env.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_SUPPORT_ENV_H
-#define GRPC_CORE_SUPPORT_ENV_H
+#ifndef GRPC_CORE_LIB_SUPPORT_ENV_H
+#define GRPC_CORE_LIB_SUPPORT_ENV_H
#include <stdio.h>
@@ -57,4 +57,4 @@ void gpr_setenv(const char *name, const char *value);
}
#endif
-#endif /* GRPC_CORE_SUPPORT_ENV_H */
+#endif /* GRPC_CORE_LIB_SUPPORT_ENV_H */
diff --git a/src/core/support/env_linux.c b/src/core/lib/support/env_linux.c
index fe51f846b7..a86133e6c3 100644
--- a/src/core/support/env_linux.c
+++ b/src/core/lib/support/env_linux.c
@@ -40,7 +40,7 @@
#ifdef GPR_LINUX_ENV
-#include "src/core/support/env.h"
+#include "src/core/lib/support/env.h"
#include <dlfcn.h>
#include <features.h>
@@ -51,7 +51,7 @@
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
-#include "src/core/support/string.h"
+#include "src/core/lib/support/string.h"
char *gpr_getenv(const char *name) {
#if defined(GPR_BACKWARDS_COMPATIBILITY_MODE)
diff --git a/src/core/support/env_posix.c b/src/core/lib/support/env_posix.c
index 1dd2af56bc..1b57b094a9 100644
--- a/src/core/support/env_posix.c
+++ b/src/core/lib/support/env_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,14 +35,14 @@
#ifdef GPR_POSIX_ENV
-#include "src/core/support/env.h"
+#include "src/core/lib/support/env.h"
#include <stdlib.h>
#include <grpc/support/log.h>
-#include "src/core/support/string.h"
#include <grpc/support/string_util.h>
+#include "src/core/lib/support/string.h"
char *gpr_getenv(const char *name) {
char *result = getenv(name);
diff --git a/src/core/support/env_win32.c b/src/core/lib/support/env_win32.c
index 10258283ba..566feee49e 100644
--- a/src/core/support/env_win32.c
+++ b/src/core/lib/support/env_win32.c
@@ -35,8 +35,8 @@
#ifdef GPR_WIN32
-#include "src/core/support/env.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/support/env.h"
+#include "src/core/lib/support/string.h"
#ifdef __MINGW32__
errno_t getenv_s(size_t *size_needed, char *buffer, size_t size,
diff --git a/src/core/support/histogram.c b/src/core/lib/support/histogram.c
index 20ed2b14b1..62227be1a6 100644
--- a/src/core/support/histogram.c
+++ b/src/core/lib/support/histogram.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,8 +38,8 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/port_platform.h>
#include <grpc/support/log.h>
+#include <grpc/support/port_platform.h>
#include <grpc/support/useful.h>
/* Histograms are stored with exponentially increasing bucket sizes.
diff --git a/src/core/support/host_port.c b/src/core/lib/support/host_port.c
index 23f65b1581..e03f6241ff 100644
--- a/src/core/support/host_port.c
+++ b/src/core/lib/support/host_port.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,10 +35,10 @@
#include <string.h>
-#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
+#include "src/core/lib/support/string.h"
int gpr_join_host_port(char **out, const char *host, int port) {
if (host[0] != '[' && strchr(host, ':') != NULL) {
diff --git a/src/core/support/load_file.c b/src/core/lib/support/load_file.c
index 650bd62ccb..0cecd5edd5 100644
--- a/src/core/support/load_file.c
+++ b/src/core/lib/support/load_file.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/support/load_file.h"
+#include "src/core/lib/support/load_file.h"
#include <errno.h>
#include <string.h>
@@ -40,8 +40,8 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-#include "src/core/support/block_annotate.h"
-#include "src/core/support/string.h"
+#include "src/core/lib/support/block_annotate.h"
+#include "src/core/lib/support/string.h"
gpr_slice gpr_load_file(const char *filename, int add_null_terminator,
int *success) {
diff --git a/src/core/support/load_file.h b/src/core/lib/support/load_file.h
index 5896654e9a..fe030c967e 100644
--- a/src/core/support/load_file.h
+++ b/src/core/lib/support/load_file.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_SUPPORT_LOAD_FILE_H
-#define GRPC_CORE_SUPPORT_LOAD_FILE_H
+#ifndef GRPC_CORE_LIB_SUPPORT_LOAD_FILE_H
+#define GRPC_CORE_LIB_SUPPORT_LOAD_FILE_H
#include <stdio.h>
@@ -52,4 +52,4 @@ gpr_slice gpr_load_file(const char *filename, int add_null_terminator,
}
#endif
-#endif /* GRPC_CORE_SUPPORT_LOAD_FILE_H */
+#endif /* GRPC_CORE_LIB_SUPPORT_LOAD_FILE_H */
diff --git a/src/core/support/log.c b/src/core/lib/support/log.c
index 04156a5b1f..cd6a0726cf 100644
--- a/src/core/support/log.c
+++ b/src/core/lib/support/log.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/support/log_android.c b/src/core/lib/support/log_android.c
index 5d0c7d820d..640c9d7099 100644
--- a/src/core/support/log_android.c
+++ b/src/core/lib/support/log_android.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,12 +35,12 @@
#ifdef GPR_ANDROID
+#include <android/log.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
-#include <stdio.h>
#include <stdarg.h>
+#include <stdio.h>
#include <string.h>
-#include <android/log.h>
static android_LogPriority severity_to_log_priority(gpr_log_severity severity) {
switch (severity) {
diff --git a/src/core/support/log_linux.c b/src/core/lib/support/log_linux.c
index d66b7a3cc0..e60512c526 100644
--- a/src/core/support/log_linux.c
+++ b/src/core/lib/support/log_linux.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,12 +47,12 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
-#include <stdio.h>
+#include <linux/unistd.h>
#include <stdarg.h>
+#include <stdio.h>
#include <string.h>
-#include <time.h>
-#include <linux/unistd.h>
#include <sys/syscall.h>
+#include <time.h>
#include <unistd.h>
static long gettid(void) { return syscall(__NR_gettid); }
diff --git a/src/core/support/log_posix.c b/src/core/lib/support/log_posix.c
index 3ff171f99c..7429dd0a2c 100644
--- a/src/core/support/log_posix.c
+++ b/src/core/lib/support/log_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,12 +38,12 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/time.h>
-#include <stdio.h>
+#include <pthread.h>
#include <stdarg.h>
-#include <string.h>
#include <stdio.h>
+#include <stdio.h>
+#include <string.h>
#include <time.h>
-#include <pthread.h>
static intptr_t gettid(void) { return (intptr_t)pthread_self(); }
diff --git a/src/core/support/log_win32.c b/src/core/lib/support/log_win32.c
index e18e667fe5..cec99440a5 100644
--- a/src/core/support/log_win32.c
+++ b/src/core/lib/support/log_win32.c
@@ -35,17 +35,17 @@
#ifdef GPR_WIN32
-#include <stdio.h>
#include <stdarg.h>
+#include <stdio.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/log_win32.h>
#include <grpc/support/log.h>
-#include <grpc/support/time.h>
+#include <grpc/support/log_win32.h>
#include <grpc/support/string_util.h>
+#include <grpc/support/time.h>
-#include "src/core/support/string.h"
-#include "src/core/support/string_win32.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/support/string_win32.h"
void gpr_log(const char *file, int line, gpr_log_severity severity,
const char *format, ...) {
diff --git a/src/core/support/murmur_hash.c b/src/core/lib/support/murmur_hash.c
index a5261c0cc0..97832f1510 100644
--- a/src/core/support/murmur_hash.c
+++ b/src/core/lib/support/murmur_hash.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/support/murmur_hash.h"
+#include "src/core/lib/support/murmur_hash.h"
#define ROTL32(x, r) ((x) << (r)) | ((x) >> (32 - (r)))
diff --git a/src/core/support/murmur_hash.h b/src/core/lib/support/murmur_hash.h
index 0f0b399e5d..e54cdf2592 100644
--- a/src/core/support/murmur_hash.h
+++ b/src/core/lib/support/murmur_hash.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_SUPPORT_MURMUR_HASH_H
-#define GRPC_CORE_SUPPORT_MURMUR_HASH_H
+#ifndef GRPC_CORE_LIB_SUPPORT_MURMUR_HASH_H
+#define GRPC_CORE_LIB_SUPPORT_MURMUR_HASH_H
#include <grpc/support/port_platform.h>
@@ -41,4 +41,4 @@
/* compute the hash of key (length len) */
uint32_t gpr_murmur_hash3(const void *key, size_t len, uint32_t seed);
-#endif /* GRPC_CORE_SUPPORT_MURMUR_HASH_H */
+#endif /* GRPC_CORE_LIB_SUPPORT_MURMUR_HASH_H */
diff --git a/src/core/support/slice.c b/src/core/lib/support/slice.c
index b9a7c77bda..cf3953ce4e 100644
--- a/src/core/support/slice.c
+++ b/src/core/lib/support/slice.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/support/slice_buffer.c b/src/core/lib/support/slice_buffer.c
index 66f111d767..563e659dd7 100644
--- a/src/core/support/slice_buffer.c
+++ b/src/core/lib/support/slice_buffer.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/support/stack_lockfree.c b/src/core/lib/support/stack_lockfree.c
index 9daecd2e18..de80486132 100644
--- a/src/core/support/stack_lockfree.c
+++ b/src/core/lib/support/stack_lockfree.c
@@ -31,15 +31,15 @@
*
*/
-#include "src/core/support/stack_lockfree.h"
+#include "src/core/lib/support/stack_lockfree.h"
#include <stdlib.h>
#include <string.h>
-#include <grpc/support/port_platform.h>
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
+#include <grpc/support/port_platform.h>
/* The lockfree node structure is a single architecture-level
word that allows for an atomic CAS to set it up. */
@@ -64,10 +64,10 @@ typedef union lockfree_node {
struct lockfree_node_contents contents;
} lockfree_node;
-#define ENTRY_ALIGNMENT_BITS 3 /* make sure that entries aligned to 8-bytes */
-#define INVALID_ENTRY_INDEX \
- ((1 << 16) - 1) /* reserve this entry as invalid \
- */
+/* make sure that entries aligned to 8-bytes */
+#define ENTRY_ALIGNMENT_BITS 3
+/* reserve this entry as invalid */
+#define INVALID_ENTRY_INDEX ((1 << 16) - 1)
struct gpr_stack_lockfree {
lockfree_node *entries;
diff --git a/src/core/support/stack_lockfree.h b/src/core/lib/support/stack_lockfree.h
index d6fd06d67c..a030a01d1f 100644
--- a/src/core/support/stack_lockfree.h
+++ b/src/core/lib/support/stack_lockfree.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_SUPPORT_STACK_LOCKFREE_H
-#define GRPC_CORE_SUPPORT_STACK_LOCKFREE_H
+#ifndef GRPC_CORE_LIB_SUPPORT_STACK_LOCKFREE_H
+#define GRPC_CORE_LIB_SUPPORT_STACK_LOCKFREE_H
#include <stddef.h>
@@ -50,4 +50,4 @@ int gpr_stack_lockfree_push(gpr_stack_lockfree *, int entry);
/* Returns -1 on empty or the actual entry number */
int gpr_stack_lockfree_pop(gpr_stack_lockfree *stack);
-#endif /* GRPC_CORE_SUPPORT_STACK_LOCKFREE_H */
+#endif /* GRPC_CORE_LIB_SUPPORT_STACK_LOCKFREE_H */
diff --git a/src/core/support/string.c b/src/core/lib/support/string.c
index 1f541de40f..365d861de3 100644
--- a/src/core/support/string.c
+++ b/src/core/lib/support/string.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/support/string.h"
+#include "src/core/lib/support/string.h"
#include <ctype.h>
#include <stddef.h>
diff --git a/src/core/support/string.h b/src/core/lib/support/string.h
index a367ed7cd8..68c02878e0 100644
--- a/src/core/support/string.h
+++ b/src/core/lib/support/string.h
@@ -31,14 +31,14 @@
*
*/
-#ifndef GRPC_CORE_SUPPORT_STRING_H
-#define GRPC_CORE_SUPPORT_STRING_H
+#ifndef GRPC_CORE_LIB_SUPPORT_STRING_H
+#define GRPC_CORE_LIB_SUPPORT_STRING_H
#include <stddef.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/slice.h>
+#include <grpc/support/slice_buffer.h>
#ifdef __cplusplus
extern "C" {
@@ -118,4 +118,4 @@ char *gpr_strvec_flatten(gpr_strvec *strs, size_t *total_length);
}
#endif
-#endif /* GRPC_CORE_SUPPORT_STRING_H */
+#endif /* GRPC_CORE_LIB_SUPPORT_STRING_H */
diff --git a/src/core/support/string_posix.c b/src/core/lib/support/string_posix.c
index 25c333db4e..a73b3106a5 100644
--- a/src/core/support/string_posix.c
+++ b/src/core/lib/support/string_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,8 +35,8 @@
#ifdef GPR_POSIX_STRING
-#include <stdio.h>
#include <stdarg.h>
+#include <stdio.h>
#include <string.h>
#include <grpc/support/alloc.h>
diff --git a/src/core/support/string_win32.c b/src/core/lib/support/string_win32.c
index 3b1f702cf1..16b7e37f2a 100644
--- a/src/core/support/string_win32.c
+++ b/src/core/lib/support/string_win32.c
@@ -37,13 +37,13 @@
#ifdef GPR_WIN32
-#include <stdio.h>
#include <stdarg.h>
+#include <stdio.h>
#include <string.h>
#include <grpc/support/alloc.h>
-#include "src/core/support/string.h"
+#include "src/core/lib/support/string.h"
int gpr_asprintf(char **strp, const char *format, ...) {
va_list args;
diff --git a/src/core/support/string_win32.h b/src/core/lib/support/string_win32.h
index c9ae8d9932..f47d567715 100644
--- a/src/core/support/string_win32.h
+++ b/src/core/lib/support/string_win32.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_SUPPORT_STRING_WIN32_H
-#define GRPC_CORE_SUPPORT_STRING_WIN32_H
+#ifndef GRPC_CORE_LIB_SUPPORT_STRING_WIN32_H
+#define GRPC_CORE_LIB_SUPPORT_STRING_WIN32_H
#include <grpc/support/port_platform.h>
@@ -44,4 +44,4 @@ LPSTR gpr_tchar_to_char(LPCTSTR input);
#endif /* GPR_WIN32 */
-#endif /* GRPC_CORE_SUPPORT_STRING_WIN32_H */
+#endif /* GRPC_CORE_LIB_SUPPORT_STRING_WIN32_H */
diff --git a/src/core/support/subprocess_posix.c b/src/core/lib/support/subprocess_posix.c
index 171054e4da..662e7dd999 100644
--- a/src/core/support/subprocess_posix.c
+++ b/src/core/lib/support/subprocess_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,15 +37,15 @@
#include <grpc/support/subprocess.h>
-#include <unistd.h>
#include <assert.h>
#include <errno.h>
-#include <stdio.h>
-#include <string.h>
#include <signal.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <unistd.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
diff --git a/src/core/support/subprocess_windows.c b/src/core/lib/support/subprocess_windows.c
index 2b25ef063a..264306f1bd 100644
--- a/src/core/support/subprocess_windows.c
+++ b/src/core/lib/support/subprocess_windows.c
@@ -35,15 +35,15 @@
#ifdef GPR_WINDOWS_SUBPROCESS
-#include <windows.h>
#include <string.h>
#include <tchar.h>
+#include <windows.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/subprocess.h>
-#include "src/core/support/string.h"
-#include "src/core/support/string_win32.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/support/string_win32.h"
struct gpr_subprocess {
PROCESS_INFORMATION pi;
diff --git a/src/core/support/sync.c b/src/core/lib/support/sync.c
index 69e3e39c5c..800cf20287 100644
--- a/src/core/support/sync.c
+++ b/src/core/lib/support/sync.c
@@ -33,9 +33,9 @@
/* Generic implementation of synchronization primitives. */
+#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
-#include <grpc/support/atm.h>
/* Number of mutexes to allocate for events, to avoid lock contention.
Should be a prime. */
diff --git a/src/core/support/sync_posix.c b/src/core/lib/support/sync_posix.c
index d3c483f1b5..a5e59db8c7 100644
--- a/src/core/support/sync_posix.c
+++ b/src/core/lib/support/sync_posix.c
@@ -36,11 +36,11 @@
#ifdef GPR_POSIX_SYNC
#include <errno.h>
-#include <time.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
-#include "src/core/profiling/timers.h"
+#include <time.h>
+#include "src/core/lib/profiling/timers.h"
void gpr_mu_init(gpr_mu* mu) { GPR_ASSERT(pthread_mutex_init(mu, NULL) == 0); }
diff --git a/src/core/support/sync_win32.c b/src/core/lib/support/sync_win32.c
index 41998ebcb6..41998ebcb6 100644
--- a/src/core/support/sync_win32.c
+++ b/src/core/lib/support/sync_win32.c
diff --git a/src/core/support/thd.c b/src/core/lib/support/thd.c
index 41daeb5d0e..d59aace38d 100644
--- a/src/core/support/thd.c
+++ b/src/core/lib/support/thd.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/support/thd_internal.h b/src/core/lib/support/thd_internal.h
index 33b904e59b..f269a3249e 100644
--- a/src/core/support/thd_internal.h
+++ b/src/core/lib/support/thd_internal.h
@@ -31,9 +31,9 @@
*
*/
-#ifndef GRPC_CORE_SUPPORT_THD_INTERNAL_H
-#define GRPC_CORE_SUPPORT_THD_INTERNAL_H
+#ifndef GRPC_CORE_LIB_SUPPORT_THD_INTERNAL_H
+#define GRPC_CORE_LIB_SUPPORT_THD_INTERNAL_H
/* Internal interfaces between modules within the gpr support library. */
-#endif /* GRPC_CORE_SUPPORT_THD_INTERNAL_H */
+#endif /* GRPC_CORE_LIB_SUPPORT_THD_INTERNAL_H */
diff --git a/src/core/support/thd_posix.c b/src/core/lib/support/thd_posix.c
index 653a1c88c1..4d874d3656 100644
--- a/src/core/support/thd_posix.c
+++ b/src/core/lib/support/thd_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,13 +37,13 @@
#ifdef GPR_POSIX_SYNC
-#include <pthread.h>
-#include <stdlib.h>
-#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <string.h>
struct thd_arg {
void (*body)(void *arg); /* body of a thread */
diff --git a/src/core/support/thd_win32.c b/src/core/lib/support/thd_win32.c
index a9db180c1b..630eb7f625 100644
--- a/src/core/support/thd_win32.c
+++ b/src/core/lib/support/thd_win32.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,10 +37,10 @@
#ifdef GPR_WIN32
-#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/thd.h>
+#include <string.h>
#if defined(_MSC_VER)
#define thread_local __declspec(thread)
diff --git a/src/core/support/time.c b/src/core/lib/support/time.c
index 423d12ffc0..0e2c8fcf1a 100644
--- a/src/core/support/time.c
+++ b/src/core/lib/support/time.c
@@ -33,11 +33,11 @@
/* Generic implementation of time calls. */
+#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
-#include <grpc/support/log.h>
int gpr_time_cmp(gpr_timespec a, gpr_timespec b) {
int cmp = (a.tv_sec > b.tv_sec) - (a.tv_sec < b.tv_sec);
diff --git a/src/core/support/time_posix.c b/src/core/lib/support/time_posix.c
index 36d75e7da2..fcfab2f2fa 100644
--- a/src/core/support/time_posix.c
+++ b/src/core/lib/support/time_posix.c
@@ -32,7 +32,7 @@
*/
#include <grpc/support/port_platform.h>
-#include <src/core/support/time_precise.h>
+#include "src/core/lib/support/time_precise.h"
#ifdef GPR_POSIX_TIME
@@ -44,7 +44,7 @@
#endif
#include <grpc/support/log.h>
#include <grpc/support/time.h>
-#include "src/core/support/block_annotate.h"
+#include "src/core/lib/support/block_annotate.h"
static struct timespec timespec_from_gpr(gpr_timespec gts) {
struct timespec rv;
@@ -98,9 +98,9 @@ gpr_timespec gpr_now(gpr_clock_type clock_type) {
#else
/* For some reason Apple's OSes haven't implemented clock_gettime. */
-#include <sys/time.h>
#include <mach/mach.h>
#include <mach/mach_time.h>
+#include <sys/time.h>
static double g_time_scale;
static uint64_t g_time_start;
diff --git a/src/core/support/time_precise.c b/src/core/lib/support/time_precise.c
index a2cf74bc84..31ac47e0f8 100644
--- a/src/core/support/time_precise.c
+++ b/src/core/lib/support/time_precise.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/support/time_precise.h b/src/core/lib/support/time_precise.h
index 871c99a623..e1faee1f9f 100644
--- a/src/core/support/time_precise.h
+++ b/src/core/lib/support/time_precise.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_SUPPORT_TIME_PRECISE_H
-#define GRPC_CORE_SUPPORT_TIME_PRECISE_H
+#ifndef GRPC_CORE_LIB_SUPPORT_TIME_PRECISE_H
+#define GRPC_CORE_LIB_SUPPORT_TIME_PRECISE_H
#include <grpc/support/time.h>
void gpr_precise_clock_init(void);
void gpr_precise_clock_now(gpr_timespec *clk);
-#endif /* GRPC_CORE_SUPPORT_TIME_PRECISE_H */
+#endif /* GRPC_CORE_LIB_SUPPORT_TIME_PRECISE_H */
diff --git a/src/core/support/time_win32.c b/src/core/lib/support/time_win32.c
index 8af957e6f4..a6ac003fb8 100644
--- a/src/core/support/time_win32.c
+++ b/src/core/lib/support/time_win32.c
@@ -39,12 +39,12 @@
#include <grpc/support/log.h>
#include <grpc/support/time.h>
-#include <src/core/support/time_precise.h>
-#include <sys/timeb.h>
-#include <process.h>
#include <limits.h>
+#include <process.h>
+#include <sys/timeb.h>
-#include "src/core/support/block_annotate.h"
+#include "src/core/lib/support/block_annotate.h"
+#include "src/core/lib/support/time_precise.h"
static LARGE_INTEGER g_start_time;
static double g_time_scale;
diff --git a/src/core/support/tls_pthread.c b/src/core/lib/support/tls_pthread.c
index 9683a6e547..bdc7ed14ae 100644
--- a/src/core/support/tls_pthread.c
+++ b/src/core/lib/support/tls_pthread.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/support/tmpfile.h b/src/core/lib/support/tmpfile.h
index df6f8692bb..4fec2076e3 100644
--- a/src/core/support/tmpfile.h
+++ b/src/core/lib/support/tmpfile.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_SUPPORT_TMPFILE_H
-#define GRPC_CORE_SUPPORT_TMPFILE_H
+#ifndef GRPC_CORE_LIB_SUPPORT_TMPFILE_H
+#define GRPC_CORE_LIB_SUPPORT_TMPFILE_H
#include <stdio.h>
@@ -52,4 +52,4 @@ FILE *gpr_tmpfile(const char *prefix, char **tmp_filename);
}
#endif
-#endif /* GRPC_CORE_SUPPORT_TMPFILE_H */
+#endif /* GRPC_CORE_LIB_SUPPORT_TMPFILE_H */
diff --git a/src/core/support/tmpfile_posix.c b/src/core/lib/support/tmpfile_posix.c
index b16eeacf9d..743f45e1bc 100644
--- a/src/core/support/tmpfile_posix.c
+++ b/src/core/lib/support/tmpfile_posix.c
@@ -35,7 +35,7 @@
#ifdef GPR_POSIX_FILE
-#include "src/core/support/tmpfile.h"
+#include "src/core/lib/support/tmpfile.h"
#include <errno.h>
#include <stdlib.h>
@@ -46,7 +46,7 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-#include "src/core/support/string.h"
+#include "src/core/lib/support/string.h"
FILE *gpr_tmpfile(const char *prefix, char **tmp_filename) {
FILE *result = NULL;
diff --git a/src/core/support/tmpfile_win32.c b/src/core/lib/support/tmpfile_win32.c
index 3000f0029f..05d92b6036 100644
--- a/src/core/support/tmpfile_win32.c
+++ b/src/core/lib/support/tmpfile_win32.c
@@ -44,8 +44,8 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-#include "src/core/support/string_win32.h"
-#include "src/core/support/tmpfile.h"
+#include "src/core/lib/support/string_win32.h"
+#include "src/core/lib/support/tmpfile.h"
FILE *gpr_tmpfile(const char *prefix, char **tmp_filename_out) {
FILE *result = NULL;
diff --git a/src/core/support/wrap_memcpy.c b/src/core/lib/support/wrap_memcpy.c
index 15c289f7b8..15c289f7b8 100644
--- a/src/core/support/wrap_memcpy.c
+++ b/src/core/lib/support/wrap_memcpy.c
diff --git a/src/core/surface/alarm.c b/src/core/lib/surface/alarm.c
index 8169ede065..368683378e 100644
--- a/src/core/surface/alarm.c
+++ b/src/core/lib/surface/alarm.c
@@ -31,10 +31,10 @@
*
*/
-#include "src/core/iomgr/timer.h"
-#include "src/core/surface/completion_queue.h"
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
+#include "src/core/lib/iomgr/timer.h"
+#include "src/core/lib/surface/completion_queue.h"
struct grpc_alarm {
grpc_timer alarm;
diff --git a/src/core/surface/api_trace.c b/src/core/lib/surface/api_trace.c
index 9f0b900d46..3702c024db 100644
--- a/src/core/surface/api_trace.c
+++ b/src/core/lib/surface/api_trace.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,6 @@
*
*/
-#include "src/core/surface/api_trace.h"
+#include "src/core/lib/surface/api_trace.h"
int grpc_api_trace = 0;
diff --git a/src/core/surface/api_trace.h b/src/core/lib/surface/api_trace.h
index 29a9b2d79c..b50011c9e5 100644
--- a/src/core/surface/api_trace.h
+++ b/src/core/lib/surface/api_trace.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_SURFACE_API_TRACE_H
-#define GRPC_CORE_SURFACE_API_TRACE_H
+#ifndef GRPC_CORE_LIB_SURFACE_API_TRACE_H
+#define GRPC_CORE_LIB_SURFACE_API_TRACE_H
-#include "src/core/debug/trace.h"
#include <grpc/support/log.h>
+#include "src/core/lib/debug/trace.h"
extern int grpc_api_trace;
@@ -62,4 +62,4 @@ extern int grpc_api_trace;
gpr_log(GPR_INFO, fmt GRPC_API_TRACE_UNWRAP##nargs args); \
}
-#endif /* GRPC_CORE_SURFACE_API_TRACE_H */
+#endif /* GRPC_CORE_LIB_SURFACE_API_TRACE_H */
diff --git a/src/core/surface/byte_buffer.c b/src/core/lib/surface/byte_buffer.c
index fb39c4531d..03071ef92c 100644
--- a/src/core/surface/byte_buffer.c
+++ b/src/core/lib/surface/byte_buffer.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/surface/byte_buffer_reader.c b/src/core/lib/surface/byte_buffer_reader.c
index 4679854227..7248f5fe71 100644
--- a/src/core/surface/byte_buffer_reader.c
+++ b/src/core/lib/surface/byte_buffer_reader.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,17 +31,17 @@
*
*/
-#include <string.h>
#include <grpc/byte_buffer_reader.h>
+#include <string.h>
+#include <grpc/byte_buffer.h>
#include <grpc/compression.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/slice_buffer.h>
-#include <grpc/byte_buffer.h>
-#include "src/core/compression/message_compress.h"
+#include "src/core/lib/compression/message_compress.h"
static int is_compressed(grpc_byte_buffer *buffer) {
switch (buffer->type) {
diff --git a/src/core/surface/call.c b/src/core/lib/surface/call.c
index ecb53615c9..937963812f 100644
--- a/src/core/surface/call.c
+++ b/src/core/lib/surface/call.c
@@ -43,16 +43,16 @@
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
-#include "src/core/channel/channel_stack.h"
-#include "src/core/compression/algorithm_metadata.h"
-#include "src/core/iomgr/timer.h"
-#include "src/core/profiling/timers.h"
-#include "src/core/support/string.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/call.h"
-#include "src/core/surface/channel.h"
-#include "src/core/surface/completion_queue.h"
-#include "src/core/transport/static_metadata.h"
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/compression/algorithm_metadata.h"
+#include "src/core/lib/iomgr/timer.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/call.h"
+#include "src/core/lib/surface/channel.h"
+#include "src/core/lib/surface/completion_queue.h"
+#include "src/core/lib/transport/static_metadata.h"
/** The maximum number of concurrent batches possible.
Based upon the maximum number of individually queueable ops in the batch
diff --git a/src/core/surface/call.h b/src/core/lib/surface/call.h
index d2edf03d45..e2e75865be 100644
--- a/src/core/surface/call.h
+++ b/src/core/lib/surface/call.h
@@ -31,13 +31,13 @@
*
*/
-#ifndef GRPC_CORE_SURFACE_CALL_H
-#define GRPC_CORE_SURFACE_CALL_H
+#ifndef GRPC_CORE_LIB_SURFACE_CALL_H
+#define GRPC_CORE_LIB_SURFACE_CALL_H
-#include "src/core/channel/channel_stack.h"
-#include "src/core/channel/context.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/surface_trace.h"
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/channel/context.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/surface_trace.h"
#include <grpc/grpc.h>
#include <grpc/impl/codegen/compression_types.h>
@@ -113,4 +113,4 @@ grpc_compression_algorithm grpc_call_compression_for_level(
}
#endif
-#endif /* GRPC_CORE_SURFACE_CALL_H */
+#endif /* GRPC_CORE_LIB_SURFACE_CALL_H */
diff --git a/src/core/surface/call_details.c b/src/core/lib/surface/call_details.c
index 60f0029819..08f606d84a 100644
--- a/src/core/surface/call_details.c
+++ b/src/core/lib/surface/call_details.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,7 @@
#include <string.h>
-#include "src/core/surface/api_trace.h"
+#include "src/core/lib/surface/api_trace.h"
void grpc_call_details_init(grpc_call_details* cd) {
GRPC_API_TRACE("grpc_call_details_init(cd=%p)", 1, (cd));
diff --git a/src/core/surface/call_log_batch.c b/src/core/lib/surface/call_log_batch.c
index 46756f418b..bc5a2ffb65 100644
--- a/src/core/surface/call_log_batch.c
+++ b/src/core/lib/surface/call_log_batch.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,11 +31,11 @@
*
*/
-#include "src/core/surface/call.h"
+#include "src/core/lib/surface/call.h"
-#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
+#include "src/core/lib/support/string.h"
static void add_metadata(gpr_strvec *b, const grpc_metadata *md, size_t count) {
size_t i;
diff --git a/src/core/surface/call_test_only.h b/src/core/lib/surface/call_test_only.h
index fdc43a383b..400214189e 100644
--- a/src/core/surface/call_test_only.h
+++ b/src/core/lib/surface/call_test_only.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_SURFACE_CALL_TEST_ONLY_H
-#define GRPC_CORE_SURFACE_CALL_TEST_ONLY_H
+#ifndef GRPC_CORE_LIB_SURFACE_CALL_TEST_ONLY_H
+#define GRPC_CORE_LIB_SURFACE_CALL_TEST_ONLY_H
#include <grpc/grpc.h>
@@ -61,4 +61,4 @@ uint32_t grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call *call);
}
#endif
-#endif /* GRPC_CORE_SURFACE_CALL_TEST_ONLY_H */
+#endif /* GRPC_CORE_LIB_SURFACE_CALL_TEST_ONLY_H */
diff --git a/src/core/surface/channel.c b/src/core/lib/surface/channel.c
index 964ab34431..d815daa70c 100644
--- a/src/core/surface/channel.c
+++ b/src/core/lib/surface/channel.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/surface/channel.h"
+#include "src/core/lib/surface/channel.h"
#include <stdlib.h>
#include <string.h>
@@ -40,14 +40,14 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-#include "src/core/surface/channel_init.h"
-#include "src/core/client_config/resolver_registry.h"
-#include "src/core/iomgr/iomgr.h"
-#include "src/core/support/string.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/call.h"
-#include "src/core/surface/init.h"
-#include "src/core/transport/static_metadata.h"
+#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/lib/iomgr/iomgr.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/call.h"
+#include "src/core/lib/surface/channel_init.h"
+#include "src/core/lib/surface/init.h"
+#include "src/core/lib/transport/static_metadata.h"
/** Cache grpc-status: X mdelems for X = 0..NUM_CACHED_STATUS_ELEMS.
* Avoids needing to take a metadata context lock for sending status
diff --git a/src/core/surface/channel.h b/src/core/lib/surface/channel.h
index c08988d9e7..09de0fccc9 100644
--- a/src/core/surface/channel.h
+++ b/src/core/lib/surface/channel.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_SURFACE_CHANNEL_H
-#define GRPC_CORE_SURFACE_CHANNEL_H
+#ifndef GRPC_CORE_LIB_SURFACE_CHANNEL_H
+#define GRPC_CORE_LIB_SURFACE_CHANNEL_H
-#include "src/core/channel/channel_stack.h"
-#include "src/core/surface/channel_stack_type.h"
-#include "src/core/client_config/subchannel_factory.h"
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/client_config/subchannel_factory.h"
+#include "src/core/lib/surface/channel_stack_type.h"
grpc_channel *grpc_channel_create(grpc_exec_ctx *exec_ctx, const char *target,
const grpc_channel_args *args,
@@ -72,4 +72,4 @@ void grpc_channel_internal_unref(grpc_exec_ctx *exec_ctx,
grpc_channel_internal_unref(exec_ctx, channel)
#endif
-#endif /* GRPC_CORE_SURFACE_CHANNEL_H */
+#endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_H */
diff --git a/src/core/surface/channel_connectivity.c b/src/core/lib/surface/channel_connectivity.c
index 2dd4fce26b..2f5d763e70 100644
--- a/src/core/surface/channel_connectivity.c
+++ b/src/core/lib/surface/channel_connectivity.c
@@ -31,16 +31,15 @@
*
*/
-#include "src/core/surface/channel.h"
+#include "src/core/lib/surface/channel.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/channel/client_channel.h"
-#include "src/core/channel/client_uchannel.h"
-#include "src/core/iomgr/timer.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/completion_queue.h"
+#include "src/core/lib/channel/client_channel.h"
+#include "src/core/lib/iomgr/timer.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/completion_queue.h"
grpc_connectivity_state grpc_channel_check_connectivity_state(
grpc_channel *channel, int try_to_connect) {
@@ -58,12 +57,6 @@ grpc_connectivity_state grpc_channel_check_connectivity_state(
grpc_exec_ctx_finish(&exec_ctx);
return state;
}
- if (client_channel_elem->filter == &grpc_client_uchannel_filter) {
- state = grpc_client_uchannel_check_connectivity_state(
- &exec_ctx, client_channel_elem, try_to_connect);
- grpc_exec_ctx_finish(&exec_ctx);
- return state;
- }
gpr_log(GPR_ERROR,
"grpc_channel_check_connectivity_state called on something that is "
"not a (u)client channel, but '%s'",
@@ -98,9 +91,6 @@ static void delete_state_watcher(grpc_exec_ctx *exec_ctx, state_watcher *w) {
if (client_channel_elem->filter == &grpc_client_channel_filter) {
GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, w->channel,
"watch_channel_connectivity");
- } else if (client_channel_elem->filter == &grpc_client_uchannel_filter) {
- GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, w->channel,
- "watch_uchannel_connectivity");
} else {
abort();
}
@@ -209,11 +199,8 @@ void grpc_channel_watch_connectivity_state(
grpc_client_channel_watch_connectivity_state(&exec_ctx, client_channel_elem,
grpc_cq_pollset(cq), &w->state,
&w->on_complete);
- } else if (client_channel_elem->filter == &grpc_client_uchannel_filter) {
- GRPC_CHANNEL_INTERNAL_REF(channel, "watch_uchannel_connectivity");
- grpc_client_uchannel_watch_connectivity_state(
- &exec_ctx, client_channel_elem, grpc_cq_pollset(cq), &w->state,
- &w->on_complete);
+ } else {
+ abort();
}
grpc_exec_ctx_finish(&exec_ctx);
diff --git a/src/core/surface/channel_create.c b/src/core/lib/surface/channel_create.c
index 123447c8ed..e8777ce816 100644
--- a/src/core/surface/channel_create.c
+++ b/src/core/lib/surface/channel_create.c
@@ -40,16 +40,16 @@
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
-#include "src/core/census/grpc_filter.h"
-#include "src/core/channel/channel_args.h"
-#include "src/core/channel/client_channel.h"
-#include "src/core/channel/compress_filter.h"
-#include "src/core/channel/http_client_filter.h"
-#include "src/core/client_config/resolver_registry.h"
-#include "src/core/iomgr/tcp_client.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/channel.h"
-#include "src/core/transport/chttp2_transport.h"
+#include "src/core/lib/census/grpc_filter.h"
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/channel/client_channel.h"
+#include "src/core/lib/channel/compress_filter.h"
+#include "src/core/lib/channel/http_client_filter.h"
+#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/lib/iomgr/tcp_client.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/channel.h"
+#include "src/core/lib/transport/chttp2_transport.h"
typedef struct {
grpc_connector base;
diff --git a/src/core/surface/channel_init.c b/src/core/lib/surface/channel_init.c
index 538be84696..fc69f61f77 100644
--- a/src/core/surface/channel_init.c
+++ b/src/core/lib/surface/channel_init.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/surface/channel_init.h"
+#include "src/core/lib/surface/channel_init.h"
#include <grpc/support/alloc.h>
#include <grpc/support/useful.h>
@@ -112,8 +112,6 @@ static const char *name_for_type(grpc_channel_stack_type type) {
return "CLIENT_SUBCHANNEL";
case GRPC_SERVER_CHANNEL:
return "SERVER_CHANNEL";
- case GRPC_CLIENT_UCHANNEL:
- return "CLIENT_UCHANNEL";
case GRPC_CLIENT_LAME_CHANNEL:
return "CLIENT_LAME_CHANNEL";
case GRPC_CLIENT_DIRECT_CHANNEL:
diff --git a/src/core/surface/channel_init.h b/src/core/lib/surface/channel_init.h
index 06faef6ddb..a4d8271ca6 100644
--- a/src/core/surface/channel_init.h
+++ b/src/core/lib/surface/channel_init.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_SURFACE_CHANNEL_INIT_H
-#define GRPC_CORE_SURFACE_CHANNEL_INIT_H
+#ifndef GRPC_CORE_LIB_SURFACE_CHANNEL_INIT_H
+#define GRPC_CORE_LIB_SURFACE_CHANNEL_INIT_H
-#include "src/core/channel/channel_stack_builder.h"
-#include "src/core/surface/channel_stack_type.h"
-#include "src/core/transport/transport.h"
+#include "src/core/lib/channel/channel_stack_builder.h"
+#include "src/core/lib/surface/channel_stack_type.h"
+#include "src/core/lib/transport/transport.h"
/// This module provides a way for plugins (and the grpc core library itself)
/// to register mutators for channel stacks.
@@ -83,4 +83,4 @@ void *grpc_channel_init_create_stack(
const grpc_channel_args *args, int initial_refs, grpc_iomgr_cb_func destroy,
void *destroy_arg, grpc_transport *optional_transport);
-#endif /* GRPC_CORE_SURFACE_CHANNEL_INIT_H */
+#endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_INIT_H */
diff --git a/src/core/surface/channel_ping.c b/src/core/lib/surface/channel_ping.c
index 983f1c8a66..dd862cdadd 100644
--- a/src/core/surface/channel_ping.c
+++ b/src/core/lib/surface/channel_ping.c
@@ -31,15 +31,15 @@
*
*/
-#include "src/core/surface/channel.h"
+#include "src/core/lib/surface/channel.h"
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/completion_queue.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/completion_queue.h"
typedef struct {
grpc_closure closure;
diff --git a/src/core/surface/channel_stack_type.c b/src/core/lib/surface/channel_stack_type.c
index 6fd33d411d..c35d603ca3 100644
--- a/src/core/surface/channel_stack_type.c
+++ b/src/core/lib/surface/channel_stack_type.c
@@ -31,16 +31,14 @@
*
*/
-#include <grpc/support/port_platform.h>
-#include "src/core/surface/channel_stack_type.h"
+#include "src/core/lib/surface/channel_stack_type.h"
#include <grpc/support/log.h>
+#include <grpc/support/port_platform.h>
bool grpc_channel_stack_type_is_client(grpc_channel_stack_type type) {
switch (type) {
case GRPC_CLIENT_CHANNEL:
return true;
- case GRPC_CLIENT_UCHANNEL:
- return true;
case GRPC_CLIENT_SUBCHANNEL:
return true;
case GRPC_CLIENT_LAME_CHANNEL:
diff --git a/src/core/surface/channel_stack_type.h b/src/core/lib/surface/channel_stack_type.h
index 846391a68a..16608fa386 100644
--- a/src/core/surface/channel_stack_type.h
+++ b/src/core/lib/surface/channel_stack_type.h
@@ -31,17 +31,14 @@
*
*/
-#ifndef GRPC_CORE_SURFACE_CHANNEL_STACK_TYPE_H
-#define GRPC_CORE_SURFACE_CHANNEL_STACK_TYPE_H
+#ifndef GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H
+#define GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H
#include <stdbool.h>
typedef enum {
// normal top-half client channel with load-balancing, connection management
GRPC_CLIENT_CHANNEL,
- // abbreviated top-half client channel bound to one subchannel - for internal
- // load balancing implementation
- GRPC_CLIENT_UCHANNEL,
// bottom-half of a client channel: everything that happens post-load
// balancing (bound to a specific transport)
GRPC_CLIENT_SUBCHANNEL,
@@ -58,4 +55,4 @@ typedef enum {
bool grpc_channel_stack_type_is_client(grpc_channel_stack_type type);
-#endif /* GRPC_CORE_SURFACE_CHANNEL_STACK_TYPE_H */
+#endif /* GRPC_CORE_LIB_SURFACE_CHANNEL_STACK_TYPE_H */
diff --git a/src/core/surface/completion_queue.c b/src/core/lib/surface/completion_queue.c
index b22818ea87..a0d7002053 100644
--- a/src/core/surface/completion_queue.c
+++ b/src/core/lib/surface/completion_queue.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/surface/completion_queue.h"
+#include "src/core/lib/surface/completion_queue.h"
#include <stdio.h>
#include <string.h>
@@ -41,14 +41,14 @@
#include <grpc/support/log.h>
#include <grpc/support/time.h>
-#include "src/core/iomgr/pollset.h"
-#include "src/core/iomgr/timer.h"
-#include "src/core/profiling/timers.h"
-#include "src/core/support/string.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/call.h"
-#include "src/core/surface/event_string.h"
-#include "src/core/surface/surface_trace.h"
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/iomgr/timer.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/call.h"
+#include "src/core/lib/surface/event_string.h"
+#include "src/core/lib/surface/surface_trace.h"
typedef struct {
grpc_pollset_worker **worker;
diff --git a/src/core/surface/completion_queue.h b/src/core/lib/surface/completion_queue.h
index 07f6d0c8f6..35591cb6f4 100644
--- a/src/core/surface/completion_queue.h
+++ b/src/core/lib/surface/completion_queue.h
@@ -31,13 +31,13 @@
*
*/
-#ifndef GRPC_CORE_SURFACE_COMPLETION_QUEUE_H
-#define GRPC_CORE_SURFACE_COMPLETION_QUEUE_H
+#ifndef GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H
+#define GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H
/* Internal API for completion queues */
-#include "src/core/iomgr/pollset.h"
#include <grpc/grpc.h>
+#include "src/core/lib/iomgr/pollset.h"
typedef struct grpc_cq_completion {
/** user supplied tag */
@@ -88,4 +88,4 @@ int grpc_cq_is_server_cq(grpc_completion_queue *cc);
void grpc_cq_global_init(void);
void grpc_cq_global_shutdown(void);
-#endif /* GRPC_CORE_SURFACE_COMPLETION_QUEUE_H */
+#endif /* GRPC_CORE_LIB_SURFACE_COMPLETION_QUEUE_H */
diff --git a/src/core/surface/event_string.c b/src/core/lib/surface/event_string.c
index 33cd4a43aa..360c718a17 100644
--- a/src/core/surface/event_string.c
+++ b/src/core/lib/surface/event_string.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,13 +31,13 @@
*
*/
-#include "src/core/surface/event_string.h"
+#include "src/core/lib/surface/event_string.h"
#include <stdio.h>
-#include "src/core/support/string.h"
#include <grpc/byte_buffer.h>
#include <grpc/support/string_util.h>
+#include "src/core/lib/support/string.h"
static void addhdr(gpr_strvec *buf, grpc_event *ev) {
char *tmp;
diff --git a/src/core/surface/event_string.h b/src/core/lib/surface/event_string.h
index d0598cecca..577e9c718f 100644
--- a/src/core/surface/event_string.h
+++ b/src/core/lib/surface/event_string.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_SURFACE_EVENT_STRING_H
-#define GRPC_CORE_SURFACE_EVENT_STRING_H
+#ifndef GRPC_CORE_LIB_SURFACE_EVENT_STRING_H
+#define GRPC_CORE_LIB_SURFACE_EVENT_STRING_H
#include <grpc/grpc.h>
/* Returns a string describing an event. Must be later freed with gpr_free() */
char *grpc_event_string(grpc_event *ev);
-#endif /* GRPC_CORE_SURFACE_EVENT_STRING_H */
+#endif /* GRPC_CORE_LIB_SURFACE_EVENT_STRING_H */
diff --git a/src/core/surface/init.c b/src/core/lib/surface/init.c
index b50770959f..dcb9c62d36 100644
--- a/src/core/surface/init.c
+++ b/src/core/lib/surface/init.c
@@ -40,37 +40,36 @@
#include <grpc/support/alloc.h>
#include <grpc/support/time.h>
/* TODO(ctiller): find another way? - better not to include census here */
-#include "src/core/census/grpc_plugin.h"
-#include "src/core/channel/channel_stack.h"
-#include "src/core/channel/compress_filter.h"
-#include "src/core/channel/connected_channel.h"
-#include "src/core/channel/client_channel.h"
-#include "src/core/channel/client_uchannel.h"
-#include "src/core/channel/http_client_filter.h"
-#include "src/core/channel/http_server_filter.h"
-#include "src/core/client_config/lb_policy_registry.h"
-#include "src/core/client_config/lb_policies/pick_first.h"
-#include "src/core/client_config/lb_policies/round_robin.h"
-#include "src/core/client_config/resolver_registry.h"
-#include "src/core/client_config/resolvers/dns_resolver.h"
-#include "src/core/client_config/resolvers/sockaddr_resolver.h"
-#include "src/core/client_config/subchannel.h"
-#include "src/core/client_config/subchannel_index.h"
-#include "src/core/debug/trace.h"
-#include "src/core/iomgr/executor.h"
-#include "src/core/iomgr/iomgr.h"
-#include "src/core/profiling/timers.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/call.h"
-#include "src/core/surface/channel_init.h"
-#include "src/core/surface/completion_queue.h"
-#include "src/core/surface/init.h"
-#include "src/core/surface/lame_client.h"
-#include "src/core/surface/server.h"
-#include "src/core/surface/surface_trace.h"
-#include "src/core/transport/chttp2_transport.h"
-#include "src/core/transport/connectivity_state.h"
-#include "src/core/transport/transport_impl.h"
+#include "src/core/lib/census/grpc_plugin.h"
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/channel/client_channel.h"
+#include "src/core/lib/channel/compress_filter.h"
+#include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/channel/http_client_filter.h"
+#include "src/core/lib/channel/http_server_filter.h"
+#include "src/core/lib/client_config/lb_policies/pick_first.h"
+#include "src/core/lib/client_config/lb_policies/round_robin.h"
+#include "src/core/lib/client_config/lb_policy_registry.h"
+#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/lib/client_config/resolvers/dns_resolver.h"
+#include "src/core/lib/client_config/resolvers/sockaddr_resolver.h"
+#include "src/core/lib/client_config/subchannel.h"
+#include "src/core/lib/client_config/subchannel_index.h"
+#include "src/core/lib/debug/trace.h"
+#include "src/core/lib/iomgr/executor.h"
+#include "src/core/lib/iomgr/iomgr.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/call.h"
+#include "src/core/lib/surface/channel_init.h"
+#include "src/core/lib/surface/completion_queue.h"
+#include "src/core/lib/surface/init.h"
+#include "src/core/lib/surface/lame_client.h"
+#include "src/core/lib/surface/server.h"
+#include "src/core/lib/surface/surface_trace.h"
+#include "src/core/lib/transport/chttp2_transport.h"
+#include "src/core/lib/transport/connectivity_state.h"
+#include "src/core/lib/transport/transport_impl.h"
#ifndef GRPC_DEFAULT_NAME_PREFIX
#define GRPC_DEFAULT_NAME_PREFIX "dns:///"
@@ -90,18 +89,21 @@ static void do_basic_init(void) {
}
static bool append_filter(grpc_channel_stack_builder *builder, void *arg) {
- return grpc_channel_stack_builder_append_filter(builder, arg, NULL, NULL);
+ return grpc_channel_stack_builder_append_filter(
+ builder, (const grpc_channel_filter *)arg, NULL, NULL);
}
static bool prepend_filter(grpc_channel_stack_builder *builder, void *arg) {
- return grpc_channel_stack_builder_prepend_filter(builder, arg, NULL, NULL);
+ return grpc_channel_stack_builder_prepend_filter(
+ builder, (const grpc_channel_filter *)arg, NULL, NULL);
}
static bool maybe_add_http_filter(grpc_channel_stack_builder *builder,
void *arg) {
grpc_transport *t = grpc_channel_stack_builder_get_transport(builder);
if (t && strstr(t->vtable->name, "http")) {
- return grpc_channel_stack_builder_prepend_filter(builder, arg, NULL, NULL);
+ return grpc_channel_stack_builder_prepend_filter(
+ builder, (const grpc_channel_filter *)arg, NULL, NULL);
}
return true;
}
@@ -112,9 +114,6 @@ static void register_builtin_channel_init() {
grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX,
prepend_filter,
(void *)&grpc_compress_filter);
- grpc_channel_init_register_stage(GRPC_CLIENT_UCHANNEL, INT_MAX,
- prepend_filter,
- (void *)&grpc_compress_filter);
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX, prepend_filter,
(void *)&grpc_compress_filter);
grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX,
@@ -134,8 +133,6 @@ static void register_builtin_channel_init() {
grpc_add_connected_filter, NULL);
grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX, append_filter,
(void *)&grpc_client_channel_filter);
- grpc_channel_init_register_stage(GRPC_CLIENT_UCHANNEL, INT_MAX, append_filter,
- (void *)&grpc_client_uchannel_filter);
grpc_channel_init_register_stage(GRPC_CLIENT_LAME_CHANNEL, INT_MAX,
append_filter, (void *)&grpc_lame_filter);
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX, prepend_filter,
diff --git a/src/core/surface/init.h b/src/core/lib/surface/init.h
index 5e358c7022..10e2a5896e 100644
--- a/src/core/surface/init.h
+++ b/src/core/lib/surface/init.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_SURFACE_INIT_H
-#define GRPC_CORE_SURFACE_INIT_H
+#ifndef GRPC_CORE_LIB_SURFACE_INIT_H
+#define GRPC_CORE_LIB_SURFACE_INIT_H
void grpc_register_security_filters(void);
void grpc_security_pre_init(void);
int grpc_is_initialized(void);
-#endif /* GRPC_CORE_SURFACE_INIT_H */
+#endif /* GRPC_CORE_LIB_SURFACE_INIT_H */
diff --git a/src/core/surface/init_secure.c b/src/core/lib/surface/init_secure.c
index 311dda9864..d3c2f645a7 100644
--- a/src/core/surface/init_secure.c
+++ b/src/core/lib/surface/init_secure.c
@@ -31,18 +31,18 @@
*
*/
-#include "src/core/surface/init.h"
+#include "src/core/lib/surface/init.h"
#include <limits.h>
#include <string.h>
-#include "src/core/surface/channel_init.h"
-#include "src/core/debug/trace.h"
-#include "src/core/security/auth_filters.h"
-#include "src/core/security/credentials.h"
-#include "src/core/security/secure_endpoint.h"
-#include "src/core/security/security_connector.h"
-#include "src/core/tsi/transport_security_interface.h"
+#include "src/core/lib/debug/trace.h"
+#include "src/core/lib/security/auth_filters.h"
+#include "src/core/lib/security/credentials.h"
+#include "src/core/lib/security/secure_endpoint.h"
+#include "src/core/lib/security/security_connector.h"
+#include "src/core/lib/surface/channel_init.h"
+#include "src/core/lib/tsi/transport_security_interface.h"
void grpc_security_pre_init(void) {
grpc_register_tracer("secure_endpoint", &grpc_trace_secure_endpoint);
diff --git a/src/core/surface/init_unsecure.c b/src/core/lib/surface/init_unsecure.c
index 278fcc83ac..243c005d86 100644
--- a/src/core/surface/init_unsecure.c
+++ b/src/core/lib/surface/init_unsecure.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/surface/init.h"
+#include "src/core/lib/surface/init.h"
void grpc_security_pre_init(void) {}
diff --git a/src/core/surface/lame_client.c b/src/core/lib/surface/lame_client.c
index 58f89946d2..95ec4b06c3 100644
--- a/src/core/surface/lame_client.c
+++ b/src/core/lib/surface/lame_client.c
@@ -31,19 +31,19 @@
*
*/
-#include "src/core/surface/lame_client.h"
+#include "src/core/lib/surface/lame_client.h"
#include <grpc/grpc.h>
#include <string.h>
-#include "src/core/channel/channel_stack.h"
-#include "src/core/support/string.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/channel.h"
-#include "src/core/surface/call.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/call.h"
+#include "src/core/lib/surface/channel.h"
typedef struct {
grpc_linked_mdelem status;
@@ -118,10 +118,17 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
grpc_channel_element *elem) {}
const grpc_channel_filter grpc_lame_filter = {
- lame_start_transport_stream_op, lame_start_transport_op, sizeof(call_data),
- init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem,
- sizeof(channel_data), init_channel_elem, destroy_channel_elem,
- lame_get_peer, "lame-client",
+ lame_start_transport_stream_op,
+ lame_start_transport_op,
+ sizeof(call_data),
+ init_call_elem,
+ grpc_call_stack_ignore_set_pollset,
+ destroy_call_elem,
+ sizeof(channel_data),
+ init_channel_elem,
+ destroy_channel_elem,
+ lame_get_peer,
+ "lame-client",
};
#define CHANNEL_STACK_FROM_CHANNEL(c) ((grpc_channel_stack *)((c) + 1))
diff --git a/src/core/surface/lame_client.h b/src/core/lib/surface/lame_client.h
index 3f3abd2ffe..5f6ea34d4b 100644
--- a/src/core/surface/lame_client.h
+++ b/src/core/lib/surface/lame_client.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_SURFACE_LAME_CLIENT_H
-#define GRPC_CORE_SURFACE_LAME_CLIENT_H
+#ifndef GRPC_CORE_LIB_SURFACE_LAME_CLIENT_H
+#define GRPC_CORE_LIB_SURFACE_LAME_CLIENT_H
-#include "src/core/channel/channel_stack.h"
+#include "src/core/lib/channel/channel_stack.h"
extern const grpc_channel_filter grpc_lame_filter;
-#endif /* GRPC_CORE_SURFACE_LAME_CLIENT_H */
+#endif /* GRPC_CORE_LIB_SURFACE_LAME_CLIENT_H */
diff --git a/src/core/surface/metadata_array.c b/src/core/lib/surface/metadata_array.c
index 4c7bf17835..4436f2da87 100644
--- a/src/core/surface/metadata_array.c
+++ b/src/core/lib/surface/metadata_array.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -36,7 +36,7 @@
#include <string.h>
-#include "src/core/surface/api_trace.h"
+#include "src/core/lib/surface/api_trace.h"
void grpc_metadata_array_init(grpc_metadata_array* array) {
GRPC_API_TRACE("grpc_metadata_array_init(array=%p)", 1, (array));
diff --git a/src/core/surface/secure_channel_create.c b/src/core/lib/surface/secure_channel_create.c
index cc752227ee..dcb367023e 100644
--- a/src/core/surface/secure_channel_create.c
+++ b/src/core/lib/surface/secure_channel_create.c
@@ -40,17 +40,17 @@
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
-#include "src/core/channel/channel_args.h"
-#include "src/core/channel/client_channel.h"
-#include "src/core/client_config/resolver_registry.h"
-#include "src/core/iomgr/tcp_client.h"
-#include "src/core/security/auth_filters.h"
-#include "src/core/security/credentials.h"
-#include "src/core/security/security_context.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/channel.h"
-#include "src/core/transport/chttp2_transport.h"
-#include "src/core/tsi/transport_security_interface.h"
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/channel/client_channel.h"
+#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/lib/iomgr/tcp_client.h"
+#include "src/core/lib/security/auth_filters.h"
+#include "src/core/lib/security/credentials.h"
+#include "src/core/lib/security/security_context.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/channel.h"
+#include "src/core/lib/transport/chttp2_transport.h"
+#include "src/core/lib/tsi/transport_security_interface.h"
typedef struct {
grpc_connector base;
diff --git a/src/core/surface/server.c b/src/core/lib/surface/server.c
index d21cc30abf..55e5e49e11 100644
--- a/src/core/surface/server.c
+++ b/src/core/lib/surface/server.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/surface/server.h"
+#include "src/core/lib/surface/server.h"
#include <limits.h>
#include <stdlib.h>
@@ -42,18 +42,18 @@
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
-#include "src/core/channel/channel_args.h"
-#include "src/core/channel/connected_channel.h"
-#include "src/core/iomgr/iomgr.h"
-#include "src/core/support/stack_lockfree.h"
-#include "src/core/support/string.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/call.h"
-#include "src/core/surface/channel.h"
-#include "src/core/surface/completion_queue.h"
-#include "src/core/surface/init.h"
-#include "src/core/transport/metadata.h"
-#include "src/core/transport/static_metadata.h"
+#include "src/core/lib/channel/channel_args.h"
+#include "src/core/lib/channel/connected_channel.h"
+#include "src/core/lib/iomgr/iomgr.h"
+#include "src/core/lib/support/stack_lockfree.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/call.h"
+#include "src/core/lib/surface/channel.h"
+#include "src/core/lib/surface/completion_queue.h"
+#include "src/core/lib/surface/init.h"
+#include "src/core/lib/transport/metadata.h"
+#include "src/core/lib/transport/static_metadata.h"
typedef struct listener {
void *arg;
@@ -765,10 +765,17 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
}
const grpc_channel_filter grpc_server_top_filter = {
- server_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data),
- init_call_elem, grpc_call_stack_ignore_set_pollset, destroy_call_elem,
- sizeof(channel_data), init_channel_elem, destroy_channel_elem,
- grpc_call_next_get_peer, "server",
+ server_start_transport_stream_op,
+ grpc_channel_next_op,
+ sizeof(call_data),
+ init_call_elem,
+ grpc_call_stack_ignore_set_pollset,
+ destroy_call_elem,
+ sizeof(channel_data),
+ init_channel_elem,
+ destroy_channel_elem,
+ grpc_call_next_get_peer,
+ "server",
};
void grpc_server_register_completion_queue(grpc_server *server,
@@ -914,7 +921,8 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s,
channel =
grpc_channel_create(exec_ctx, NULL, args, GRPC_SERVER_CHANNEL, transport);
chand = (channel_data *)grpc_channel_stack_element(
- grpc_channel_get_channel_stack(channel), 0)->channel_data;
+ grpc_channel_get_channel_stack(channel), 0)
+ ->channel_data;
chand->server = s;
server_ref(s);
chand->channel = channel;
@@ -935,7 +943,7 @@ void grpc_server_setup_transport(grpc_exec_ctx *exec_ctx, grpc_server *s,
method = grpc_mdstr_from_string(rm->method);
hash = GRPC_MDSTR_KV_HASH(host ? host->hash : 0, method->hash);
for (probes = 0; chand->registered_methods[(hash + probes) % slots]
- .server_registered_method != NULL;
+ .server_registered_method != NULL;
probes++)
;
if (probes > max_probes) max_probes = probes;
diff --git a/src/core/surface/server.h b/src/core/lib/surface/server.h
index cd62eadd7f..3845eb2981 100644
--- a/src/core/surface/server.h
+++ b/src/core/lib/surface/server.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_SURFACE_SERVER_H
-#define GRPC_CORE_SURFACE_SERVER_H
+#ifndef GRPC_CORE_LIB_SURFACE_SERVER_H
+#define GRPC_CORE_LIB_SURFACE_SERVER_H
#include <grpc/grpc.h>
-#include "src/core/channel/channel_stack.h"
-#include "src/core/transport/transport.h"
+#include "src/core/lib/channel/channel_stack.h"
+#include "src/core/lib/transport/transport.h"
extern const grpc_channel_filter grpc_server_top_filter;
@@ -59,4 +59,4 @@ const grpc_channel_args *grpc_server_get_channel_args(grpc_server *server);
int grpc_server_has_open_connections(grpc_server *server);
-#endif /* GRPC_CORE_SURFACE_SERVER_H */
+#endif /* GRPC_CORE_LIB_SURFACE_SERVER_H */
diff --git a/src/core/surface/server_chttp2.c b/src/core/lib/surface/server_chttp2.c
index ff2840f655..f0c2ee5153 100644
--- a/src/core/surface/server_chttp2.c
+++ b/src/core/lib/surface/server_chttp2.c
@@ -33,15 +33,15 @@
#include <grpc/grpc.h>
-#include "src/core/channel/http_server_filter.h"
-#include "src/core/iomgr/resolve_address.h"
-#include "src/core/iomgr/tcp_server.h"
-#include "src/core/surface/api_trace.h"
-#include "src/core/surface/server.h"
-#include "src/core/transport/chttp2_transport.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
+#include "src/core/lib/channel/http_server_filter.h"
+#include "src/core/lib/iomgr/resolve_address.h"
+#include "src/core/lib/iomgr/tcp_server.h"
+#include "src/core/lib/surface/api_trace.h"
+#include "src/core/lib/surface/server.h"
+#include "src/core/lib/transport/chttp2_transport.h"
static void setup_transport(grpc_exec_ctx *exec_ctx, void *server,
grpc_transport *transport) {
diff --git a/src/core/surface/surface_trace.h b/src/core/lib/surface/surface_trace.h
index ed820ebd05..6b3f673924 100644
--- a/src/core/surface/surface_trace.h
+++ b/src/core/lib/surface/surface_trace.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_SURFACE_SURFACE_TRACE_H
-#define GRPC_CORE_SURFACE_SURFACE_TRACE_H
+#ifndef GRPC_CORE_LIB_SURFACE_SURFACE_TRACE_H
+#define GRPC_CORE_LIB_SURFACE_SURFACE_TRACE_H
-#include "src/core/debug/trace.h"
-#include "src/core/surface/api_trace.h"
#include <grpc/support/log.h>
+#include "src/core/lib/debug/trace.h"
+#include "src/core/lib/surface/api_trace.h"
#define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \
if (grpc_api_trace) { \
@@ -45,4 +45,4 @@
gpr_free(_ev); \
}
-#endif /* GRPC_CORE_SURFACE_SURFACE_TRACE_H */
+#endif /* GRPC_CORE_LIB_SURFACE_SURFACE_TRACE_H */
diff --git a/src/core/surface/validate_metadata.c b/src/core/lib/surface/validate_metadata.c
index bf4126867f..bf4126867f 100644
--- a/src/core/surface/validate_metadata.c
+++ b/src/core/lib/surface/validate_metadata.c
diff --git a/src/core/surface/version.c b/src/core/lib/surface/version.c
index 7723f39401..7723f39401 100644
--- a/src/core/surface/version.c
+++ b/src/core/lib/surface/version.c
diff --git a/src/core/transport/byte_stream.c b/src/core/lib/transport/byte_stream.c
index 8e6fb2cbef..79981aa154 100644
--- a/src/core/transport/byte_stream.c
+++ b/src/core/lib/transport/byte_stream.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/transport/byte_stream.h"
+#include "src/core/lib/transport/byte_stream.h"
#include <stdlib.h>
diff --git a/src/core/transport/byte_stream.h b/src/core/lib/transport/byte_stream.h
index b8d0ade2b5..e7346dafc3 100644
--- a/src/core/transport/byte_stream.h
+++ b/src/core/lib/transport/byte_stream.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_BYTE_STREAM_H
-#define GRPC_CORE_TRANSPORT_BYTE_STREAM_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H
+#define GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H
-#include "src/core/iomgr/exec_ctx.h"
#include <grpc/support/slice_buffer.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
/** Internal bit flag for grpc_begin_message's \a flags signaling the use of
* compression for the message */
@@ -86,4 +86,4 @@ void grpc_slice_buffer_stream_init(grpc_slice_buffer_stream *stream,
gpr_slice_buffer *slice_buffer,
uint32_t flags);
-#endif /* GRPC_CORE_TRANSPORT_BYTE_STREAM_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H */
diff --git a/src/core/transport/chttp2/alpn.c b/src/core/lib/transport/chttp2/alpn.c
index 69da4e6718..befe319180 100644
--- a/src/core/transport/chttp2/alpn.c
+++ b/src/core/lib/transport/chttp2/alpn.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/transport/chttp2/alpn.h"
+#include "src/core/lib/transport/chttp2/alpn.h"
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
diff --git a/src/core/transport/chttp2/alpn.h b/src/core/lib/transport/chttp2/alpn.h
index 68010e3155..a9184e63a4 100644
--- a/src/core/transport/chttp2/alpn.h
+++ b/src/core/lib/transport/chttp2/alpn.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_ALPN_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_ALPN_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_ALPN_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_ALPN_H
#include <string.h>
@@ -46,4 +46,4 @@ size_t grpc_chttp2_num_alpn_versions(void);
* grpc_chttp2_num_alpn_versions()) */
const char *grpc_chttp2_get_alpn_version_index(size_t i);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_ALPN_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_ALPN_H */
diff --git a/src/core/transport/chttp2/bin_encoder.c b/src/core/lib/transport/chttp2/bin_encoder.c
index f26bc7e29b..79d0aa3d6f 100644
--- a/src/core/transport/chttp2/bin_encoder.c
+++ b/src/core/lib/transport/chttp2/bin_encoder.c
@@ -31,12 +31,12 @@
*
*/
-#include "src/core/transport/chttp2/bin_encoder.h"
+#include "src/core/lib/transport/chttp2/bin_encoder.h"
#include <string.h>
-#include "src/core/transport/chttp2/huffsyms.h"
#include <grpc/support/log.h>
+#include "src/core/lib/transport/chttp2/huffsyms.h"
static const char alphabet[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
@@ -46,70 +46,18 @@ typedef struct {
uint8_t length;
} b64_huff_sym;
-static const b64_huff_sym huff_alphabet[64] = {{0x21, 6},
- {0x5d, 7},
- {0x5e, 7},
- {0x5f, 7},
- {0x60, 7},
- {0x61, 7},
- {0x62, 7},
- {0x63, 7},
- {0x64, 7},
- {0x65, 7},
- {0x66, 7},
- {0x67, 7},
- {0x68, 7},
- {0x69, 7},
- {0x6a, 7},
- {0x6b, 7},
- {0x6c, 7},
- {0x6d, 7},
- {0x6e, 7},
- {0x6f, 7},
- {0x70, 7},
- {0x71, 7},
- {0x72, 7},
- {0xfc, 8},
- {0x73, 7},
- {0xfd, 8},
- {0x3, 5},
- {0x23, 6},
- {0x4, 5},
- {0x24, 6},
- {0x5, 5},
- {0x25, 6},
- {0x26, 6},
- {0x27, 6},
- {0x6, 5},
- {0x74, 7},
- {0x75, 7},
- {0x28, 6},
- {0x29, 6},
- {0x2a, 6},
- {0x7, 5},
- {0x2b, 6},
- {0x76, 7},
- {0x2c, 6},
- {0x8, 5},
- {0x9, 5},
- {0x2d, 6},
- {0x77, 7},
- {0x78, 7},
- {0x79, 7},
- {0x7a, 7},
- {0x7b, 7},
- {0x0, 5},
- {0x1, 5},
- {0x2, 5},
- {0x19, 6},
- {0x1a, 6},
- {0x1b, 6},
- {0x1c, 6},
- {0x1d, 6},
- {0x1e, 6},
- {0x1f, 6},
- {0x7fb, 11},
- {0x18, 6}};
+static const b64_huff_sym huff_alphabet[64] = {
+ {0x21, 6}, {0x5d, 7}, {0x5e, 7}, {0x5f, 7}, {0x60, 7}, {0x61, 7},
+ {0x62, 7}, {0x63, 7}, {0x64, 7}, {0x65, 7}, {0x66, 7}, {0x67, 7},
+ {0x68, 7}, {0x69, 7}, {0x6a, 7}, {0x6b, 7}, {0x6c, 7}, {0x6d, 7},
+ {0x6e, 7}, {0x6f, 7}, {0x70, 7}, {0x71, 7}, {0x72, 7}, {0xfc, 8},
+ {0x73, 7}, {0xfd, 8}, {0x3, 5}, {0x23, 6}, {0x4, 5}, {0x24, 6},
+ {0x5, 5}, {0x25, 6}, {0x26, 6}, {0x27, 6}, {0x6, 5}, {0x74, 7},
+ {0x75, 7}, {0x28, 6}, {0x29, 6}, {0x2a, 6}, {0x7, 5}, {0x2b, 6},
+ {0x76, 7}, {0x2c, 6}, {0x8, 5}, {0x9, 5}, {0x2d, 6}, {0x77, 7},
+ {0x78, 7}, {0x79, 7}, {0x7a, 7}, {0x7b, 7}, {0x0, 5}, {0x1, 5},
+ {0x2, 5}, {0x19, 6}, {0x1a, 6}, {0x1b, 6}, {0x1c, 6}, {0x1d, 6},
+ {0x1e, 6}, {0x1f, 6}, {0x7fb, 11}, {0x18, 6}};
static const uint8_t tail_xtra[3] = {0, 2, 3};
diff --git a/src/core/transport/chttp2/bin_encoder.h b/src/core/lib/transport/chttp2/bin_encoder.h
index edb6f2dad1..1c5cd1e1c6 100644
--- a/src/core/transport/chttp2/bin_encoder.h
+++ b/src/core/lib/transport/chttp2/bin_encoder.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_BIN_ENCODER_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_BIN_ENCODER_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_BIN_ENCODER_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_BIN_ENCODER_H
#include <grpc/support/slice.h>
@@ -51,4 +51,4 @@ gpr_slice grpc_chttp2_huffman_compress(gpr_slice input);
return y; */
gpr_slice grpc_chttp2_base64_encode_and_huffman_compress(gpr_slice input);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_BIN_ENCODER_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_BIN_ENCODER_H */
diff --git a/src/core/transport/chttp2/frame.h b/src/core/lib/transport/chttp2/frame.h
index 560a6675af..4674bc9703 100644
--- a/src/core/transport/chttp2/frame.h
+++ b/src/core/lib/transport/chttp2/frame.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_FRAME_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_FRAME_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_H
#include <grpc/support/port_platform.h>
#include <grpc/support/slice.h>
@@ -66,4 +66,4 @@ typedef struct grpc_chttp2_transport_parsing grpc_chttp2_transport_parsing;
#define GRPC_CHTTP2_DATA_FLAG_PADDED 8
#define GRPC_CHTTP2_FLAG_HAS_PRIORITY 0x20
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_FRAME_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_H */
diff --git a/src/core/transport/chttp2/frame_data.c b/src/core/lib/transport/chttp2/frame_data.c
index f9a1af8873..cf25c3ccc1 100644
--- a/src/core/transport/chttp2/frame_data.c
+++ b/src/core/lib/transport/chttp2/frame_data.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,16 +31,16 @@
*
*/
-#include "src/core/transport/chttp2/frame_data.h"
+#include "src/core/lib/transport/chttp2/frame_data.h"
#include <string.h>
-#include "src/core/transport/chttp2/internal.h"
-#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
-#include "src/core/transport/transport.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/transport/chttp2/internal.h"
+#include "src/core/lib/transport/transport.h"
grpc_chttp2_parse_error grpc_chttp2_data_parser_init(
grpc_chttp2_data_parser *parser) {
diff --git a/src/core/transport/chttp2/frame_data.h b/src/core/lib/transport/chttp2/frame_data.h
index 92929d5c97..da404a42c6 100644
--- a/src/core/transport/chttp2/frame_data.h
+++ b/src/core/lib/transport/chttp2/frame_data.h
@@ -31,16 +31,16 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_FRAME_DATA_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_FRAME_DATA_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_DATA_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_DATA_H
/* Parser for GRPC streams embedded in DATA frames */
-#include "src/core/iomgr/exec_ctx.h"
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
-#include "src/core/transport/byte_stream.h"
-#include "src/core/transport/chttp2/frame.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/transport/byte_stream.h"
+#include "src/core/lib/transport/chttp2/frame.h"
typedef enum {
GRPC_CHTTP2_DATA_FH_0,
@@ -98,4 +98,4 @@ void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf,
uint32_t write_bytes, int is_eof,
gpr_slice_buffer *outbuf);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_FRAME_DATA_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_DATA_H */
diff --git a/src/core/transport/chttp2/frame_goaway.c b/src/core/lib/transport/chttp2/frame_goaway.c
index 2fa525e989..bb8c28df90 100644
--- a/src/core/transport/chttp2/frame_goaway.c
+++ b/src/core/lib/transport/chttp2/frame_goaway.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,8 +31,8 @@
*
*/
-#include "src/core/transport/chttp2/frame_goaway.h"
-#include "src/core/transport/chttp2/internal.h"
+#include "src/core/lib/transport/chttp2/frame_goaway.h"
+#include "src/core/lib/transport/chttp2/internal.h"
#include <string.h>
diff --git a/src/core/transport/chttp2/frame_goaway.h b/src/core/lib/transport/chttp2/frame_goaway.h
index 616287e9ee..f64c44f3d9 100644
--- a/src/core/transport/chttp2/frame_goaway.h
+++ b/src/core/lib/transport/chttp2/frame_goaway.h
@@ -31,14 +31,14 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_FRAME_GOAWAY_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_FRAME_GOAWAY_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_GOAWAY_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_GOAWAY_H
-#include "src/core/iomgr/exec_ctx.h"
-#include "src/core/transport/chttp2/frame.h"
#include <grpc/support/port_platform.h>
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/transport/chttp2/frame.h"
typedef enum {
GRPC_CHTTP2_GOAWAY_LSI0,
@@ -74,4 +74,4 @@ void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code,
gpr_slice debug_data,
gpr_slice_buffer *slice_buffer);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_FRAME_GOAWAY_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_GOAWAY_H */
diff --git a/src/core/transport/chttp2/frame_ping.c b/src/core/lib/transport/chttp2/frame_ping.c
index c6ab522283..14ca394264 100644
--- a/src/core/transport/chttp2/frame_ping.c
+++ b/src/core/lib/transport/chttp2/frame_ping.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,8 +31,8 @@
*
*/
-#include "src/core/transport/chttp2/frame_ping.h"
-#include "src/core/transport/chttp2/internal.h"
+#include "src/core/lib/transport/chttp2/frame_ping.h"
+#include "src/core/lib/transport/chttp2/internal.h"
#include <string.h>
diff --git a/src/core/transport/chttp2/frame_ping.h b/src/core/lib/transport/chttp2/frame_ping.h
index fc4dd7ac58..7640fc4773 100644
--- a/src/core/transport/chttp2/frame_ping.h
+++ b/src/core/lib/transport/chttp2/frame_ping.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_FRAME_PING_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_FRAME_PING_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_PING_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_PING_H
-#include "src/core/iomgr/exec_ctx.h"
#include <grpc/support/slice.h>
-#include "src/core/transport/chttp2/frame.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/transport/chttp2/frame.h"
typedef struct {
uint8_t byte;
@@ -53,4 +53,4 @@ grpc_chttp2_parse_error grpc_chttp2_ping_parser_parse(
grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_FRAME_PING_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_PING_H */
diff --git a/src/core/transport/chttp2/frame_rst_stream.c b/src/core/lib/transport/chttp2/frame_rst_stream.c
index 754529e4b9..060912afc4 100644
--- a/src/core/transport/chttp2/frame_rst_stream.c
+++ b/src/core/lib/transport/chttp2/frame_rst_stream.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,12 +31,12 @@
*
*/
-#include "src/core/transport/chttp2/frame_rst_stream.h"
-#include "src/core/transport/chttp2/internal.h"
+#include "src/core/lib/transport/chttp2/frame_rst_stream.h"
+#include "src/core/lib/transport/chttp2/internal.h"
#include <grpc/support/log.h>
-#include "src/core/transport/chttp2/frame.h"
+#include "src/core/lib/transport/chttp2/frame.h"
gpr_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code) {
gpr_slice slice = gpr_slice_malloc(13);
diff --git a/src/core/transport/chttp2/frame_rst_stream.h b/src/core/lib/transport/chttp2/frame_rst_stream.h
index d563a22e24..93155fde9d 100644
--- a/src/core/transport/chttp2/frame_rst_stream.h
+++ b/src/core/lib/transport/chttp2/frame_rst_stream.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H
#include <grpc/support/slice.h>
-#include "src/core/transport/chttp2/frame.h"
-#include "src/core/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/transport/chttp2/frame.h"
typedef struct {
uint8_t byte;
@@ -52,4 +52,4 @@ grpc_chttp2_parse_error grpc_chttp2_rst_stream_parser_parse(
grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_RST_STREAM_H */
diff --git a/src/core/transport/chttp2/frame_settings.c b/src/core/lib/transport/chttp2/frame_settings.c
index cc49dd4f69..48429c2a78 100644
--- a/src/core/transport/chttp2/frame_settings.c
+++ b/src/core/lib/transport/chttp2/frame_settings.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,18 +31,18 @@
*
*/
-#include "src/core/transport/chttp2/frame_settings.h"
-#include "src/core/transport/chttp2/internal.h"
+#include "src/core/lib/transport/chttp2/frame_settings.h"
+#include "src/core/lib/transport/chttp2/internal.h"
#include <string.h>
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
-#include "src/core/debug/trace.h"
-#include "src/core/transport/chttp2/frame.h"
-#include "src/core/transport/chttp2/http2_errors.h"
-#include "src/core/transport/chttp2_transport.h"
+#include "src/core/lib/debug/trace.h"
+#include "src/core/lib/transport/chttp2/frame.h"
+#include "src/core/lib/transport/chttp2/http2_errors.h"
+#include "src/core/lib/transport/chttp2_transport.h"
#define MAX_MAX_HEADER_LIST_SIZE (1024 * 1024 * 1024)
diff --git a/src/core/transport/chttp2/frame_settings.h b/src/core/lib/transport/chttp2/frame_settings.h
index e3c10d3cc5..8b294de021 100644
--- a/src/core/transport/chttp2/frame_settings.h
+++ b/src/core/lib/transport/chttp2/frame_settings.h
@@ -31,13 +31,13 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_FRAME_SETTINGS_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_FRAME_SETTINGS_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_SETTINGS_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_SETTINGS_H
#include <grpc/support/port_platform.h>
#include <grpc/support/slice.h>
-#include "src/core/transport/chttp2/frame.h"
-#include "src/core/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/transport/chttp2/frame.h"
typedef enum {
GRPC_CHTTP2_SPS_ID0,
@@ -100,4 +100,4 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_FRAME_SETTINGS_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_SETTINGS_H */
diff --git a/src/core/transport/chttp2/frame_window_update.c b/src/core/lib/transport/chttp2/frame_window_update.c
index 62d9bac117..2ab5003316 100644
--- a/src/core/transport/chttp2/frame_window_update.c
+++ b/src/core/lib/transport/chttp2/frame_window_update.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,8 +31,8 @@
*
*/
-#include "src/core/transport/chttp2/frame_window_update.h"
-#include "src/core/transport/chttp2/internal.h"
+#include "src/core/lib/transport/chttp2/frame_window_update.h"
+#include "src/core/lib/transport/chttp2/internal.h"
#include <grpc/support/log.h>
diff --git a/src/core/transport/chttp2/frame_window_update.h b/src/core/lib/transport/chttp2/frame_window_update.h
index 0b3712b091..4b1aea294d 100644
--- a/src/core/transport/chttp2/frame_window_update.h
+++ b/src/core/lib/transport/chttp2/frame_window_update.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H
-#include "src/core/iomgr/exec_ctx.h"
#include <grpc/support/slice.h>
-#include "src/core/transport/chttp2/frame.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/transport/chttp2/frame.h"
typedef struct {
uint8_t byte;
@@ -53,4 +53,4 @@ grpc_chttp2_parse_error grpc_chttp2_window_update_parser_parse(
grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_FRAME_WINDOW_UPDATE_H */
diff --git a/src/core/transport/chttp2/hpack_encoder.c b/src/core/lib/transport/chttp2/hpack_encoder.c
index f30f574d06..6b45929b04 100644
--- a/src/core/transport/chttp2/hpack_encoder.c
+++ b/src/core/lib/transport/chttp2/hpack_encoder.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/transport/chttp2/hpack_encoder.h"
+#include "src/core/lib/transport/chttp2/hpack_encoder.h"
#include <assert.h>
#include <string.h>
@@ -45,11 +45,11 @@
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
-#include "src/core/transport/chttp2/bin_encoder.h"
-#include "src/core/transport/chttp2/hpack_table.h"
-#include "src/core/transport/chttp2/timeout_encoding.h"
-#include "src/core/transport/chttp2/varint.h"
-#include "src/core/transport/static_metadata.h"
+#include "src/core/lib/transport/chttp2/bin_encoder.h"
+#include "src/core/lib/transport/chttp2/hpack_table.h"
+#include "src/core/lib/transport/chttp2/timeout_encoding.h"
+#include "src/core/lib/transport/chttp2/varint.h"
+#include "src/core/lib/transport/static_metadata.h"
#define HASH_FRAGMENT_1(x) ((x)&255)
#define HASH_FRAGMENT_2(x) ((x >> 8) & 255)
diff --git a/src/core/transport/chttp2/hpack_encoder.h b/src/core/lib/transport/chttp2/hpack_encoder.h
index 90aaf867c5..de46a8f146 100644
--- a/src/core/transport/chttp2/hpack_encoder.h
+++ b/src/core/lib/transport/chttp2/hpack_encoder.h
@@ -31,15 +31,15 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_HPACK_ENCODER_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_HPACK_ENCODER_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_HPACK_ENCODER_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_HPACK_ENCODER_H
-#include "src/core/transport/chttp2/frame.h"
-#include "src/core/transport/metadata.h"
-#include "src/core/transport/metadata_batch.h"
#include <grpc/support/port_platform.h>
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
+#include "src/core/lib/transport/chttp2/frame.h"
+#include "src/core/lib/transport/metadata.h"
+#include "src/core/lib/transport/metadata_batch.h"
#define GRPC_CHTTP2_HPACKC_NUM_FILTERS 256
#define GRPC_CHTTP2_HPACKC_NUM_VALUES 256
@@ -92,4 +92,4 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor *c, uint32_t id,
grpc_metadata_batch *metadata, int is_eof,
gpr_slice_buffer *outbuf);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_HPACK_ENCODER_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_HPACK_ENCODER_H */
diff --git a/src/core/transport/chttp2/hpack_parser.c b/src/core/lib/transport/chttp2/hpack_parser.c
index a63c7db1f6..d41ebab147 100644
--- a/src/core/transport/chttp2/hpack_parser.c
+++ b/src/core/lib/transport/chttp2/hpack_parser.c
@@ -31,12 +31,12 @@
*
*/
-#include "src/core/transport/chttp2/hpack_parser.h"
-#include "src/core/transport/chttp2/internal.h"
+#include "src/core/lib/transport/chttp2/hpack_parser.h"
+#include "src/core/lib/transport/chttp2/internal.h"
+#include <assert.h>
#include <stddef.h>
#include <string.h>
-#include <assert.h>
/* This is here for grpc_is_binary_header
* TODO(murgatroid99): Remove this
@@ -48,9 +48,9 @@
#include <grpc/support/port_platform.h>
#include <grpc/support/useful.h>
-#include "src/core/profiling/timers.h"
-#include "src/core/support/string.h"
-#include "src/core/transport/chttp2/bin_encoder.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/transport/chttp2/bin_encoder.h"
typedef enum {
NOT_BINARY,
diff --git a/src/core/transport/chttp2/hpack_parser.h b/src/core/lib/transport/chttp2/hpack_parser.h
index 6a6d136da2..a534fd5cf4 100644
--- a/src/core/transport/chttp2/hpack_parser.h
+++ b/src/core/lib/transport/chttp2/hpack_parser.h
@@ -31,16 +31,16 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_HPACK_PARSER_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_HPACK_PARSER_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_HPACK_PARSER_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_HPACK_PARSER_H
#include <stddef.h>
#include <grpc/support/port_platform.h>
-#include "src/core/iomgr/exec_ctx.h"
-#include "src/core/transport/chttp2/frame.h"
-#include "src/core/transport/chttp2/hpack_table.h"
-#include "src/core/transport/metadata.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
+#include "src/core/lib/transport/chttp2/frame.h"
+#include "src/core/lib/transport/chttp2/hpack_table.h"
+#include "src/core/lib/transport/metadata.h"
typedef struct grpc_chttp2_hpack_parser grpc_chttp2_hpack_parser;
@@ -113,4 +113,4 @@ grpc_chttp2_parse_error grpc_chttp2_header_parser_parse(
grpc_chttp2_transport_parsing *transport_parsing,
grpc_chttp2_stream_parsing *stream_parsing, gpr_slice slice, int is_last);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_HPACK_PARSER_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_HPACK_PARSER_H */
diff --git a/src/core/transport/chttp2/hpack_table.c b/src/core/lib/transport/chttp2/hpack_table.c
index f1ce3b84fd..f92bc26585 100644
--- a/src/core/transport/chttp2/hpack_table.c
+++ b/src/core/lib/transport/chttp2/hpack_table.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/transport/chttp2/hpack_table.h"
+#include "src/core/lib/transport/chttp2/hpack_table.h"
#include <assert.h>
#include <string.h>
@@ -39,7 +39,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/support/murmur_hash.h"
+#include "src/core/lib/support/murmur_hash.h"
static struct {
const char *key;
diff --git a/src/core/transport/chttp2/hpack_table.h b/src/core/lib/transport/chttp2/hpack_table.h
index 6e1b5e66b5..2cbc02dd9c 100644
--- a/src/core/transport/chttp2/hpack_table.h
+++ b/src/core/lib/transport/chttp2/hpack_table.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_HPACK_TABLE_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_HPACK_TABLE_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_HPACK_TABLE_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_HPACK_TABLE_H
-#include "src/core/transport/metadata.h"
#include <grpc/support/port_platform.h>
#include <grpc/support/slice.h>
+#include "src/core/lib/transport/metadata.h"
/* HPACK header table */
@@ -105,4 +105,4 @@ typedef struct {
grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find(
const grpc_chttp2_hptbl *tbl, grpc_mdelem *md);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_HPACK_TABLE_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_HPACK_TABLE_H */
diff --git a/src/core/transport/chttp2/hpack_tables.txt b/src/core/lib/transport/chttp2/hpack_tables.txt
index 08842a0267..08842a0267 100644
--- a/src/core/transport/chttp2/hpack_tables.txt
+++ b/src/core/lib/transport/chttp2/hpack_tables.txt
diff --git a/src/core/transport/chttp2/http2_errors.h b/src/core/lib/transport/chttp2/http2_errors.h
index 4290df3d89..0238f9d80b 100644
--- a/src/core/transport/chttp2/http2_errors.h
+++ b/src/core/lib/transport/chttp2/http2_errors.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_HTTP2_ERRORS_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_HTTP2_ERRORS_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_HTTP2_ERRORS_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_HTTP2_ERRORS_H
/* error codes for RST_STREAM from http2 draft 14 section 7 */
typedef enum {
@@ -53,4 +53,4 @@ typedef enum {
GRPC_CHTTP2__ERROR_DO_NOT_USE = -1
} grpc_chttp2_error_code;
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_HTTP2_ERRORS_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_HTTP2_ERRORS_H */
diff --git a/src/core/lib/transport/chttp2/huffsyms.c b/src/core/lib/transport/chttp2/huffsyms.c
new file mode 100644
index 0000000000..27497e6ae0
--- /dev/null
+++ b/src/core/lib/transport/chttp2/huffsyms.c
@@ -0,0 +1,105 @@
+/*
+ *
+ * Copyright 2015-2016, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "src/core/lib/transport/chttp2/huffsyms.h"
+
+/* Constants pulled from the HPACK spec, and converted to C using the vim
+ command:
+ :%s/.* \([0-9a-f]\+\) \[ *\([0-9]\+\)\]/{0x\1, \2},/g */
+const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS] = {
+ {0x1ff8, 13}, {0x7fffd8, 23}, {0xfffffe2, 28}, {0xfffffe3, 28},
+ {0xfffffe4, 28}, {0xfffffe5, 28}, {0xfffffe6, 28}, {0xfffffe7, 28},
+ {0xfffffe8, 28}, {0xffffea, 24}, {0x3ffffffc, 30}, {0xfffffe9, 28},
+ {0xfffffea, 28}, {0x3ffffffd, 30}, {0xfffffeb, 28}, {0xfffffec, 28},
+ {0xfffffed, 28}, {0xfffffee, 28}, {0xfffffef, 28}, {0xffffff0, 28},
+ {0xffffff1, 28}, {0xffffff2, 28}, {0x3ffffffe, 30}, {0xffffff3, 28},
+ {0xffffff4, 28}, {0xffffff5, 28}, {0xffffff6, 28}, {0xffffff7, 28},
+ {0xffffff8, 28}, {0xffffff9, 28}, {0xffffffa, 28}, {0xffffffb, 28},
+ {0x14, 6}, {0x3f8, 10}, {0x3f9, 10}, {0xffa, 12},
+ {0x1ff9, 13}, {0x15, 6}, {0xf8, 8}, {0x7fa, 11},
+ {0x3fa, 10}, {0x3fb, 10}, {0xf9, 8}, {0x7fb, 11},
+ {0xfa, 8}, {0x16, 6}, {0x17, 6}, {0x18, 6},
+ {0x0, 5}, {0x1, 5}, {0x2, 5}, {0x19, 6},
+ {0x1a, 6}, {0x1b, 6}, {0x1c, 6}, {0x1d, 6},
+ {0x1e, 6}, {0x1f, 6}, {0x5c, 7}, {0xfb, 8},
+ {0x7ffc, 15}, {0x20, 6}, {0xffb, 12}, {0x3fc, 10},
+ {0x1ffa, 13}, {0x21, 6}, {0x5d, 7}, {0x5e, 7},
+ {0x5f, 7}, {0x60, 7}, {0x61, 7}, {0x62, 7},
+ {0x63, 7}, {0x64, 7}, {0x65, 7}, {0x66, 7},
+ {0x67, 7}, {0x68, 7}, {0x69, 7}, {0x6a, 7},
+ {0x6b, 7}, {0x6c, 7}, {0x6d, 7}, {0x6e, 7},
+ {0x6f, 7}, {0x70, 7}, {0x71, 7}, {0x72, 7},
+ {0xfc, 8}, {0x73, 7}, {0xfd, 8}, {0x1ffb, 13},
+ {0x7fff0, 19}, {0x1ffc, 13}, {0x3ffc, 14}, {0x22, 6},
+ {0x7ffd, 15}, {0x3, 5}, {0x23, 6}, {0x4, 5},
+ {0x24, 6}, {0x5, 5}, {0x25, 6}, {0x26, 6},
+ {0x27, 6}, {0x6, 5}, {0x74, 7}, {0x75, 7},
+ {0x28, 6}, {0x29, 6}, {0x2a, 6}, {0x7, 5},
+ {0x2b, 6}, {0x76, 7}, {0x2c, 6}, {0x8, 5},
+ {0x9, 5}, {0x2d, 6}, {0x77, 7}, {0x78, 7},
+ {0x79, 7}, {0x7a, 7}, {0x7b, 7}, {0x7ffe, 15},
+ {0x7fc, 11}, {0x3ffd, 14}, {0x1ffd, 13}, {0xffffffc, 28},
+ {0xfffe6, 20}, {0x3fffd2, 22}, {0xfffe7, 20}, {0xfffe8, 20},
+ {0x3fffd3, 22}, {0x3fffd4, 22}, {0x3fffd5, 22}, {0x7fffd9, 23},
+ {0x3fffd6, 22}, {0x7fffda, 23}, {0x7fffdb, 23}, {0x7fffdc, 23},
+ {0x7fffdd, 23}, {0x7fffde, 23}, {0xffffeb, 24}, {0x7fffdf, 23},
+ {0xffffec, 24}, {0xffffed, 24}, {0x3fffd7, 22}, {0x7fffe0, 23},
+ {0xffffee, 24}, {0x7fffe1, 23}, {0x7fffe2, 23}, {0x7fffe3, 23},
+ {0x7fffe4, 23}, {0x1fffdc, 21}, {0x3fffd8, 22}, {0x7fffe5, 23},
+ {0x3fffd9, 22}, {0x7fffe6, 23}, {0x7fffe7, 23}, {0xffffef, 24},
+ {0x3fffda, 22}, {0x1fffdd, 21}, {0xfffe9, 20}, {0x3fffdb, 22},
+ {0x3fffdc, 22}, {0x7fffe8, 23}, {0x7fffe9, 23}, {0x1fffde, 21},
+ {0x7fffea, 23}, {0x3fffdd, 22}, {0x3fffde, 22}, {0xfffff0, 24},
+ {0x1fffdf, 21}, {0x3fffdf, 22}, {0x7fffeb, 23}, {0x7fffec, 23},
+ {0x1fffe0, 21}, {0x1fffe1, 21}, {0x3fffe0, 22}, {0x1fffe2, 21},
+ {0x7fffed, 23}, {0x3fffe1, 22}, {0x7fffee, 23}, {0x7fffef, 23},
+ {0xfffea, 20}, {0x3fffe2, 22}, {0x3fffe3, 22}, {0x3fffe4, 22},
+ {0x7ffff0, 23}, {0x3fffe5, 22}, {0x3fffe6, 22}, {0x7ffff1, 23},
+ {0x3ffffe0, 26}, {0x3ffffe1, 26}, {0xfffeb, 20}, {0x7fff1, 19},
+ {0x3fffe7, 22}, {0x7ffff2, 23}, {0x3fffe8, 22}, {0x1ffffec, 25},
+ {0x3ffffe2, 26}, {0x3ffffe3, 26}, {0x3ffffe4, 26}, {0x7ffffde, 27},
+ {0x7ffffdf, 27}, {0x3ffffe5, 26}, {0xfffff1, 24}, {0x1ffffed, 25},
+ {0x7fff2, 19}, {0x1fffe3, 21}, {0x3ffffe6, 26}, {0x7ffffe0, 27},
+ {0x7ffffe1, 27}, {0x3ffffe7, 26}, {0x7ffffe2, 27}, {0xfffff2, 24},
+ {0x1fffe4, 21}, {0x1fffe5, 21}, {0x3ffffe8, 26}, {0x3ffffe9, 26},
+ {0xffffffd, 28}, {0x7ffffe3, 27}, {0x7ffffe4, 27}, {0x7ffffe5, 27},
+ {0xfffec, 20}, {0xfffff3, 24}, {0xfffed, 20}, {0x1fffe6, 21},
+ {0x3fffe9, 22}, {0x1fffe7, 21}, {0x1fffe8, 21}, {0x7ffff3, 23},
+ {0x3fffea, 22}, {0x3fffeb, 22}, {0x1ffffee, 25}, {0x1ffffef, 25},
+ {0xfffff4, 24}, {0xfffff5, 24}, {0x3ffffea, 26}, {0x7ffff4, 23},
+ {0x3ffffeb, 26}, {0x7ffffe6, 27}, {0x3ffffec, 26}, {0x3ffffed, 26},
+ {0x7ffffe7, 27}, {0x7ffffe8, 27}, {0x7ffffe9, 27}, {0x7ffffea, 27},
+ {0x7ffffeb, 27}, {0xffffffe, 28}, {0x7ffffec, 27}, {0x7ffffed, 27},
+ {0x7ffffee, 27}, {0x7ffffef, 27}, {0x7fffff0, 27}, {0x3ffffee, 26},
+ {0x3fffffff, 30},
+};
diff --git a/src/core/transport/chttp2/huffsyms.h b/src/core/lib/transport/chttp2/huffsyms.h
index 9c4f09dcf6..1ca77b9207 100644
--- a/src/core/transport/chttp2/huffsyms.h
+++ b/src/core/lib/transport/chttp2/huffsyms.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_HUFFSYMS_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_HUFFSYMS_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_HUFFSYMS_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_HUFFSYMS_H
/* HPACK static huffman table */
@@ -45,4 +45,4 @@ typedef struct {
extern const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS];
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_HUFFSYMS_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_HUFFSYMS_H */
diff --git a/src/core/transport/chttp2/incoming_metadata.c b/src/core/lib/transport/chttp2/incoming_metadata.c
index 315bc2faa1..a1a8d37562 100644
--- a/src/core/transport/chttp2/incoming_metadata.c
+++ b/src/core/lib/transport/chttp2/incoming_metadata.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,11 +31,11 @@
*
*/
-#include "src/core/transport/chttp2/incoming_metadata.h"
+#include "src/core/lib/transport/chttp2/incoming_metadata.h"
#include <string.h>
-#include "src/core/transport/chttp2/internal.h"
+#include "src/core/lib/transport/chttp2/internal.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
diff --git a/src/core/transport/chttp2/incoming_metadata.h b/src/core/lib/transport/chttp2/incoming_metadata.h
index 52454f348c..edfa0adf9d 100644
--- a/src/core/transport/chttp2/incoming_metadata.h
+++ b/src/core/lib/transport/chttp2/incoming_metadata.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_INCOMING_METADATA_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_INCOMING_METADATA_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_INCOMING_METADATA_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_INCOMING_METADATA_H
-#include "src/core/transport/transport.h"
+#include "src/core/lib/transport/transport.h"
typedef struct {
grpc_linked_mdelem *elems;
@@ -57,4 +57,4 @@ void grpc_chttp2_incoming_metadata_buffer_add(
void grpc_chttp2_incoming_metadata_buffer_set_deadline(
grpc_chttp2_incoming_metadata_buffer *buffer, gpr_timespec deadline);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_INCOMING_METADATA_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_INCOMING_METADATA_H */
diff --git a/src/core/transport/chttp2/internal.h b/src/core/lib/transport/chttp2/internal.h
index 0690cb37cd..346e404204 100644
--- a/src/core/transport/chttp2/internal.h
+++ b/src/core/lib/transport/chttp2/internal.h
@@ -31,26 +31,26 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_INTERNAL_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_INTERNAL_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_INTERNAL_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_INTERNAL_H
#include <assert.h>
#include <stdbool.h>
-#include "src/core/iomgr/endpoint.h"
-#include "src/core/transport/chttp2/frame.h"
-#include "src/core/transport/chttp2/frame_data.h"
-#include "src/core/transport/chttp2/frame_goaway.h"
-#include "src/core/transport/chttp2/frame_ping.h"
-#include "src/core/transport/chttp2/frame_rst_stream.h"
-#include "src/core/transport/chttp2/frame_settings.h"
-#include "src/core/transport/chttp2/frame_window_update.h"
-#include "src/core/transport/chttp2/hpack_encoder.h"
-#include "src/core/transport/chttp2/hpack_parser.h"
-#include "src/core/transport/chttp2/incoming_metadata.h"
-#include "src/core/transport/chttp2/stream_map.h"
-#include "src/core/transport/connectivity_state.h"
-#include "src/core/transport/transport_impl.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/transport/chttp2/frame.h"
+#include "src/core/lib/transport/chttp2/frame_data.h"
+#include "src/core/lib/transport/chttp2/frame_goaway.h"
+#include "src/core/lib/transport/chttp2/frame_ping.h"
+#include "src/core/lib/transport/chttp2/frame_rst_stream.h"
+#include "src/core/lib/transport/chttp2/frame_settings.h"
+#include "src/core/lib/transport/chttp2/frame_window_update.h"
+#include "src/core/lib/transport/chttp2/hpack_encoder.h"
+#include "src/core/lib/transport/chttp2/hpack_parser.h"
+#include "src/core/lib/transport/chttp2/incoming_metadata.h"
+#include "src/core/lib/transport/chttp2/stream_map.h"
+#include "src/core/lib/transport/connectivity_state.h"
+#include "src/core/lib/transport/transport_impl.h"
typedef struct grpc_chttp2_transport grpc_chttp2_transport;
typedef struct grpc_chttp2_stream grpc_chttp2_stream;
@@ -777,4 +777,4 @@ void grpc_chttp2_ack_ping(grpc_exec_ctx *exec_ctx,
void grpc_chttp2_become_writable(grpc_chttp2_transport_global *transport_global,
grpc_chttp2_stream_global *stream_global);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_INTERNAL_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_INTERNAL_H */
diff --git a/src/core/transport/chttp2/parsing.c b/src/core/lib/transport/chttp2/parsing.c
index 0516f39fa9..9ee52f63f2 100644
--- a/src/core/transport/chttp2/parsing.c
+++ b/src/core/lib/transport/chttp2/parsing.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/transport/chttp2/internal.h"
+#include "src/core/lib/transport/chttp2/internal.h"
#include <string.h>
@@ -39,11 +39,11 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-#include "src/core/profiling/timers.h"
-#include "src/core/transport/chttp2/http2_errors.h"
-#include "src/core/transport/chttp2/status_conversion.h"
-#include "src/core/transport/chttp2/timeout_encoding.h"
-#include "src/core/transport/static_metadata.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/transport/chttp2/http2_errors.h"
+#include "src/core/lib/transport/chttp2/status_conversion.h"
+#include "src/core/lib/transport/chttp2/timeout_encoding.h"
+#include "src/core/lib/transport/static_metadata.h"
static int init_frame_parser(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport_parsing *transport_parsing);
diff --git a/src/core/transport/chttp2/status_conversion.c b/src/core/lib/transport/chttp2/status_conversion.c
index bf214b017a..73dd63e720 100644
--- a/src/core/transport/chttp2/status_conversion.c
+++ b/src/core/lib/transport/chttp2/status_conversion.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/transport/chttp2/status_conversion.h"
+#include "src/core/lib/transport/chttp2/status_conversion.h"
int grpc_chttp2_grpc_status_to_http2_error(grpc_status_code status) {
switch (status) {
diff --git a/src/core/transport/chttp2/status_conversion.h b/src/core/lib/transport/chttp2/status_conversion.h
index c6e066bb5d..241417d32e 100644
--- a/src/core/transport/chttp2/status_conversion.h
+++ b/src/core/lib/transport/chttp2/status_conversion.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_STATUS_CONVERSION_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_STATUS_CONVERSION_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_STATUS_CONVERSION_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_STATUS_CONVERSION_H
#include <grpc/grpc.h>
-#include "src/core/transport/chttp2/http2_errors.h"
+#include "src/core/lib/transport/chttp2/http2_errors.h"
/* Conversion of grpc status codes to http2 error codes (for RST_STREAM) */
grpc_chttp2_error_code grpc_chttp2_grpc_status_to_http2_error(
@@ -47,4 +47,4 @@ grpc_status_code grpc_chttp2_http2_error_to_grpc_status(
grpc_status_code grpc_chttp2_http2_status_to_grpc_status(int status);
int grpc_chttp2_grpc_status_to_http2_status(grpc_status_code status);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_STATUS_CONVERSION_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_STATUS_CONVERSION_H */
diff --git a/src/core/transport/chttp2/stream_lists.c b/src/core/lib/transport/chttp2/stream_lists.c
index 60fe735cfc..b51a041dc7 100644
--- a/src/core/transport/chttp2/stream_lists.c
+++ b/src/core/lib/transport/chttp2/stream_lists.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/transport/chttp2/internal.h"
+#include "src/core/lib/transport/chttp2/internal.h"
#include <grpc/support/log.h>
diff --git a/src/core/transport/chttp2/stream_map.c b/src/core/lib/transport/chttp2/stream_map.c
index 555a16fb72..dbbbe783bf 100644
--- a/src/core/transport/chttp2/stream_map.c
+++ b/src/core/lib/transport/chttp2/stream_map.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/transport/chttp2/stream_map.h"
+#include "src/core/lib/transport/chttp2/stream_map.h"
#include <string.h>
diff --git a/src/core/transport/chttp2/stream_map.h b/src/core/lib/transport/chttp2/stream_map.h
index 957a58a4f2..1c56b18e54 100644
--- a/src/core/transport/chttp2/stream_map.h
+++ b/src/core/lib/transport/chttp2/stream_map.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_STREAM_MAP_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_STREAM_MAP_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_STREAM_MAP_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_STREAM_MAP_H
#include <grpc/support/port_platform.h>
@@ -81,4 +81,4 @@ void grpc_chttp2_stream_map_for_each(grpc_chttp2_stream_map *map,
void *value),
void *user_data);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_STREAM_MAP_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_STREAM_MAP_H */
diff --git a/src/core/transport/chttp2/timeout_encoding.c b/src/core/lib/transport/chttp2/timeout_encoding.c
index a6f7081d21..0edacaafd3 100644
--- a/src/core/transport/chttp2/timeout_encoding.c
+++ b/src/core/lib/transport/chttp2/timeout_encoding.c
@@ -31,13 +31,13 @@
*
*/
-#include "src/core/transport/chttp2/timeout_encoding.h"
+#include "src/core/lib/transport/chttp2/timeout_encoding.h"
#include <stdio.h>
#include <string.h>
#include <grpc/support/port_platform.h>
-#include "src/core/support/string.h"
+#include "src/core/lib/support/string.h"
static int64_t round_up(int64_t x, int64_t divisor) {
return (x / divisor + (x % divisor != 0)) * divisor;
@@ -150,7 +150,7 @@ int grpc_chttp2_decode_timeout(const char *buffer, gpr_timespec *timeout) {
/* spec allows max. 8 digits, but we allow values up to 1,000,000,000 */
if (x >= (100 * 1000 * 1000)) {
if (x != (100 * 1000 * 1000) || digit != 0) {
- *timeout = gpr_inf_future(GPR_CLOCK_REALTIME);
+ *timeout = gpr_inf_future(GPR_TIMESPAN);
return 1;
}
}
diff --git a/src/core/transport/chttp2/timeout_encoding.h b/src/core/lib/transport/chttp2/timeout_encoding.h
index 81bae8e936..731beb5a37 100644
--- a/src/core/transport/chttp2/timeout_encoding.h
+++ b/src/core/lib/transport/chttp2/timeout_encoding.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H
-#include "src/core/support/string.h"
#include <grpc/support/time.h>
+#include "src/core/lib/support/string.h"
#define GRPC_CHTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE (GPR_LTOA_MIN_BUFSIZE + 1)
@@ -44,4 +44,4 @@
void grpc_chttp2_encode_timeout(gpr_timespec timeout, char *buffer);
int grpc_chttp2_decode_timeout(const char *buffer, gpr_timespec *timeout);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_TIMEOUT_ENCODING_H */
diff --git a/src/core/transport/chttp2/varint.c b/src/core/lib/transport/chttp2/varint.c
index 1cc235e989..6dfef45362 100644
--- a/src/core/transport/chttp2/varint.c
+++ b/src/core/lib/transport/chttp2/varint.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/transport/chttp2/varint.h"
+#include "src/core/lib/transport/chttp2/varint.h"
uint32_t grpc_chttp2_hpack_varint_length(uint32_t tail_value) {
if (tail_value < (1 << 7)) {
diff --git a/src/core/transport/chttp2/varint.h b/src/core/lib/transport/chttp2/varint.h
index 7ab9d22ab5..e4a0ae3c22 100644
--- a/src/core/transport/chttp2/varint.h
+++ b/src/core/lib/transport/chttp2/varint.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_VARINT_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_VARINT_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_VARINT_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_VARINT_H
#include <grpc/support/port_platform.h>
@@ -72,4 +72,4 @@ void grpc_chttp2_hpack_write_varint_tail(uint32_t tail_value, uint8_t* target,
} \
} while (0)
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_VARINT_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_VARINT_H */
diff --git a/src/core/transport/chttp2/writing.c b/src/core/lib/transport/chttp2/writing.c
index 107725cbc7..daea331d31 100644
--- a/src/core/transport/chttp2/writing.c
+++ b/src/core/lib/transport/chttp2/writing.c
@@ -31,14 +31,14 @@
*
*/
-#include "src/core/transport/chttp2/internal.h"
+#include "src/core/lib/transport/chttp2/internal.h"
#include <limits.h>
#include <grpc/support/log.h>
-#include "src/core/profiling/timers.h"
-#include "src/core/transport/chttp2/http2_errors.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/transport/chttp2/http2_errors.h"
static void finalize_outbuf(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport_writing *transport_writing);
diff --git a/src/core/transport/chttp2_transport.c b/src/core/lib/transport/chttp2_transport.c
index b16768d06e..7fed3d8b47 100644
--- a/src/core/transport/chttp2_transport.c
+++ b/src/core/lib/transport/chttp2_transport.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/transport/chttp2_transport.h"
+#include "src/core/lib/transport/chttp2_transport.h"
#include <math.h>
#include <stdio.h>
@@ -43,14 +43,14 @@
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
-#include "src/core/profiling/timers.h"
-#include "src/core/support/string.h"
-#include "src/core/transport/chttp2/http2_errors.h"
-#include "src/core/transport/chttp2/internal.h"
-#include "src/core/transport/chttp2/status_conversion.h"
-#include "src/core/transport/chttp2/timeout_encoding.h"
-#include "src/core/transport/static_metadata.h"
-#include "src/core/transport/transport_impl.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/transport/chttp2/http2_errors.h"
+#include "src/core/lib/transport/chttp2/internal.h"
+#include "src/core/lib/transport/chttp2/status_conversion.h"
+#include "src/core/lib/transport/chttp2/timeout_encoding.h"
+#include "src/core/lib/transport/static_metadata.h"
+#include "src/core/lib/transport/transport_impl.h"
#define DEFAULT_WINDOW 65535
#define DEFAULT_CONNECTION_WINDOW_TARGET (1024 * 1024)
@@ -1398,8 +1398,8 @@ static void recv_data(grpc_exec_ctx *exec_ctx, void *tp, bool success) {
gpr_mu_unlock(&t->mu);
GPR_TIMER_BEGIN("recv_data.parse", 0);
for (; i < t->read_buffer.count &&
- grpc_chttp2_perform_read(exec_ctx, transport_parsing,
- t->read_buffer.slices[i]);
+ grpc_chttp2_perform_read(exec_ctx, transport_parsing,
+ t->read_buffer.slices[i]);
i++)
;
GPR_TIMER_END("recv_data.parse", 0);
@@ -1474,9 +1474,10 @@ static void connectivity_state_set(
grpc_connectivity_state state, const char *reason) {
GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_DEBUG, "set connectivity_state=%d", state));
- grpc_connectivity_state_set(exec_ctx, &TRANSPORT_FROM_GLOBAL(transport_global)
- ->channel_callback.state_tracker,
- state, reason);
+ grpc_connectivity_state_set(
+ exec_ctx,
+ &TRANSPORT_FROM_GLOBAL(transport_global)->channel_callback.state_tracker,
+ state, reason);
}
/*******************************************************************************
@@ -1756,10 +1757,15 @@ static char *chttp2_get_peer(grpc_exec_ctx *exec_ctx, grpc_transport *t) {
return gpr_strdup(((grpc_chttp2_transport *)t)->peer_string);
}
-static const grpc_transport_vtable vtable = {
- sizeof(grpc_chttp2_stream), "chttp2", init_stream, set_pollset,
- perform_stream_op, perform_transport_op, destroy_stream, destroy_transport,
- chttp2_get_peer};
+static const grpc_transport_vtable vtable = {sizeof(grpc_chttp2_stream),
+ "chttp2",
+ init_stream,
+ set_pollset,
+ perform_stream_op,
+ perform_transport_op,
+ destroy_stream,
+ destroy_transport,
+ chttp2_get_peer};
grpc_transport *grpc_create_chttp2_transport(
grpc_exec_ctx *exec_ctx, const grpc_channel_args *channel_args,
diff --git a/src/core/transport/chttp2_transport.h b/src/core/lib/transport/chttp2_transport.h
index 9a6cf0ed35..5008cab7f8 100644
--- a/src/core/transport/chttp2_transport.h
+++ b/src/core/lib/transport/chttp2_transport.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CHTTP2_TRANSPORT_H
-#define GRPC_CORE_TRANSPORT_CHTTP2_TRANSPORT_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CHTTP2_TRANSPORT_H
+#define GRPC_CORE_LIB_TRANSPORT_CHTTP2_TRANSPORT_H
-#include "src/core/iomgr/endpoint.h"
-#include "src/core/transport/transport.h"
+#include "src/core/lib/iomgr/endpoint.h"
+#include "src/core/lib/transport/transport.h"
extern int grpc_http_trace;
extern int grpc_flowctl_trace;
@@ -48,4 +48,4 @@ void grpc_chttp2_transport_start_reading(grpc_exec_ctx *exec_ctx,
grpc_transport *transport,
gpr_slice *slices, size_t nslices);
-#endif /* GRPC_CORE_TRANSPORT_CHTTP2_TRANSPORT_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CHTTP2_TRANSPORT_H */
diff --git a/src/core/transport/connectivity_state.c b/src/core/lib/transport/connectivity_state.c
index 87765b9799..123eab8b36 100644
--- a/src/core/transport/connectivity_state.c
+++ b/src/core/lib/transport/connectivity_state.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/transport/connectivity_state.h"
+#include "src/core/lib/transport/connectivity_state.h"
#include <string.h>
diff --git a/src/core/transport/connectivity_state.h b/src/core/lib/transport/connectivity_state.h
index b4a3ce924d..6f92132438 100644
--- a/src/core/transport/connectivity_state.h
+++ b/src/core/lib/transport/connectivity_state.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_CONNECTIVITY_STATE_H
-#define GRPC_CORE_TRANSPORT_CONNECTIVITY_STATE_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_CONNECTIVITY_STATE_H
+#define GRPC_CORE_LIB_TRANSPORT_CONNECTIVITY_STATE_H
#include <grpc/grpc.h>
-#include "src/core/iomgr/exec_ctx.h"
+#include "src/core/lib/iomgr/exec_ctx.h"
typedef struct grpc_connectivity_state_watcher {
/** we keep watchers in a linked list */
@@ -82,4 +82,4 @@ int grpc_connectivity_state_notify_on_state_change(
grpc_exec_ctx *exec_ctx, grpc_connectivity_state_tracker *tracker,
grpc_connectivity_state *current, grpc_closure *notify);
-#endif /* GRPC_CORE_TRANSPORT_CONNECTIVITY_STATE_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_CONNECTIVITY_STATE_H */
diff --git a/src/core/transport/metadata.c b/src/core/lib/transport/metadata.c
index 807ae071a3..7605f09991 100644
--- a/src/core/transport/metadata.c
+++ b/src/core/lib/transport/metadata.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/transport/metadata.h"
+#include "src/core/lib/transport/metadata.h"
#include <assert.h>
#include <stddef.h>
@@ -44,12 +44,12 @@
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
-#include "src/core/profiling/timers.h"
-#include "src/core/support/murmur_hash.h"
-#include "src/core/support/string.h"
-#include "src/core/transport/chttp2/bin_encoder.h"
-#include "src/core/transport/static_metadata.h"
-#include "src/core/iomgr/iomgr_internal.h"
+#include "src/core/lib/iomgr/iomgr_internal.h"
+#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/support/murmur_hash.h"
+#include "src/core/lib/support/string.h"
+#include "src/core/lib/transport/chttp2/bin_encoder.h"
+#include "src/core/lib/transport/static_metadata.h"
/* There are two kinds of mdelem and mdstr instances.
* Static instances are declared in static_metadata.{h,c} and
diff --git a/src/core/transport/metadata.h b/src/core/lib/transport/metadata.h
index 5ab397848c..d72ec9accc 100644
--- a/src/core/transport/metadata.h
+++ b/src/core/lib/transport/metadata.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_METADATA_H
-#define GRPC_CORE_TRANSPORT_METADATA_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_METADATA_H
+#define GRPC_CORE_LIB_TRANSPORT_METADATA_H
#include <grpc/support/slice.h>
#include <grpc/support/useful.h>
@@ -153,4 +153,4 @@ int grpc_mdstr_is_bin_suffixed(grpc_mdstr *s);
void grpc_mdctx_global_init(void);
void grpc_mdctx_global_shutdown(void);
-#endif /* GRPC_CORE_TRANSPORT_METADATA_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_H */
diff --git a/src/core/transport/metadata_batch.c b/src/core/lib/transport/metadata_batch.c
index 1266862f82..bb79b8fa96 100644
--- a/src/core/transport/metadata_batch.c
+++ b/src/core/lib/transport/metadata_batch.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,14 +31,14 @@
*
*/
-#include "src/core/transport/metadata_batch.h"
+#include "src/core/lib/transport/metadata_batch.h"
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/profiling/timers.h"
+#include "src/core/lib/profiling/timers.h"
static void assert_valid_list(grpc_mdelem_list *list) {
#ifndef NDEBUG
diff --git a/src/core/transport/metadata_batch.h b/src/core/lib/transport/metadata_batch.h
index 9337b28328..f1d4726989 100644
--- a/src/core/transport/metadata_batch.h
+++ b/src/core/lib/transport/metadata_batch.h
@@ -31,14 +31,14 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_METADATA_BATCH_H
-#define GRPC_CORE_TRANSPORT_METADATA_BATCH_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H
+#define GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H
#include <grpc/grpc.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/slice.h>
#include <grpc/support/time.h>
-#include "src/core/transport/metadata.h"
+#include "src/core/lib/transport/metadata.h"
typedef struct grpc_linked_mdelem {
grpc_mdelem *md;
@@ -122,4 +122,4 @@ void grpc_metadata_batch_assert_ok(grpc_metadata_batch *comd);
} while (0)
#endif
-#endif /* GRPC_CORE_TRANSPORT_METADATA_BATCH_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_METADATA_BATCH_H */
diff --git a/src/core/transport/static_metadata.c b/src/core/lib/transport/static_metadata.c
index 140ec5edc7..bde1fafc88 100644
--- a/src/core/transport/static_metadata.c
+++ b/src/core/lib/transport/static_metadata.c
@@ -33,22 +33,20 @@
* WARNING: Auto-generated code.
*
* To make changes to this file, change
- * tools/codegen/core/gen_static_metadata.py,
- * and then re-run it.
+ * tools/codegen/core/gen_static_metadata.py, and then re-run it.
*
* See metadata.h for an explanation of the interface here, and metadata.c for
- * an
- * explanation of what's going on.
+ * an explanation of what's going on.
*/
-#include "src/core/transport/static_metadata.h"
+#include "src/core/lib/transport/static_metadata.h"
grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT];
grpc_mdelem grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 3, 7, 5, 2, 4, 8, 6, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 4, 8, 6, 2, 4, 8, 6, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
@@ -64,24 +62,96 @@ const uint8_t grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 2] =
82, 35, 83, 84, 85, 35, 86, 35, 87, 35, 88, 35, 89, 35};
const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = {
- "0", "1", "2", "200", "204", "206", "304", "400", "404", "500", "accept",
- "accept-charset", "accept-encoding", "accept-language", "accept-ranges",
- "access-control-allow-origin", "age", "allow", "application/grpc",
- ":authority", "authorization", "cache-control", "census-bin",
- "census-binary-bin", "content-disposition", "content-encoding",
- "content-language", "content-length", "content-location", "content-range",
- "content-type", "cookie", "date", "deflate", "deflate,gzip", "", "etag",
- "expect", "expires", "from", "GET", "grpc", "grpc-accept-encoding",
- "grpc-encoding", "grpc-internal-encoding-request", "grpc-message",
- "grpc-status", "grpc-timeout", "gzip", "gzip, deflate", "host", "http",
- "https", "identity", "identity,deflate", "identity,deflate,gzip",
- "identity,gzip", "if-match", "if-modified-since", "if-none-match",
- "if-range", "if-unmodified-since", "last-modified", "link", "location",
- "max-forwards", ":method", ":path", "POST", "proxy-authenticate",
- "proxy-authorization", "PUT", "range", "referer", "refresh", "retry-after",
- ":scheme", "server", "set-cookie", "/", "/index.html", ":status",
- "strict-transport-security", "te", "trailers", "transfer-encoding",
- "user-agent", "vary", "via", "www-authenticate"};
+ "0",
+ "1",
+ "2",
+ "200",
+ "204",
+ "206",
+ "304",
+ "400",
+ "404",
+ "500",
+ "accept",
+ "accept-charset",
+ "accept-encoding",
+ "accept-language",
+ "accept-ranges",
+ "access-control-allow-origin",
+ "age",
+ "allow",
+ "application/grpc",
+ ":authority",
+ "authorization",
+ "cache-control",
+ "census-bin",
+ "census-binary-bin",
+ "content-disposition",
+ "content-encoding",
+ "content-language",
+ "content-length",
+ "content-location",
+ "content-range",
+ "content-type",
+ "cookie",
+ "date",
+ "deflate",
+ "deflate,gzip",
+ "",
+ "etag",
+ "expect",
+ "expires",
+ "from",
+ "GET",
+ "grpc",
+ "grpc-accept-encoding",
+ "grpc-encoding",
+ "grpc-internal-encoding-request",
+ "grpc-message",
+ "grpc-status",
+ "grpc-timeout",
+ "gzip",
+ "gzip, deflate",
+ "host",
+ "http",
+ "https",
+ "identity",
+ "identity,deflate",
+ "identity,deflate,gzip",
+ "identity,gzip",
+ "if-match",
+ "if-modified-since",
+ "if-none-match",
+ "if-range",
+ "if-unmodified-since",
+ "last-modified",
+ "link",
+ "location",
+ "max-forwards",
+ ":method",
+ ":path",
+ "POST",
+ "proxy-authenticate",
+ "proxy-authorization",
+ "PUT",
+ "range",
+ "referer",
+ "refresh",
+ "retry-after",
+ ":scheme",
+ "server",
+ "set-cookie",
+ "/",
+ "/index.html",
+ ":status",
+ "strict-transport-security",
+ "te",
+ "trailers",
+ "transfer-encoding",
+ "user-agent",
+ "vary",
+ "via",
+ "www-authenticate"};
const uint8_t grpc_static_accept_encoding_metadata[8] = {0, 29, 26, 30,
28, 32, 27, 31};
diff --git a/src/core/transport/static_metadata.h b/src/core/lib/transport/static_metadata.h
index ba6402e255..a05553a870 100644
--- a/src/core/transport/static_metadata.h
+++ b/src/core/lib/transport/static_metadata.h
@@ -33,18 +33,16 @@
* WARNING: Auto-generated code.
*
* To make changes to this file, change
- * tools/codegen/core/gen_static_metadata.py,
- * and then re-run it.
+ * tools/codegen/core/gen_static_metadata.py, and then re-run it.
*
* See metadata.h for an explanation of the interface here, and metadata.c for
- * an
- * explanation of what's going on.
+ * an explanation of what's going on.
*/
-#ifndef GRPC_CORE_TRANSPORT_STATIC_METADATA_H
-#define GRPC_CORE_TRANSPORT_STATIC_METADATA_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H
+#define GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H
-#include "src/core/transport/metadata.h"
+#include "src/core/lib/transport/metadata.h"
#define GRPC_STATIC_MDSTR_COUNT 90
extern grpc_mdstr grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT];
@@ -407,4 +405,4 @@ extern const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT];
extern const uint8_t grpc_static_accept_encoding_metadata[8];
#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) \
(&grpc_static_mdelem_table[grpc_static_accept_encoding_metadata[(algs)]])
-#endif /* GRPC_CORE_TRANSPORT_STATIC_METADATA_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_STATIC_METADATA_H */
diff --git a/src/core/transport/transport.c b/src/core/lib/transport/transport.c
index 3b555fa933..18256aae5e 100644
--- a/src/core/transport/transport.c
+++ b/src/core/lib/transport/transport.c
@@ -31,11 +31,11 @@
*
*/
-#include "src/core/transport/transport.h"
+#include "src/core/lib/transport/transport.h"
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
-#include "src/core/transport/transport_impl.h"
+#include "src/core/lib/transport/transport_impl.h"
#ifdef GRPC_STREAM_REFCOUNT_DEBUG
void grpc_stream_ref(grpc_stream_refcount *refcount, const char *reason) {
diff --git a/src/core/transport/transport.h b/src/core/lib/transport/transport.h
index 082e8b2f53..df0989703a 100644
--- a/src/core/transport/transport.h
+++ b/src/core/lib/transport/transport.h
@@ -31,16 +31,16 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_TRANSPORT_H
-#define GRPC_CORE_TRANSPORT_TRANSPORT_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_TRANSPORT_H
+#define GRPC_CORE_LIB_TRANSPORT_TRANSPORT_H
#include <stddef.h>
-#include "src/core/channel/context.h"
-#include "src/core/iomgr/pollset.h"
-#include "src/core/iomgr/pollset_set.h"
-#include "src/core/transport/byte_stream.h"
-#include "src/core/transport/metadata_batch.h"
+#include "src/core/lib/channel/context.h"
+#include "src/core/lib/iomgr/pollset.h"
+#include "src/core/lib/iomgr/pollset_set.h"
+#include "src/core/lib/transport/byte_stream.h"
+#include "src/core/lib/transport/metadata_batch.h"
/* forward declarations */
typedef struct grpc_transport grpc_transport;
@@ -244,4 +244,4 @@ void grpc_transport_destroy(grpc_exec_ctx *exec_ctx, grpc_transport *transport);
char *grpc_transport_get_peer(grpc_exec_ctx *exec_ctx,
grpc_transport *transport);
-#endif /* GRPC_CORE_TRANSPORT_TRANSPORT_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_H */
diff --git a/src/core/transport/transport_impl.h b/src/core/lib/transport/transport_impl.h
index d9ecc4d2ba..92fa5d519d 100644
--- a/src/core/transport/transport_impl.h
+++ b/src/core/lib/transport/transport_impl.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_TRANSPORT_TRANSPORT_IMPL_H
-#define GRPC_CORE_TRANSPORT_TRANSPORT_IMPL_H
+#ifndef GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H
+#define GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H
-#include "src/core/transport/transport.h"
+#include "src/core/lib/transport/transport.h"
typedef struct grpc_transport_vtable {
/* Memory required for a single stream element - this is allocated by upper
@@ -78,4 +78,4 @@ struct grpc_transport {
const grpc_transport_vtable *vtable;
};
-#endif /* GRPC_CORE_TRANSPORT_TRANSPORT_IMPL_H */
+#endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H */
diff --git a/src/core/transport/transport_op_string.c b/src/core/lib/transport/transport_op_string.c
index 98b51afc88..1fa8fa5d4f 100644
--- a/src/core/transport/transport_op_string.c
+++ b/src/core/lib/transport/transport_op_string.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,16 +31,16 @@
*
*/
-#include "src/core/channel/channel_stack.h"
+#include "src/core/lib/channel/channel_stack.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include "src/core/support/string.h"
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
+#include "src/core/lib/support/string.h"
/* These routines are here to facilitate debugging - they produce string
representations of various transport data structures */
diff --git a/src/core/tsi/fake_transport_security.c b/src/core/lib/tsi/fake_transport_security.c
index 72ac32a171..4b812f4803 100644
--- a/src/core/tsi/fake_transport_security.c
+++ b/src/core/lib/tsi/fake_transport_security.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/tsi/fake_transport_security.h"
+#include "src/core/lib/tsi/fake_transport_security.h"
#include <stdlib.h>
#include <string.h>
@@ -39,7 +39,7 @@
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
#include <grpc/support/useful.h>
-#include "src/core/tsi/transport_security.h"
+#include "src/core/lib/tsi/transport_security.h"
/* --- Constants. ---*/
#define TSI_FAKE_FRAME_HEADER_SIZE 4
@@ -493,8 +493,10 @@ static void fake_handshaker_destroy(tsi_handshaker *self) {
static const tsi_handshaker_vtable handshaker_vtable = {
fake_handshaker_get_bytes_to_send_to_peer,
- fake_handshaker_process_bytes_from_peer, fake_handshaker_get_result,
- fake_handshaker_extract_peer, fake_handshaker_create_frame_protector,
+ fake_handshaker_process_bytes_from_peer,
+ fake_handshaker_get_result,
+ fake_handshaker_extract_peer,
+ fake_handshaker_create_frame_protector,
fake_handshaker_destroy,
};
diff --git a/src/core/tsi/fake_transport_security.h b/src/core/lib/tsi/fake_transport_security.h
index 6b8e596290..b887dfcb09 100644
--- a/src/core/tsi/fake_transport_security.h
+++ b/src/core/lib/tsi/fake_transport_security.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_TSI_FAKE_TRANSPORT_SECURITY_H
-#define GRPC_CORE_TSI_FAKE_TRANSPORT_SECURITY_H
+#ifndef GRPC_CORE_LIB_TSI_FAKE_TRANSPORT_SECURITY_H
+#define GRPC_CORE_LIB_TSI_FAKE_TRANSPORT_SECURITY_H
-#include "src/core/tsi/transport_security_interface.h"
+#include "src/core/lib/tsi/transport_security_interface.h"
#ifdef __cplusplus
extern "C" {
@@ -58,4 +58,4 @@ tsi_frame_protector *tsi_create_fake_protector(
}
#endif
-#endif /* GRPC_CORE_TSI_FAKE_TRANSPORT_SECURITY_H */
+#endif /* GRPC_CORE_LIB_TSI_FAKE_TRANSPORT_SECURITY_H */
diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/lib/tsi/ssl_transport_security.c
index 42d25ca929..d03201eec6 100644
--- a/src/core/tsi/ssl_transport_security.c
+++ b/src/core/lib/tsi/ssl_transport_security.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/tsi/ssl_transport_security.h"
+#include "src/core/lib/tsi/ssl_transport_security.h"
#include <grpc/support/port_platform.h>
@@ -57,8 +57,8 @@
#include <openssl/x509.h>
#include <openssl/x509v3.h>
-#include "src/core/tsi/ssl_types.h"
-#include "src/core/tsi/transport_security.h"
+#include "src/core/lib/tsi/ssl_types.h"
+#include "src/core/lib/tsi/transport_security.h"
/* --- Constants. ---*/
@@ -1039,8 +1039,10 @@ static void ssl_handshaker_destroy(tsi_handshaker *self) {
static const tsi_handshaker_vtable handshaker_vtable = {
ssl_handshaker_get_bytes_to_send_to_peer,
- ssl_handshaker_process_bytes_from_peer, ssl_handshaker_get_result,
- ssl_handshaker_extract_peer, ssl_handshaker_create_frame_protector,
+ ssl_handshaker_process_bytes_from_peer,
+ ssl_handshaker_get_result,
+ ssl_handshaker_extract_peer,
+ ssl_handshaker_create_frame_protector,
ssl_handshaker_destroy,
};
diff --git a/src/core/tsi/ssl_transport_security.h b/src/core/lib/tsi/ssl_transport_security.h
index 612f5c64cc..c9b9e8f54b 100644
--- a/src/core/tsi/ssl_transport_security.h
+++ b/src/core/lib/tsi/ssl_transport_security.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H
-#define GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H
+#ifndef GRPC_CORE_LIB_TSI_SSL_TRANSPORT_SECURITY_H
+#define GRPC_CORE_LIB_TSI_SSL_TRANSPORT_SECURITY_H
-#include "src/core/tsi/transport_security_interface.h"
+#include "src/core/lib/tsi/transport_security_interface.h"
#ifdef __cplusplus
extern "C" {
@@ -171,4 +171,4 @@ int tsi_ssl_peer_matches_name(const tsi_peer *peer, const char *name);
}
#endif
-#endif /* GRPC_CORE_TSI_SSL_TRANSPORT_SECURITY_H */
+#endif /* GRPC_CORE_LIB_TSI_SSL_TRANSPORT_SECURITY_H */
diff --git a/src/core/tsi/ssl_types.h b/src/core/lib/tsi/ssl_types.h
index 6ea85fe6d4..c6e68c01ad 100644
--- a/src/core/tsi/ssl_types.h
+++ b/src/core/lib/tsi/ssl_types.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_TSI_SSL_TYPES_H
-#define GRPC_CORE_TSI_SSL_TYPES_H
+#ifndef GRPC_CORE_LIB_TSI_SSL_TYPES_H
+#define GRPC_CORE_LIB_TSI_SSL_TYPES_H
/* A collection of macros to cast between various integer types that are
* used differently between BoringSSL and OpenSSL:
@@ -52,4 +52,4 @@
#define TSI_SIZE_AS_SIZE(x) ((int)(x))
#endif
-#endif /* GRPC_CORE_TSI_SSL_TYPES_H */
+#endif /* GRPC_CORE_LIB_TSI_SSL_TYPES_H */
diff --git a/src/core/tsi/test_creds/README b/src/core/lib/tsi/test_creds/README
index eb8482d648..eb8482d648 100644
--- a/src/core/tsi/test_creds/README
+++ b/src/core/lib/tsi/test_creds/README
diff --git a/src/core/tsi/test_creds/badclient.key b/src/core/lib/tsi/test_creds/badclient.key
index 5832685122..5832685122 100644
--- a/src/core/tsi/test_creds/badclient.key
+++ b/src/core/lib/tsi/test_creds/badclient.key
diff --git a/src/core/tsi/test_creds/badclient.pem b/src/core/lib/tsi/test_creds/badclient.pem
index 1785970221..1785970221 100644
--- a/src/core/tsi/test_creds/badclient.pem
+++ b/src/core/lib/tsi/test_creds/badclient.pem
diff --git a/src/core/tsi/test_creds/badserver.key b/src/core/lib/tsi/test_creds/badserver.key
index abfbde10ff..abfbde10ff 100644
--- a/src/core/tsi/test_creds/badserver.key
+++ b/src/core/lib/tsi/test_creds/badserver.key
diff --git a/src/core/tsi/test_creds/badserver.pem b/src/core/lib/tsi/test_creds/badserver.pem
index 983c979f31..983c979f31 100644
--- a/src/core/tsi/test_creds/badserver.pem
+++ b/src/core/lib/tsi/test_creds/badserver.pem
diff --git a/src/core/tsi/test_creds/ca-openssl.cnf b/src/core/lib/tsi/test_creds/ca-openssl.cnf
index e97b945e4b..e97b945e4b 100644
--- a/src/core/tsi/test_creds/ca-openssl.cnf
+++ b/src/core/lib/tsi/test_creds/ca-openssl.cnf
diff --git a/src/core/tsi/test_creds/ca.key b/src/core/lib/tsi/test_creds/ca.key
index 03c4f950e3..03c4f950e3 100644
--- a/src/core/tsi/test_creds/ca.key
+++ b/src/core/lib/tsi/test_creds/ca.key
diff --git a/src/core/tsi/test_creds/ca.pem b/src/core/lib/tsi/test_creds/ca.pem
index 6c8511a73c..6c8511a73c 100644
--- a/src/core/tsi/test_creds/ca.pem
+++ b/src/core/lib/tsi/test_creds/ca.pem
diff --git a/src/core/tsi/test_creds/client.key b/src/core/lib/tsi/test_creds/client.key
index f48d0735d9..f48d0735d9 100644
--- a/src/core/tsi/test_creds/client.key
+++ b/src/core/lib/tsi/test_creds/client.key
diff --git a/src/core/tsi/test_creds/client.pem b/src/core/lib/tsi/test_creds/client.pem
index e332091019..e332091019 100644
--- a/src/core/tsi/test_creds/client.pem
+++ b/src/core/lib/tsi/test_creds/client.pem
diff --git a/src/core/tsi/test_creds/server0.key b/src/core/lib/tsi/test_creds/server0.key
index add153c9ae..add153c9ae 100644
--- a/src/core/tsi/test_creds/server0.key
+++ b/src/core/lib/tsi/test_creds/server0.key
diff --git a/src/core/tsi/test_creds/server0.pem b/src/core/lib/tsi/test_creds/server0.pem
index ade75d8563..ade75d8563 100644
--- a/src/core/tsi/test_creds/server0.pem
+++ b/src/core/lib/tsi/test_creds/server0.pem
diff --git a/src/core/tsi/test_creds/server1-openssl.cnf b/src/core/lib/tsi/test_creds/server1-openssl.cnf
index 8a02108289..8a02108289 100644
--- a/src/core/tsi/test_creds/server1-openssl.cnf
+++ b/src/core/lib/tsi/test_creds/server1-openssl.cnf
diff --git a/src/core/tsi/test_creds/server1.key b/src/core/lib/tsi/test_creds/server1.key
index 143a5b8765..143a5b8765 100644
--- a/src/core/tsi/test_creds/server1.key
+++ b/src/core/lib/tsi/test_creds/server1.key
diff --git a/src/core/tsi/test_creds/server1.pem b/src/core/lib/tsi/test_creds/server1.pem
index f3d43fcc5b..f3d43fcc5b 100644
--- a/src/core/tsi/test_creds/server1.pem
+++ b/src/core/lib/tsi/test_creds/server1.pem
diff --git a/src/core/tsi/transport_security.c b/src/core/lib/tsi/transport_security.c
index db219a50a6..a2c0d46196 100644
--- a/src/core/tsi/transport_security.c
+++ b/src/core/lib/tsi/transport_security.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/tsi/transport_security.h"
+#include "src/core/lib/tsi/transport_security.h"
#include <stdlib.h>
#include <string.h>
diff --git a/src/core/tsi/transport_security.h b/src/core/lib/tsi/transport_security.h
index ecc037193b..349dd0ae9c 100644
--- a/src/core/tsi/transport_security.h
+++ b/src/core/lib/tsi/transport_security.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_TSI_TRANSPORT_SECURITY_H
-#define GRPC_CORE_TSI_TRANSPORT_SECURITY_H
+#ifndef GRPC_CORE_LIB_TSI_TRANSPORT_SECURITY_H
+#define GRPC_CORE_LIB_TSI_TRANSPORT_SECURITY_H
-#include "src/core/tsi/transport_security_interface.h"
+#include "src/core/lib/tsi/transport_security_interface.h"
#ifdef __cplusplus
extern "C" {
@@ -108,4 +108,4 @@ char *tsi_strdup(const char *src); /* Sadly, no strdup in C89. */
}
#endif
-#endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_H */
+#endif /* GRPC_CORE_LIB_TSI_TRANSPORT_SECURITY_H */
diff --git a/src/core/tsi/transport_security_interface.h b/src/core/lib/tsi/transport_security_interface.h
index 08501802f5..f88f1516a9 100644
--- a/src/core/tsi/transport_security_interface.h
+++ b/src/core/lib/tsi/transport_security_interface.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_TSI_TRANSPORT_SECURITY_INTERFACE_H
-#define GRPC_CORE_TSI_TRANSPORT_SECURITY_INTERFACE_H
+#ifndef GRPC_CORE_LIB_TSI_TRANSPORT_SECURITY_INTERFACE_H
+#define GRPC_CORE_LIB_TSI_TRANSPORT_SECURITY_INTERFACE_H
#include <stdint.h>
#include <stdlib.h>
@@ -341,4 +341,4 @@ void tsi_handshaker_destroy(tsi_handshaker *self);
}
#endif
-#endif /* GRPC_CORE_TSI_TRANSPORT_SECURITY_INTERFACE_H */
+#endif /* GRPC_CORE_LIB_TSI_TRANSPORT_SECURITY_INTERFACE_H */
diff --git a/src/core/transport/chttp2/huffsyms.c b/src/core/transport/chttp2/huffsyms.c
deleted file mode 100644
index 7b138e9b5d..0000000000
--- a/src/core/transport/chttp2/huffsyms.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- *
- * Copyright 2015, Google Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-#include "src/core/transport/chttp2/huffsyms.h"
-
-/* Constants pulled from the HPACK spec, and converted to C using the vim
- command:
- :%s/.* \([0-9a-f]\+\) \[ *\([0-9]\+\)\]/{0x\1, \2},/g */
-const grpc_chttp2_huffsym grpc_chttp2_huffsyms[GRPC_CHTTP2_NUM_HUFFSYMS] = {
- {0x1ff8, 13},
- {0x7fffd8, 23},
- {0xfffffe2, 28},
- {0xfffffe3, 28},
- {0xfffffe4, 28},
- {0xfffffe5, 28},
- {0xfffffe6, 28},
- {0xfffffe7, 28},
- {0xfffffe8, 28},
- {0xffffea, 24},
- {0x3ffffffc, 30},
- {0xfffffe9, 28},
- {0xfffffea, 28},
- {0x3ffffffd, 30},
- {0xfffffeb, 28},
- {0xfffffec, 28},
- {0xfffffed, 28},
- {0xfffffee, 28},
- {0xfffffef, 28},
- {0xffffff0, 28},
- {0xffffff1, 28},
- {0xffffff2, 28},
- {0x3ffffffe, 30},
- {0xffffff3, 28},
- {0xffffff4, 28},
- {0xffffff5, 28},
- {0xffffff6, 28},
- {0xffffff7, 28},
- {0xffffff8, 28},
- {0xffffff9, 28},
- {0xffffffa, 28},
- {0xffffffb, 28},
- {0x14, 6},
- {0x3f8, 10},
- {0x3f9, 10},
- {0xffa, 12},
- {0x1ff9, 13},
- {0x15, 6},
- {0xf8, 8},
- {0x7fa, 11},
- {0x3fa, 10},
- {0x3fb, 10},
- {0xf9, 8},
- {0x7fb, 11},
- {0xfa, 8},
- {0x16, 6},
- {0x17, 6},
- {0x18, 6},
- {0x0, 5},
- {0x1, 5},
- {0x2, 5},
- {0x19, 6},
- {0x1a, 6},
- {0x1b, 6},
- {0x1c, 6},
- {0x1d, 6},
- {0x1e, 6},
- {0x1f, 6},
- {0x5c, 7},
- {0xfb, 8},
- {0x7ffc, 15},
- {0x20, 6},
- {0xffb, 12},
- {0x3fc, 10},
- {0x1ffa, 13},
- {0x21, 6},
- {0x5d, 7},
- {0x5e, 7},
- {0x5f, 7},
- {0x60, 7},
- {0x61, 7},
- {0x62, 7},
- {0x63, 7},
- {0x64, 7},
- {0x65, 7},
- {0x66, 7},
- {0x67, 7},
- {0x68, 7},
- {0x69, 7},
- {0x6a, 7},
- {0x6b, 7},
- {0x6c, 7},
- {0x6d, 7},
- {0x6e, 7},
- {0x6f, 7},
- {0x70, 7},
- {0x71, 7},
- {0x72, 7},
- {0xfc, 8},
- {0x73, 7},
- {0xfd, 8},
- {0x1ffb, 13},
- {0x7fff0, 19},
- {0x1ffc, 13},
- {0x3ffc, 14},
- {0x22, 6},
- {0x7ffd, 15},
- {0x3, 5},
- {0x23, 6},
- {0x4, 5},
- {0x24, 6},
- {0x5, 5},
- {0x25, 6},
- {0x26, 6},
- {0x27, 6},
- {0x6, 5},
- {0x74, 7},
- {0x75, 7},
- {0x28, 6},
- {0x29, 6},
- {0x2a, 6},
- {0x7, 5},
- {0x2b, 6},
- {0x76, 7},
- {0x2c, 6},
- {0x8, 5},
- {0x9, 5},
- {0x2d, 6},
- {0x77, 7},
- {0x78, 7},
- {0x79, 7},
- {0x7a, 7},
- {0x7b, 7},
- {0x7ffe, 15},
- {0x7fc, 11},
- {0x3ffd, 14},
- {0x1ffd, 13},
- {0xffffffc, 28},
- {0xfffe6, 20},
- {0x3fffd2, 22},
- {0xfffe7, 20},
- {0xfffe8, 20},
- {0x3fffd3, 22},
- {0x3fffd4, 22},
- {0x3fffd5, 22},
- {0x7fffd9, 23},
- {0x3fffd6, 22},
- {0x7fffda, 23},
- {0x7fffdb, 23},
- {0x7fffdc, 23},
- {0x7fffdd, 23},
- {0x7fffde, 23},
- {0xffffeb, 24},
- {0x7fffdf, 23},
- {0xffffec, 24},
- {0xffffed, 24},
- {0x3fffd7, 22},
- {0x7fffe0, 23},
- {0xffffee, 24},
- {0x7fffe1, 23},
- {0x7fffe2, 23},
- {0x7fffe3, 23},
- {0x7fffe4, 23},
- {0x1fffdc, 21},
- {0x3fffd8, 22},
- {0x7fffe5, 23},
- {0x3fffd9, 22},
- {0x7fffe6, 23},
- {0x7fffe7, 23},
- {0xffffef, 24},
- {0x3fffda, 22},
- {0x1fffdd, 21},
- {0xfffe9, 20},
- {0x3fffdb, 22},
- {0x3fffdc, 22},
- {0x7fffe8, 23},
- {0x7fffe9, 23},
- {0x1fffde, 21},
- {0x7fffea, 23},
- {0x3fffdd, 22},
- {0x3fffde, 22},
- {0xfffff0, 24},
- {0x1fffdf, 21},
- {0x3fffdf, 22},
- {0x7fffeb, 23},
- {0x7fffec, 23},
- {0x1fffe0, 21},
- {0x1fffe1, 21},
- {0x3fffe0, 22},
- {0x1fffe2, 21},
- {0x7fffed, 23},
- {0x3fffe1, 22},
- {0x7fffee, 23},
- {0x7fffef, 23},
- {0xfffea, 20},
- {0x3fffe2, 22},
- {0x3fffe3, 22},
- {0x3fffe4, 22},
- {0x7ffff0, 23},
- {0x3fffe5, 22},
- {0x3fffe6, 22},
- {0x7ffff1, 23},
- {0x3ffffe0, 26},
- {0x3ffffe1, 26},
- {0xfffeb, 20},
- {0x7fff1, 19},
- {0x3fffe7, 22},
- {0x7ffff2, 23},
- {0x3fffe8, 22},
- {0x1ffffec, 25},
- {0x3ffffe2, 26},
- {0x3ffffe3, 26},
- {0x3ffffe4, 26},
- {0x7ffffde, 27},
- {0x7ffffdf, 27},
- {0x3ffffe5, 26},
- {0xfffff1, 24},
- {0x1ffffed, 25},
- {0x7fff2, 19},
- {0x1fffe3, 21},
- {0x3ffffe6, 26},
- {0x7ffffe0, 27},
- {0x7ffffe1, 27},
- {0x3ffffe7, 26},
- {0x7ffffe2, 27},
- {0xfffff2, 24},
- {0x1fffe4, 21},
- {0x1fffe5, 21},
- {0x3ffffe8, 26},
- {0x3ffffe9, 26},
- {0xffffffd, 28},
- {0x7ffffe3, 27},
- {0x7ffffe4, 27},
- {0x7ffffe5, 27},
- {0xfffec, 20},
- {0xfffff3, 24},
- {0xfffed, 20},
- {0x1fffe6, 21},
- {0x3fffe9, 22},
- {0x1fffe7, 21},
- {0x1fffe8, 21},
- {0x7ffff3, 23},
- {0x3fffea, 22},
- {0x3fffeb, 22},
- {0x1ffffee, 25},
- {0x1ffffef, 25},
- {0xfffff4, 24},
- {0xfffff5, 24},
- {0x3ffffea, 26},
- {0x7ffff4, 23},
- {0x3ffffeb, 26},
- {0x7ffffe6, 27},
- {0x3ffffec, 26},
- {0x3ffffed, 26},
- {0x7ffffe7, 27},
- {0x7ffffe8, 27},
- {0x7ffffe9, 27},
- {0x7ffffea, 27},
- {0x7ffffeb, 27},
- {0xffffffe, 28},
- {0x7ffffec, 27},
- {0x7ffffed, 27},
- {0x7ffffee, 27},
- {0x7ffffef, 27},
- {0x7fffff0, 27},
- {0x3ffffee, 26},
- {0x3fffffff, 30},
-};
diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc
index ae20392d11..f174676172 100644
--- a/src/cpp/client/channel.cc
+++ b/src/cpp/client/channel.cc
@@ -49,7 +49,7 @@
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include <grpc/support/slice.h>
-#include "src/core/profiling/timers.h"
+#include "src/core/lib/profiling/timers.h"
namespace grpc {
diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc
index 73147fd7bb..de8b2db6e3 100644
--- a/src/cpp/client/client_context.cc
+++ b/src/cpp/client/client_context.cc
@@ -33,15 +33,15 @@
#include <grpc++/client_context.h>
+#include <grpc++/security/credentials.h>
+#include <grpc++/server_context.h>
+#include <grpc++/support/time.h>
#include <grpc/compression.h>
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
-#include <grpc++/security/credentials.h>
-#include <grpc++/server_context.h>
-#include <grpc++/support/time.h>
-#include "src/core/channel/compress_filter.h"
+#include "src/core/lib/channel/compress_filter.h"
#include "src/cpp/common/create_auth_context.h"
namespace grpc {
diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc
index 1293203b93..efea02995a 100644
--- a/src/cpp/client/insecure_credentials.cc
+++ b/src/cpp/client/insecure_credentials.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,11 +33,11 @@
#include <grpc++/security/credentials.h>
-#include <grpc/grpc.h>
-#include <grpc/support/log.h>
#include <grpc++/channel.h>
#include <grpc++/support/channel_arguments.h>
#include <grpc++/support/config.h>
+#include <grpc/grpc.h>
+#include <grpc/support/log.h>
#include "src/cpp/client/create_channel_internal.h"
namespace grpc {
diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc
index c34b840f90..cdc8406f24 100644
--- a/src/cpp/client/secure_credentials.cc
+++ b/src/cpp/client/secure_credentials.cc
@@ -31,12 +31,12 @@
*
*/
+#include "src/cpp/client/secure_credentials.h"
#include <grpc++/channel.h>
#include <grpc++/impl/grpc_library.h>
#include <grpc++/support/channel_arguments.h>
#include <grpc/support/log.h>
#include "src/cpp/client/create_channel_internal.h"
-#include "src/cpp/client/secure_credentials.h"
#include "src/cpp/common/secure_auth_context.h"
namespace grpc {
diff --git a/src/cpp/client/secure_credentials.h b/src/cpp/client/secure_credentials.h
index 9e84102154..fd82331a44 100644
--- a/src/cpp/client/secure_credentials.h
+++ b/src/cpp/client/secure_credentials.h
@@ -36,8 +36,8 @@
#include <grpc/grpc_security.h>
-#include <grpc++/support/config.h>
#include <grpc++/security/credentials.h>
+#include <grpc++/support/config.h>
#include "src/cpp/server/thread_pool_interface.h"
diff --git a/src/cpp/common/channel_arguments.cc b/src/cpp/common/channel_arguments.cc
index d7faa5e173..3bdb4398ab 100644
--- a/src/cpp/common/channel_arguments.cc
+++ b/src/cpp/common/channel_arguments.cc
@@ -36,7 +36,7 @@
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/support/log.h>
-#include "src/core/channel/channel_args.h"
+#include "src/core/lib/channel/channel_args.h"
namespace grpc {
diff --git a/src/cpp/common/core_codegen.cc b/src/cpp/common/core_codegen.cc
index 45e9e278a0..33a8f755e6 100644
--- a/src/cpp/common/core_codegen.cc
+++ b/src/cpp/common/core_codegen.cc
@@ -46,7 +46,7 @@
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
-#include "src/core/profiling/timers.h"
+#include "src/core/lib/profiling/timers.h"
namespace {
diff --git a/src/cpp/common/core_codegen.h b/src/cpp/common/core_codegen.h
index 0d8c6b79f7..e15cb4c34a 100644
--- a/src/cpp/common/core_codegen.h
+++ b/src/cpp/common/core_codegen.h
@@ -34,8 +34,8 @@
// This file should be compiled as part of grpc++.
#include <grpc++/impl/codegen/core_codegen_interface.h>
-#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/byte_buffer.h>
+#include <grpc/impl/codegen/grpc_types.h>
namespace grpc {
diff --git a/src/cpp/common/create_auth_context.h b/src/cpp/common/create_auth_context.h
index 4f3da397ba..c53055503f 100644
--- a/src/cpp/common/create_auth_context.h
+++ b/src/cpp/common/create_auth_context.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,8 +32,8 @@
*/
#include <memory>
-#include <grpc/grpc.h>
#include <grpc++/security/auth_context.h>
+#include <grpc/grpc.h>
namespace grpc {
diff --git a/src/cpp/common/insecure_create_auth_context.cc b/src/cpp/common/insecure_create_auth_context.cc
index b2e153229a..7ec5d9bd12 100644
--- a/src/cpp/common/insecure_create_auth_context.cc
+++ b/src/cpp/common/insecure_create_auth_context.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,8 +32,8 @@
*/
#include <memory>
-#include <grpc/grpc.h>
#include <grpc++/security/auth_context.h>
+#include <grpc/grpc.h>
namespace grpc {
diff --git a/src/cpp/common/secure_channel_arguments.cc b/src/cpp/common/secure_channel_arguments.cc
index e17d3b58b0..82e02f0238 100644
--- a/src/cpp/common/secure_channel_arguments.cc
+++ b/src/cpp/common/secure_channel_arguments.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,7 +34,7 @@
#include <grpc++/support/channel_arguments.h>
#include <grpc/grpc_security.h>
-#include "src/core/channel/channel_args.h"
+#include "src/core/lib/channel/channel_args.h"
namespace grpc {
diff --git a/src/cpp/common/secure_create_auth_context.cc b/src/cpp/common/secure_create_auth_context.cc
index 40bc298b64..d7cf803fde 100644
--- a/src/cpp/common/secure_create_auth_context.cc
+++ b/src/cpp/common/secure_create_auth_context.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,9 +32,9 @@
*/
#include <memory>
+#include <grpc++/security/auth_context.h>
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
-#include <grpc++/security/auth_context.h>
#include "src/cpp/common/secure_auth_context.h"
namespace grpc {
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index 05c58ccc4f..5ec05e4dcc 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -49,7 +49,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/profiling/timers.h"
+#include "src/core/lib/profiling/timers.h"
#include "src/cpp/server/thread_pool_interface.h"
namespace grpc {
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc
index 134e5f1d5f..1947d68e3e 100644
--- a/src/cpp/server/server_builder.cc
+++ b/src/cpp/server/server_builder.cc
@@ -33,10 +33,10 @@
#include <grpc++/server_builder.h>
-#include <grpc/support/cpu.h>
-#include <grpc/support/log.h>
#include <grpc++/impl/service_type.h>
#include <grpc++/server.h>
+#include <grpc/support/cpu.h>
+#include <grpc/support/log.h>
#include "src/cpp/server/thread_pool_interface.h"
namespace grpc {
diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc
index 5d12ce2ecf..0422650953 100644
--- a/src/cpp/server/server_context.cc
+++ b/src/cpp/server/server_context.cc
@@ -42,8 +42,8 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/channel/compress_filter.h"
-#include "src/core/surface/call.h"
+#include "src/core/lib/channel/compress_filter.h"
+#include "src/core/lib/surface/call.h"
#include "src/cpp/common/create_auth_context.h"
namespace grpc {
diff --git a/src/cpp/util/time.cc b/src/cpp/util/time.cc
index 2685e31ee6..bb5fce389d 100644
--- a/src/cpp/util/time.cc
+++ b/src/cpp/util/time.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,8 +35,8 @@
#ifndef GRPC_CXX0X_NO_CHRONO
-#include <grpc/support/time.h>
#include <grpc++/support/time.h>
+#include <grpc/support/time.h>
using std::chrono::duration_cast;
using std::chrono::nanoseconds;
diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c
index 1df74a0993..642dc9ef42 100644
--- a/src/csharp/ext/grpc_csharp_ext.c
+++ b/src/csharp/ext/grpc_csharp_ext.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/support/string.h"
+#include "src/core/lib/support/string.h"
#include <grpc/byte_buffer_reader.h>
#include <grpc/support/port_platform.h>
diff --git a/src/node/README.md b/src/node/README.md
index 3501b54a66..15d4c6d02f 100644
--- a/src/node/README.md
+++ b/src/node/README.md
@@ -7,6 +7,8 @@ Beta
## PREREQUISITES
- `node`: This requires `node` to be installed, version `0.12` or above. If you instead have the `nodejs` executable on Debian, you should install the [`nodejs-legacy`](https://packages.debian.org/sid/nodejs-legacy) package.
+- **Note:** If you installed `node` via a package manager and the version is still less than `0.12`, try directly installing it from [nodejs.org](https://nodejs.org).
+
## INSTALLATION
Install the gRPC NPM package
@@ -17,7 +19,21 @@ npm install grpc
## BUILD FROM SOURCE
1. Clone [the grpc Git Repository](https://github.com/grpc/grpc).
- 3. Run `npm install`.
+ 2. Run `npm install` from the repository root.
+
+ - **Note:** On Windows, this might fail due to [nodejs issue #4932](https://github.com/nodejs/node/issues/4932) in which case, you will see something like the following in `npm install`'s output (towards the very beginning):
+
+ ```
+ ..
+ Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
+ WINDOWS_BUILD_WARNING
+ "..\IMPORTANT: Due to https:\github.com\nodejs\node\issues\4932, to build this library on Windows, you must first remove C:\Users\jenkins\.node-gyp\4.4.0\include\node\openssl"
+ ...
+ ..
+ ```
+
+ To fix this, you will have to delete the folder `C:\Users\<username>\.node-gyp\<node_version>\include\node\openssl` and retry `npm install`
+
## TESTING
To run the test suite, simply run `npm test` in the install location.
diff --git a/src/node/ext/call_credentials.cc b/src/node/ext/call_credentials.cc
index 98696db232..bd2d146bbc 100644
--- a/src/node/ext/call_credentials.cc
+++ b/src/node/ext/call_credentials.cc
@@ -35,6 +35,8 @@
#include <nan.h>
#include <uv.h>
+#include <list>
+
#include "grpc/grpc.h"
#include "grpc/grpc_security.h"
#include "grpc/support/log.h"
@@ -161,6 +163,15 @@ NAN_METHOD(CallCredentials::CreateFromPlugin) {
grpc_metadata_credentials_plugin plugin;
plugin_state *state = new plugin_state;
state->callback = new Nan::Callback(info[0].As<Function>());
+ state->pending_callbacks = new std::list<plugin_callback_data*>();
+ uv_mutex_init(&state->plugin_mutex);
+ uv_async_init(uv_default_loop(),
+ &state->plugin_async,
+ SendPluginCallback);
+ uv_unref((uv_handle_t*)&state->plugin_async);
+
+ state->plugin_async.data = state;
+
plugin.get_metadata = plugin_get_metadata;
plugin.destroy = plugin_destroy_state;
plugin.state = reinterpret_cast<void*>(state);
@@ -208,48 +219,60 @@ NAN_METHOD(PluginCallback) {
NAUV_WORK_CB(SendPluginCallback) {
Nan::HandleScope scope;
- plugin_callback_data *data = reinterpret_cast<plugin_callback_data*>(
- async->data);
- // Attach cb and user_data to plugin_callback so that it can access them later
- v8::Local<v8::Function> plugin_callback = Nan::GetFunction(
- Nan::New<v8::FunctionTemplate>(PluginCallback)).ToLocalChecked();
- Nan::Set(plugin_callback, Nan::New("cb").ToLocalChecked(),
- Nan::New<v8::External>(reinterpret_cast<void*>(data->cb)));
- Nan::Set(plugin_callback, Nan::New("user_data").ToLocalChecked(),
- Nan::New<v8::External>(data->user_data));
- const int argc = 2;
- v8::Local<v8::Value> argv[argc] = {
- Nan::New(data->service_url).ToLocalChecked(),
- plugin_callback
- };
- Nan::Callback *callback = data->state->callback;
- callback->Call(argc, argv);
- delete data;
- uv_unref((uv_handle_t *)async);
- uv_close((uv_handle_t *)async, (uv_close_cb)free);
+ plugin_state *state = reinterpret_cast<plugin_state*>(async->data);
+ std::list<plugin_callback_data*> callbacks;
+ uv_mutex_lock(&state->plugin_mutex);
+ callbacks.splice(callbacks.begin(), *state->pending_callbacks);
+ uv_mutex_unlock(&state->plugin_mutex);
+ while (!callbacks.empty()) {
+ plugin_callback_data *data = callbacks.front();
+ callbacks.pop_front();
+ // Attach cb and user_data to plugin_callback so that it can access them later
+ v8::Local<v8::Function> plugin_callback = Nan::GetFunction(
+ Nan::New<v8::FunctionTemplate>(PluginCallback)).ToLocalChecked();
+ Nan::Set(plugin_callback, Nan::New("cb").ToLocalChecked(),
+ Nan::New<v8::External>(reinterpret_cast<void*>(data->cb)));
+ Nan::Set(plugin_callback, Nan::New("user_data").ToLocalChecked(),
+ Nan::New<v8::External>(data->user_data));
+ const int argc = 2;
+ v8::Local<v8::Value> argv[argc] = {
+ Nan::New(data->service_url).ToLocalChecked(),
+ plugin_callback
+ };
+ Nan::Callback *callback = state->callback;
+ callback->Call(argc, argv);
+ delete data;
+ }
}
void plugin_get_metadata(void *state, grpc_auth_metadata_context context,
grpc_credentials_plugin_metadata_cb cb,
void *user_data) {
- uv_async_t *async = static_cast<uv_async_t*>(malloc(sizeof(uv_async_t)));
- uv_async_init(uv_default_loop(),
- async,
- SendPluginCallback);
+ plugin_state *p_state = reinterpret_cast<plugin_state*>(state);
plugin_callback_data *data = new plugin_callback_data;
- data->state = reinterpret_cast<plugin_state*>(state);
data->service_url = context.service_url;
data->cb = cb;
data->user_data = user_data;
- async->data = data;
- /* libuv says that it will coalesce calls to uv_async_send. If there is ever a
- * problem with a callback not getting called, that is probably the reason */
- uv_async_send(async);
+
+ uv_mutex_lock(&p_state->plugin_mutex);
+ p_state->pending_callbacks->push_back(data);
+ uv_mutex_unlock(&p_state->plugin_mutex);
+
+ uv_async_send(&p_state->plugin_async);
+}
+
+void plugin_uv_close_cb(uv_handle_t *handle) {
+ uv_async_t *async = reinterpret_cast<uv_async_t*>(handle);
+ plugin_state *state = reinterpret_cast<plugin_state *>(async->data);
+ uv_mutex_destroy(&state->plugin_mutex);
+ delete state->pending_callbacks;
+ delete state->callback;
+ delete state;
}
void plugin_destroy_state(void *ptr) {
plugin_state *state = reinterpret_cast<plugin_state *>(ptr);
- delete state->callback;
+ uv_close((uv_handle_t*)&state->plugin_async, plugin_uv_close_cb);
}
} // namespace node
diff --git a/src/node/ext/call_credentials.h b/src/node/ext/call_credentials.h
index a9bfe30f94..1f35595f3d 100644
--- a/src/node/ext/call_credentials.h
+++ b/src/node/ext/call_credentials.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,8 +34,11 @@
#ifndef GRPC_NODE_CALL_CREDENTIALS_H_
#define GRPC_NODE_CALL_CREDENTIALS_H_
+#include <list>
+
#include <node.h>
#include <nan.h>
+#include <uv.h>
#include "grpc/grpc_security.h"
namespace grpc {
@@ -73,17 +76,20 @@ class CallCredentials : public Nan::ObjectWrap {
/* Auth metadata plugin functionality */
-typedef struct plugin_state {
- Nan::Callback *callback;
-} plugin_state;
-
typedef struct plugin_callback_data {
- plugin_state *state;
const char *service_url;
grpc_credentials_plugin_metadata_cb cb;
void *user_data;
} plugin_callback_data;
+typedef struct plugin_state {
+ Nan::Callback *callback;
+ std::list<plugin_callback_data*> *pending_callbacks;
+ uv_mutex_t plugin_mutex;
+ // async.data == this
+ uv_async_t plugin_async;
+} plugin_state;
+
void plugin_get_metadata(void *state, grpc_auth_metadata_context context,
grpc_credentials_plugin_metadata_cb cb,
void *user_data);
diff --git a/src/node/performance/benchmark_client.js b/src/node/performance/benchmark_client.js
index 620aecde97..80bec0b73e 100644
--- a/src/node/performance/benchmark_client.js
+++ b/src/node/performance/benchmark_client.js
@@ -45,6 +45,9 @@ var EventEmitter = require('events');
var _ = require('lodash');
var PoissonProcess = require('poisson-process');
var Histogram = require('./histogram');
+
+var genericService = require('./generic_service');
+
var grpc = require('../../../');
var serviceProto = grpc.load({
root: __dirname + '/../../..',
@@ -104,10 +107,14 @@ function BenchmarkClient(server_targets, channels, histogram_params,
}
this.clients = [];
+ var GenericClient = grpc.makeGenericClientConstructor(genericService);
+ this.genericClients = [];
for (var i = 0; i < channels; i++) {
this.clients[i] = new serviceProto.BenchmarkService(
server_targets[i % server_targets.length], creds, options);
+ this.genericClients[i] = new GenericClient(
+ server_targets[i % server_targets.length], creds, options);
}
this.histogram = new Histogram(histogram_params.resolution,
@@ -130,9 +137,11 @@ util.inherits(BenchmarkClient, EventEmitter);
* 'STREAMING'
* @param {number} req_size The size of the payload to send with each request
* @param {number} resp_size The size of payload to request be sent in responses
+ * @param {boolean} generic Indicates that the generic (non-proto) clients
+ * should be used
*/
BenchmarkClient.prototype.startClosedLoop = function(
- outstanding_rpcs_per_channel, rpc_type, req_size, resp_size) {
+ outstanding_rpcs_per_channel, rpc_type, req_size, resp_size, generic) {
var self = this;
self.running = true;
@@ -141,12 +150,20 @@ BenchmarkClient.prototype.startClosedLoop = function(
var makeCall;
- var argument = {
- response_size: resp_size,
- payload: {
- body: zeroBuffer(req_size)
- }
- };
+ var argument;
+ var client_list;
+ if (generic) {
+ argument = zeroBuffer(req_size);
+ client_list = self.genericClients;
+ } else {
+ argument = {
+ response_size: resp_size,
+ payload: {
+ body: zeroBuffer(req_size)
+ }
+ };
+ client_list = self.clients;
+ }
if (rpc_type == 'UNARY') {
makeCall = function(client) {
@@ -195,7 +212,7 @@ BenchmarkClient.prototype.startClosedLoop = function(
};
}
- _.each(self.clients, function(client) {
+ _.each(client_list, function(client) {
_.times(outstanding_rpcs_per_channel, function() {
makeCall(client);
});
@@ -213,9 +230,12 @@ BenchmarkClient.prototype.startClosedLoop = function(
* @param {number} req_size The size of the payload to send with each request
* @param {number} resp_size The size of payload to request be sent in responses
* @param {number} offered_load The load parameter for the Poisson process
+ * @param {boolean} generic Indicates that the generic (non-proto) clients
+ * should be used
*/
BenchmarkClient.prototype.startPoisson = function(
- outstanding_rpcs_per_channel, rpc_type, req_size, resp_size, offered_load) {
+ outstanding_rpcs_per_channel, rpc_type, req_size, resp_size, offered_load,
+ generic) {
var self = this;
self.running = true;
@@ -224,12 +244,20 @@ BenchmarkClient.prototype.startPoisson = function(
var makeCall;
- var argument = {
- response_size: resp_size,
- payload: {
- body: zeroBuffer(req_size)
- }
- };
+ var argument;
+ var client_list;
+ if (generic) {
+ argument = zeroBuffer(req_size);
+ client_list = self.genericClients;
+ } else {
+ argument = {
+ response_size: resp_size,
+ payload: {
+ body: zeroBuffer(req_size)
+ }
+ };
+ client_list = self.clients;
+ }
if (rpc_type == 'UNARY') {
makeCall = function(client, poisson) {
@@ -282,7 +310,7 @@ BenchmarkClient.prototype.startPoisson = function(
var averageIntervalMs = (1 / offered_load) * 1000;
- _.each(self.clients, function(client) {
+ _.each(client_list, function(client) {
_.times(outstanding_rpcs_per_channel, function() {
var p = PoissonProcess.create(averageIntervalMs, function() {
makeCall(client, p);
diff --git a/src/node/performance/benchmark_server.js b/src/node/performance/benchmark_server.js
index e48acd48f5..b1b0bd12ab 100644
--- a/src/node/performance/benchmark_server.js
+++ b/src/node/performance/benchmark_server.js
@@ -41,6 +41,8 @@
var fs = require('fs');
var path = require('path');
+var genericService = require('./generic_service');
+
var grpc = require('../../../');
var serviceProto = grpc.load({
root: __dirname + '/../../..',
@@ -84,14 +86,28 @@ function streamingCall(call) {
});
}
+function makeStreamingGenericCall(response_size) {
+ var response = zeroBuffer(response_size);
+ return function streamingGenericCall(call) {
+ call.on('data', function(value) {
+ call.write(response);
+ });
+ call.on('end', function() {
+ call.end();
+ });
+ };
+}
+
/**
* BenchmarkServer class. Constructed based on parameters from the driver and
* stores statistics.
* @param {string} host The host to serve on
* @param {number} port The port to listen to
- * @param {tls} Indicates whether TLS should be used
+ * @param {boolean} tls Indicates whether TLS should be used
+ * @param {boolean} generic Indicates whether to use the generic service
+ * @param {number=} response_size The response size for the generic service
*/
-function BenchmarkServer(host, port, tls) {
+function BenchmarkServer(host, port, tls, generic, response_size) {
var server_creds;
var host_override;
if (tls) {
@@ -109,10 +125,16 @@ function BenchmarkServer(host, port, tls) {
var server = new grpc.Server();
this.port = server.bind(host + ':' + port, server_creds);
- server.addProtoService(serviceProto.BenchmarkService.service, {
- unaryCall: unaryCall,
- streamingCall: streamingCall
- });
+ if (generic) {
+ server.addService(genericService, {
+ streamingCall: makeStreamingGenericCall(response_size)
+ });
+ } else {
+ server.addProtoService(serviceProto.BenchmarkService.service, {
+ unaryCall: unaryCall,
+ streamingCall: streamingCall
+ });
+ }
this.server = server;
}
diff --git a/src/node/performance/generic_service.js b/src/node/performance/generic_service.js
new file mode 100644
index 0000000000..ce09cc4336
--- /dev/null
+++ b/src/node/performance/generic_service.js
@@ -0,0 +1,46 @@
+/*
+ *
+ * Copyright 2016, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+var _ = require('lodash');
+
+module.exports = {
+ 'streamingCall' : {
+ path: '/grpc.testing/BenchmarkService',
+ requestStream: true,
+ responseStream: true,
+ requestSerialize: _.identity,
+ requestDeserialize: _.identity,
+ responseSerialize: _.identity,
+ responseDeserialize: _.identity
+ }
+};
diff --git a/src/node/performance/worker_service_impl.js b/src/node/performance/worker_service_impl.js
index 1439249878..2c4651370f 100644
--- a/src/node/performance/worker_service_impl.js
+++ b/src/node/performance/worker_service_impl.js
@@ -56,18 +56,31 @@ exports.runClient = function runClient(call) {
client.on('error', function(error) {
call.emit('error', error);
});
+ var req_size, resp_size, generic;
+ switch (setup.payload_config.payload) {
+ case 'bytebuf_params':
+ req_size = setup.payload_config.bytebuf_params.req_size;
+ resp_size = setup.payload_config.bytebuf_params.resp_size;
+ generic = true;
+ break;
+ case 'simple_params':
+ req_size = setup.payload_config.simple_params.req_size;
+ resp_size = setup.payload_config.simple_params.resp_size;
+ generic = false;
+ break;
+ default:
+ call.emit('error', new Error('Unsupported PayloadConfig type' +
+ setup.payload_config.payload));
+ }
switch (setup.load_params.load) {
case 'closed_loop':
client.startClosedLoop(setup.outstanding_rpcs_per_channel,
- setup.rpc_type,
- setup.payload_config.simple_params.req_size,
- setup.payload_config.simple_params.resp_size);
+ setup.rpc_type, req_size, resp_size, generic);
break;
case 'poisson':
client.startPoisson(setup.outstanding_rpcs_per_channel,
- setup.rpc_type, setup.payload_config.req_size,
- setup.payload_config.resp_size,
- setup.load_params.poisson.offered_load);
+ setup.rpc_type, req_size, resp_size,
+ setup.load_params.poisson.offered_load, generic);
break;
default:
call.emit('error', new Error('Unsupported LoadParams type' +
diff --git a/src/node/src/credentials.js b/src/node/src/credentials.js
index 1d73723cc0..97c4bd73ac 100644
--- a/src/node/src/credentials.js
+++ b/src/node/src/credentials.js
@@ -118,7 +118,6 @@ exports.createFromMetadataGenerator = function(metadata_generator) {
exports.createFromGoogleCredential = function(google_credential) {
return exports.createFromMetadataGenerator(function(auth_context, callback) {
var service_url = auth_context.service_url;
- console.log('Service URL:', service_url);
google_credential.getRequestMetadata(service_url, function(err, header) {
if (err) {
console.log('Auth error:', err);
@@ -127,7 +126,6 @@ exports.createFromGoogleCredential = function(google_credential) {
}
var metadata = new Metadata();
metadata.add('authorization', header.Authorization);
- console.log(header.Authorization);
callback(null, metadata);
});
});
diff --git a/src/node/src/server.js b/src/node/src/server.js
index 0cf7ba3424..dd0bc12bc9 100644
--- a/src/node/src/server.js
+++ b/src/node/src/server.js
@@ -339,7 +339,7 @@ function _read(size) {
try {
deserialized = self.deserialize(data);
} catch (e) {
- e.code = grpc.status.INVALID_ARGUMENT;
+ e.code = grpc.status.INTERNAL;
self.emit('error', e);
return;
}
@@ -475,7 +475,7 @@ function handleUnary(call, handler, metadata) {
try {
emitter.request = handler.deserialize(result.read);
} catch (e) {
- e.code = grpc.status.INVALID_ARGUMENT;
+ e.code = grpc.status.INTERNAL;
handleError(call, e);
return;
}
@@ -516,7 +516,7 @@ function handleServerStreaming(call, handler, metadata) {
try {
stream.request = handler.deserialize(result.read);
} catch (e) {
- e.code = grpc.status.INVALID_ARGUMENT;
+ e.code = grpc.status.INTERNAL;
stream.emit('error', e);
return;
}
diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js
index 8a232d6fc4..edbfc0a288 100644
--- a/src/node/test/surface_test.js
+++ b/src/node/test/surface_test.js
@@ -709,14 +709,14 @@ describe('Other conditions', function() {
it('should respond correctly to a unary call', function(done) {
misbehavingClient.unary(badArg, function(err, data) {
assert(err);
- assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT);
+ assert.strictEqual(err.code, grpc.status.INTERNAL);
done();
});
});
it('should respond correctly to a client stream', function(done) {
var call = misbehavingClient.clientStream(function(err, data) {
assert(err);
- assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT);
+ assert.strictEqual(err.code, grpc.status.INTERNAL);
done();
});
call.write(badArg);
@@ -729,7 +729,7 @@ describe('Other conditions', function() {
assert.fail(data, null, 'Unexpected data', '===');
});
call.on('error', function(err) {
- assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT);
+ assert.strictEqual(err.code, grpc.status.INTERNAL);
done();
});
});
@@ -739,7 +739,7 @@ describe('Other conditions', function() {
assert.fail(data, null, 'Unexpected data', '===');
});
call.on('error', function(err) {
- assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT);
+ assert.strictEqual(err.code, grpc.status.INTERNAL);
done();
});
call.write(badArg);
diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m
index 2d45818b6e..51263b073c 100644
--- a/src/objective-c/GRPCClient/GRPCCall.m
+++ b/src/objective-c/GRPCClient/GRPCCall.m
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -308,37 +308,30 @@ NSString * const kGRPCTrailersKey = @"io.grpc.TrailersKey";
}
- (void)invokeCall {
- __weak GRPCCall *weakSelf = self;
[self invokeCallWithHeadersHandler:^(NSDictionary *headers) {
// Response headers received.
- GRPCCall *strongSelf = weakSelf;
- if (strongSelf) {
- strongSelf.responseHeaders = headers;
- [strongSelf startNextRead];
- }
+ self.responseHeaders = headers;
+ [self startNextRead];
} completionHandler:^(NSError *error, NSDictionary *trailers) {
- GRPCCall *strongSelf = weakSelf;
- if (strongSelf) {
- strongSelf.responseTrailers = trailers;
-
- if (error) {
- NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
- if (error.userInfo) {
- [userInfo addEntriesFromDictionary:error.userInfo];
- }
- userInfo[kGRPCTrailersKey] = strongSelf.responseTrailers;
- // TODO(jcanizales): The C gRPC library doesn't guarantee that the headers block will be
- // called before this one, so an error might end up with trailers but no headers. We
- // shouldn't call finishWithError until ater both blocks are called. It is also when this is
- // done that we can provide a merged view of response headers and trailers in a thread-safe
- // way.
- if (strongSelf.responseHeaders) {
- userInfo[kGRPCHeadersKey] = strongSelf.responseHeaders;
- }
- error = [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo];
+ self.responseTrailers = trailers;
+
+ if (error) {
+ NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
+ if (error.userInfo) {
+ [userInfo addEntriesFromDictionary:error.userInfo];
+ }
+ userInfo[kGRPCTrailersKey] = self.responseTrailers;
+ // TODO(jcanizales): The C gRPC library doesn't guarantee that the headers block will be
+ // called before this one, so an error might end up with trailers but no headers. We
+ // shouldn't call finishWithError until ater both blocks are called. It is also when this is
+ // done that we can provide a merged view of response headers and trailers in a thread-safe
+ // way.
+ if (self.responseHeaders) {
+ userInfo[kGRPCHeadersKey] = self.responseHeaders;
}
- [strongSelf finishWithError:error];
+ error = [NSError errorWithDomain:error.domain code:error.code userInfo:userInfo];
}
+ [self finishWithError:error];
}];
// Now that the RPC has been initiated, request writes can start.
@synchronized(_requestWriter) {
@@ -377,7 +370,6 @@ NSString * const kGRPCTrailersKey = @"io.grpc.TrailersKey";
[strongSelf finishWithError:[NSError errorWithDomain:kGRPCErrorDomain
code:GRPCErrorCodeUnavailable
userInfo:@{NSLocalizedDescriptionKey: @"Connectivity lost."}]];
- [[GRPCHost hostWithAddress:strongSelf->_host] disconnect];
}
}];
}
diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h
index a52095dd01..7b66cd4c32 100644
--- a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h
+++ b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.h
@@ -36,8 +36,6 @@
typedef void(^GRPCQueueCompletionHandler)(bool success);
-extern const int64_t kGRPCCompletionQueueDefaultTimeoutSecs;
-
/**
* This class lets one more easily use |grpc_completion_queue|. To use it, pass the value of the
* |unmanagedQueue| property of an instance of this class to |grpc_channel_create_call|. Then for
@@ -51,11 +49,6 @@ extern const int64_t kGRPCCompletionQueueDefaultTimeoutSecs;
*/
@interface GRPCCompletionQueue : NSObject
@property(nonatomic, readonly) grpc_completion_queue *unmanagedQueue;
-@property(nonatomic, readonly) int64_t timeoutSecs;
+ (instancetype)completionQueue;
-
-- (instancetype)init;
-- (instancetype)initWithTimeout:(int64_t)timeoutSecs NS_DESIGNATED_INITIALIZER;
-
@end
diff --git a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m
index be214d4d36..d89602f7cb 100644
--- a/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m
+++ b/src/objective-c/GRPCClient/private/GRPCCompletionQueue.m
@@ -35,9 +35,6 @@
#import <grpc/grpc.h>
-
-const int64_t kGRPCCompletionQueueDefaultTimeoutSecs = 60;
-
@implementation GRPCCompletionQueue
+ (instancetype)completionQueue {
@@ -50,13 +47,8 @@ const int64_t kGRPCCompletionQueueDefaultTimeoutSecs = 60;
}
- (instancetype)init {
- return [self initWithTimeout:kGRPCCompletionQueueDefaultTimeoutSecs];
-}
-
-- (instancetype)initWithTimeout:(int64_t)timeoutSecs {
if ((self = [super init])) {
_unmanagedQueue = grpc_completion_queue_create(NULL);
- _timeoutSecs = timeoutSecs;
// This is for the following block to capture the pointer by value (instead
// of retaining self and doing self->_unmanagedQueue). This is essential
@@ -74,28 +66,22 @@ const int64_t kGRPCCompletionQueueDefaultTimeoutSecs = 60;
gDefaultConcurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
});
dispatch_async(gDefaultConcurrentQueue, ^{
- // Using a non-infinite deadline to re-enter grpc_completion_queue_next()
- // alleviates https://github.com/grpc/grpc/issues/5593
- gpr_timespec deadline = (timeoutSecs < 0)
- ? gpr_inf_future(GPR_CLOCK_REALTIME)
- : gpr_time_from_seconds(timeoutSecs, GPR_CLOCK_REALTIME);
while (YES) {
- // The following call blocks until an event is available or the deadline elapses.
- grpc_event event = grpc_completion_queue_next(unmanagedQueue, deadline, NULL);
+ // The following call blocks until an event is available.
+ grpc_event event = grpc_completion_queue_next(unmanagedQueue,
+ gpr_inf_future(GPR_CLOCK_REALTIME),
+ NULL);
GRPCQueueCompletionHandler handler;
switch (event.type) {
case GRPC_OP_COMPLETE:
handler = (__bridge_transfer GRPCQueueCompletionHandler)event.tag;
handler(event.success);
break;
- case GRPC_QUEUE_TIMEOUT:
- // Nothing to do here
- break;
case GRPC_QUEUE_SHUTDOWN:
grpc_completion_queue_destroy(unmanagedQueue);
return;
default:
- [NSException raise:@"Unrecognized completion type" format:@"type=%d", event.type];
+ [NSException raise:@"Unrecognized completion type" format:@""];
}
};
});
diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
index fe3d51da53..f6527e283c 100644
--- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
+++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -54,7 +54,9 @@
- (void)finish {
if (_handler) {
- _handler();
+ void(^handler)() = _handler;
+ _handler = nil;
+ handler();
}
}
@end
diff --git a/src/proto/grpc/testing/metrics.proto b/src/proto/grpc/testing/metrics.proto
index 4485d3a53b..df719afd99 100644
--- a/src/proto/grpc/testing/metrics.proto
+++ b/src/proto/grpc/testing/metrics.proto
@@ -1,5 +1,4 @@
-
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -28,12 +27,17 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// An integration test service that covers all the method signature permutations
-// of unary/streaming requests/responses.
+// Contains the definitions for a metrics service and the type of metrics
+// exposed by the service.
+//
+// Currently, 'Gauge' (i.e a metric that represents the measured value of
+// something at an instant of time) is the only metric type supported by the
+// service.
syntax = "proto3";
package grpc.testing;
+// Reponse message containing the gauge name and value
message GaugeResponse {
string name = 1;
oneof value {
@@ -43,11 +47,18 @@ message GaugeResponse {
}
}
-message GaugeRequest { string name = 1; }
+// Request message containing the gauge name
+message GaugeRequest {
+ string name = 1;
+}
message EmptyMessage {}
service MetricsService {
+ // Returns the values of all the gauges that are currently being maintained by
+ // the service
rpc GetAllGauges(EmptyMessage) returns (stream GaugeResponse);
+
+ // Returns the value of one gauge
rpc GetGauge(GaugeRequest) returns (GaugeResponse);
}
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
index 851389a261..6ecdcf7222 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
@@ -254,7 +254,7 @@ cdef class ByteBuffer:
if self.c_byte_buffer != NULL:
with nogil:
grpc_byte_buffer_reader_init(&reader, self.c_byte_buffer)
- result = b""
+ result = bytearray()
with nogil:
while grpc_byte_buffer_reader_next(&reader, &data_slice):
data_slice_pointer = gpr_slice_start_ptr(data_slice)
@@ -263,7 +263,7 @@ cdef class ByteBuffer:
result += (<char *>data_slice_pointer)[:data_slice_length]
with nogil:
grpc_byte_buffer_reader_destroy(&reader)
- return result
+ return bytes(result)
else:
return None
diff --git a/src/python/grpcio/grpc/_links/service.py b/src/python/grpcio/grpc/_links/service.py
index 01edee6896..e0f26a5b0f 100644
--- a/src/python/grpcio/grpc/_links/service.py
+++ b/src/python/grpcio/grpc/_links/service.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -177,7 +177,7 @@ class _Kernel(object):
call = service_acceptance.call
call.accept(self._completion_queue, call)
try:
- group, method = service_acceptance.method.split('/')[1:3]
+ group, method = service_acceptance.method.split(b'/')[1:3]
except ValueError:
logging.info('Illegal path "%s"!', service_acceptance.method)
return
diff --git a/src/python/grpcio/grpc/beta/_server.py b/src/python/grpcio/grpc/beta/_server.py
index 2b520cc7e5..12d16e6c18 100644
--- a/src/python/grpcio/grpc/beta/_server.py
+++ b/src/python/grpcio/grpc/beta/_server.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -62,7 +62,7 @@ class _GRPCServicer(base.Servicer):
if e.code is None and e.details is None:
raise base.NoSuchMethodError(
interfaces.StatusCode.UNIMPLEMENTED,
- b'Method "%s" of service "%s" not implemented!' % (method, group))
+ 'Method "%s" of service "%s" not implemented!' % (method, group))
else:
raise
diff --git a/src/python/grpcio/grpc/framework/alpha/_face_utilities.py b/src/python/grpcio/grpc/framework/alpha/_face_utilities.py
index c97307df16..b5e4133cad 100644
--- a/src/python/grpcio/grpc/framework/alpha/_face_utilities.py
+++ b/src/python/grpcio/grpc/framework/alpha/_face_utilities.py
@@ -111,7 +111,7 @@ def break_down_invocation(service_name, method_descriptions):
face_cardinalities = {}
request_serializers = {}
response_deserializers = {}
- for name, method_description in method_descriptions.iteritems():
+ for name, method_description in six.iteritems(method_descriptions):
qualified_name = _qualified_name(service_name, name)
method_cardinality = method_description.cardinality()
cardinalities[name] = method_description.cardinality()
@@ -139,7 +139,7 @@ def break_down_service(service_name, method_descriptions):
implementations = {}
request_deserializers = {}
response_serializers = {}
- for name, method_description in method_descriptions.iteritems():
+ for name, method_description in six.iteritems(method_descriptions):
qualified_name = _qualified_name(service_name, name)
method_cardinality = method_description.cardinality()
if method_cardinality is interfaces.Cardinality.UNARY_UNARY:
diff --git a/src/python/grpcio/grpc/framework/alpha/_reexport.py b/src/python/grpcio/grpc/framework/alpha/_reexport.py
index 198cb95ad5..4ea0e94d80 100644
--- a/src/python/grpcio/grpc/framework/alpha/_reexport.py
+++ b/src/python/grpcio/grpc/framework/alpha/_reexport.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -27,6 +27,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+import six
+
from grpc.framework.common import cardinality
from grpc.framework.face import exceptions as face_exceptions
from grpc.framework.face import interfaces as face_interfaces
@@ -181,7 +183,7 @@ def common_cardinality(early_adopter_cardinality):
def common_cardinalities(early_adopter_cardinalities):
common_cardinalities = {}
- for name, early_adopter_cardinality in early_adopter_cardinalities.iteritems():
+ for name, early_adopter_cardinality in six.iteritems(early_adopter_cardinalities):
common_cardinalities[name] = _EARLY_ADOPTER_CARDINALITY_TO_COMMON_CARDINALITY[
early_adopter_cardinality]
return common_cardinalities
diff --git a/src/python/grpcio/grpc/framework/crust/implementations.py b/src/python/grpcio/grpc/framework/crust/implementations.py
index 4ebc4e9ae8..d0ecafcaf6 100644
--- a/src/python/grpcio/grpc/framework/crust/implementations.py
+++ b/src/python/grpcio/grpc/framework/crust/implementations.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,8 @@
"""Entry points into the Crust layer of RPC Framework."""
+import six
+
from grpc.framework.common import cardinality
from grpc.framework.common import style
from grpc.framework.crust import _calls
@@ -271,7 +273,7 @@ class _DynamicStub(face.DynamicStub):
def _adapt_method_implementations(method_implementations, pool):
adapted_implementations = {}
- for name, method_implementation in method_implementations.iteritems():
+ for name, method_implementation in six.iteritems(method_implementations):
if method_implementation.style is style.Service.INLINE:
if method_implementation.cardinality is cardinality.Cardinality.UNARY_UNARY:
adapted_implementations[name] = _service.adapt_inline_unary_unary(
diff --git a/src/python/grpcio/grpc/framework/face/implementations.py b/src/python/grpcio/grpc/framework/face/implementations.py
index 4a6de52974..9c75a5faf4 100644
--- a/src/python/grpcio/grpc/framework/face/implementations.py
+++ b/src/python/grpcio/grpc/framework/face/implementations.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -29,6 +29,8 @@
"""Entry points into the Face layer of RPC Framework."""
+import six
+
from grpc.framework.common import cardinality
from grpc.framework.common import style
from grpc.framework.base import exceptions as _base_exceptions
@@ -228,7 +230,7 @@ class _DynamicStub(interfaces.DynamicStub):
def _adapt_method_implementations(method_implementations, pool):
adapted_implementations = {}
- for name, method_implementation in method_implementations.iteritems():
+ for name, method_implementation in six.iteritems(method_implementations):
if method_implementation.style is style.Service.INLINE:
if method_implementation.cardinality is cardinality.Cardinality.UNARY_UNARY:
adapted_implementations[name] = _service.adapt_inline_value_in_value_out(
diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py
index b9e7d8c898..a5bc18af5e 100644
--- a/src/python/grpcio/grpc_core_dependencies.py
+++ b/src/python/grpcio/grpc_core_dependencies.py
@@ -30,210 +30,211 @@
# AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_core_dependencies.py.template`!!!
CORE_SOURCE_FILES = [
- 'src/core/profiling/basic_timers.c',
- 'src/core/profiling/stap_timers.c',
- 'src/core/support/alloc.c',
- 'src/core/support/avl.c',
- 'src/core/support/backoff.c',
- 'src/core/support/cmdline.c',
- 'src/core/support/cpu_iphone.c',
- 'src/core/support/cpu_linux.c',
- 'src/core/support/cpu_posix.c',
- 'src/core/support/cpu_windows.c',
- 'src/core/support/env_linux.c',
- 'src/core/support/env_posix.c',
- 'src/core/support/env_win32.c',
- 'src/core/support/histogram.c',
- 'src/core/support/host_port.c',
- 'src/core/support/load_file.c',
- 'src/core/support/log.c',
- 'src/core/support/log_android.c',
- 'src/core/support/log_linux.c',
- 'src/core/support/log_posix.c',
- 'src/core/support/log_win32.c',
- 'src/core/support/murmur_hash.c',
- 'src/core/support/slice.c',
- 'src/core/support/slice_buffer.c',
- 'src/core/support/stack_lockfree.c',
- 'src/core/support/string.c',
- 'src/core/support/string_posix.c',
- 'src/core/support/string_win32.c',
- 'src/core/support/subprocess_posix.c',
- 'src/core/support/subprocess_windows.c',
- 'src/core/support/sync.c',
- 'src/core/support/sync_posix.c',
- 'src/core/support/sync_win32.c',
- 'src/core/support/thd.c',
- 'src/core/support/thd_posix.c',
- 'src/core/support/thd_win32.c',
- 'src/core/support/time.c',
- 'src/core/support/time_posix.c',
- 'src/core/support/time_precise.c',
- 'src/core/support/time_win32.c',
- 'src/core/support/tls_pthread.c',
- 'src/core/support/tmpfile_posix.c',
- 'src/core/support/tmpfile_win32.c',
- 'src/core/support/wrap_memcpy.c',
- 'src/core/census/grpc_context.c',
- 'src/core/census/grpc_filter.c',
- 'src/core/census/grpc_plugin.c',
- 'src/core/channel/channel_args.c',
- 'src/core/channel/channel_stack.c',
- 'src/core/channel/channel_stack_builder.c',
- 'src/core/channel/client_channel.c',
- 'src/core/channel/client_uchannel.c',
- 'src/core/channel/compress_filter.c',
- 'src/core/channel/connected_channel.c',
- 'src/core/channel/http_client_filter.c',
- 'src/core/channel/http_server_filter.c',
- 'src/core/channel/subchannel_call_holder.c',
- 'src/core/client_config/client_config.c',
- 'src/core/client_config/connector.c',
- 'src/core/client_config/default_initial_connect_string.c',
- 'src/core/client_config/initial_connect_string.c',
- 'src/core/client_config/lb_policies/load_balancer_api.c',
- 'src/core/client_config/lb_policies/pick_first.c',
- 'src/core/client_config/lb_policies/round_robin.c',
- 'src/core/client_config/lb_policy.c',
- 'src/core/client_config/lb_policy_factory.c',
- 'src/core/client_config/lb_policy_registry.c',
- 'src/core/client_config/resolver.c',
- 'src/core/client_config/resolver_factory.c',
- 'src/core/client_config/resolver_registry.c',
- 'src/core/client_config/resolvers/dns_resolver.c',
- 'src/core/client_config/resolvers/sockaddr_resolver.c',
- 'src/core/client_config/subchannel.c',
- 'src/core/client_config/subchannel_factory.c',
- 'src/core/client_config/subchannel_index.c',
- 'src/core/client_config/uri_parser.c',
- 'src/core/compression/compression_algorithm.c',
- 'src/core/compression/message_compress.c',
- 'src/core/debug/trace.c',
- 'src/core/httpcli/format_request.c',
- 'src/core/httpcli/httpcli.c',
- 'src/core/httpcli/parser.c',
- 'src/core/iomgr/closure.c',
- 'src/core/iomgr/endpoint.c',
- 'src/core/iomgr/endpoint_pair_posix.c',
- 'src/core/iomgr/endpoint_pair_windows.c',
- 'src/core/iomgr/exec_ctx.c',
- 'src/core/iomgr/executor.c',
- 'src/core/iomgr/fd_posix.c',
- 'src/core/iomgr/iocp_windows.c',
- 'src/core/iomgr/iomgr.c',
- 'src/core/iomgr/iomgr_posix.c',
- 'src/core/iomgr/iomgr_windows.c',
- 'src/core/iomgr/pollset_multipoller_with_epoll.c',
- 'src/core/iomgr/pollset_multipoller_with_poll_posix.c',
- 'src/core/iomgr/pollset_posix.c',
- 'src/core/iomgr/pollset_set_posix.c',
- 'src/core/iomgr/pollset_set_windows.c',
- 'src/core/iomgr/pollset_windows.c',
- 'src/core/iomgr/resolve_address_posix.c',
- 'src/core/iomgr/resolve_address_windows.c',
- 'src/core/iomgr/sockaddr_utils.c',
- 'src/core/iomgr/socket_utils_common_posix.c',
- 'src/core/iomgr/socket_utils_linux.c',
- 'src/core/iomgr/socket_utils_posix.c',
- 'src/core/iomgr/socket_windows.c',
- 'src/core/iomgr/tcp_client_posix.c',
- 'src/core/iomgr/tcp_client_windows.c',
- 'src/core/iomgr/tcp_posix.c',
- 'src/core/iomgr/tcp_server_posix.c',
- 'src/core/iomgr/tcp_server_windows.c',
- 'src/core/iomgr/tcp_windows.c',
- 'src/core/iomgr/time_averaged_stats.c',
- 'src/core/iomgr/timer.c',
- 'src/core/iomgr/timer_heap.c',
- 'src/core/iomgr/udp_server.c',
- 'src/core/iomgr/wakeup_fd_eventfd.c',
- 'src/core/iomgr/wakeup_fd_nospecial.c',
- 'src/core/iomgr/wakeup_fd_pipe.c',
- 'src/core/iomgr/wakeup_fd_posix.c',
- 'src/core/iomgr/workqueue_posix.c',
- 'src/core/iomgr/workqueue_windows.c',
- 'src/core/json/json.c',
- 'src/core/json/json_reader.c',
- 'src/core/json/json_string.c',
- 'src/core/json/json_writer.c',
- 'src/core/proto/grpc/lb/v0/load_balancer.pb.c',
- 'src/core/surface/alarm.c',
- 'src/core/surface/api_trace.c',
- 'src/core/surface/byte_buffer.c',
- 'src/core/surface/byte_buffer_reader.c',
- 'src/core/surface/call.c',
- 'src/core/surface/call_details.c',
- 'src/core/surface/call_log_batch.c',
- 'src/core/surface/channel.c',
- 'src/core/surface/channel_connectivity.c',
- 'src/core/surface/channel_create.c',
- 'src/core/surface/channel_init.c',
- 'src/core/surface/channel_ping.c',
- 'src/core/surface/channel_stack_type.c',
- 'src/core/surface/completion_queue.c',
- 'src/core/surface/event_string.c',
- 'src/core/surface/init.c',
- 'src/core/surface/lame_client.c',
- 'src/core/surface/metadata_array.c',
- 'src/core/surface/server.c',
- 'src/core/surface/server_chttp2.c',
- 'src/core/surface/validate_metadata.c',
- 'src/core/surface/version.c',
- 'src/core/transport/byte_stream.c',
- 'src/core/transport/chttp2/alpn.c',
- 'src/core/transport/chttp2/bin_encoder.c',
- 'src/core/transport/chttp2/frame_data.c',
- 'src/core/transport/chttp2/frame_goaway.c',
- 'src/core/transport/chttp2/frame_ping.c',
- 'src/core/transport/chttp2/frame_rst_stream.c',
- 'src/core/transport/chttp2/frame_settings.c',
- 'src/core/transport/chttp2/frame_window_update.c',
- 'src/core/transport/chttp2/hpack_encoder.c',
- 'src/core/transport/chttp2/hpack_parser.c',
- 'src/core/transport/chttp2/hpack_table.c',
- 'src/core/transport/chttp2/huffsyms.c',
- 'src/core/transport/chttp2/incoming_metadata.c',
- 'src/core/transport/chttp2/parsing.c',
- 'src/core/transport/chttp2/status_conversion.c',
- 'src/core/transport/chttp2/stream_lists.c',
- 'src/core/transport/chttp2/stream_map.c',
- 'src/core/transport/chttp2/timeout_encoding.c',
- 'src/core/transport/chttp2/varint.c',
- 'src/core/transport/chttp2/writing.c',
- 'src/core/transport/chttp2_transport.c',
- 'src/core/transport/connectivity_state.c',
- 'src/core/transport/metadata.c',
- 'src/core/transport/metadata_batch.c',
- 'src/core/transport/static_metadata.c',
- 'src/core/transport/transport.c',
- 'src/core/transport/transport_op_string.c',
- 'src/core/httpcli/httpcli_security_connector.c',
- 'src/core/security/b64.c',
- 'src/core/security/client_auth_filter.c',
- 'src/core/security/credentials.c',
- 'src/core/security/credentials_metadata.c',
- 'src/core/security/credentials_posix.c',
- 'src/core/security/credentials_win32.c',
- 'src/core/security/google_default_credentials.c',
- 'src/core/security/handshake.c',
- 'src/core/security/json_token.c',
- 'src/core/security/jwt_verifier.c',
- 'src/core/security/secure_endpoint.c',
- 'src/core/security/security_connector.c',
- 'src/core/security/security_context.c',
- 'src/core/security/server_auth_filter.c',
- 'src/core/security/server_secure_chttp2.c',
- 'src/core/surface/init_secure.c',
- 'src/core/surface/secure_channel_create.c',
- 'src/core/tsi/fake_transport_security.c',
- 'src/core/tsi/ssl_transport_security.c',
- 'src/core/tsi/transport_security.c',
- 'src/core/census/context.c',
- 'src/core/census/initialize.c',
- 'src/core/census/mlog.c',
- 'src/core/census/operation.c',
- 'src/core/census/placeholders.c',
- 'src/core/census/tracing.c',
+ 'src/core/lib/profiling/basic_timers.c',
+ 'src/core/lib/profiling/stap_timers.c',
+ 'src/core/lib/support/alloc.c',
+ 'src/core/lib/support/avl.c',
+ 'src/core/lib/support/backoff.c',
+ 'src/core/lib/support/cmdline.c',
+ 'src/core/lib/support/cpu_iphone.c',
+ 'src/core/lib/support/cpu_linux.c',
+ 'src/core/lib/support/cpu_posix.c',
+ 'src/core/lib/support/cpu_windows.c',
+ 'src/core/lib/support/env_linux.c',
+ 'src/core/lib/support/env_posix.c',
+ 'src/core/lib/support/env_win32.c',
+ 'src/core/lib/support/histogram.c',
+ 'src/core/lib/support/host_port.c',
+ 'src/core/lib/support/load_file.c',
+ 'src/core/lib/support/log.c',
+ 'src/core/lib/support/log_android.c',
+ 'src/core/lib/support/log_linux.c',
+ 'src/core/lib/support/log_posix.c',
+ 'src/core/lib/support/log_win32.c',
+ 'src/core/lib/support/murmur_hash.c',
+ 'src/core/lib/support/slice.c',
+ 'src/core/lib/support/slice_buffer.c',
+ 'src/core/lib/support/stack_lockfree.c',
+ 'src/core/lib/support/string.c',
+ 'src/core/lib/support/string_posix.c',
+ 'src/core/lib/support/string_win32.c',
+ 'src/core/lib/support/subprocess_posix.c',
+ 'src/core/lib/support/subprocess_windows.c',
+ 'src/core/lib/support/sync.c',
+ 'src/core/lib/support/sync_posix.c',
+ 'src/core/lib/support/sync_win32.c',
+ 'src/core/lib/support/thd.c',
+ 'src/core/lib/support/thd_posix.c',
+ 'src/core/lib/support/thd_win32.c',
+ 'src/core/lib/support/time.c',
+ 'src/core/lib/support/time_posix.c',
+ 'src/core/lib/support/time_precise.c',
+ 'src/core/lib/support/time_win32.c',
+ 'src/core/lib/support/tls_pthread.c',
+ 'src/core/lib/support/tmpfile_posix.c',
+ 'src/core/lib/support/tmpfile_win32.c',
+ 'src/core/lib/support/wrap_memcpy.c',
+ 'src/core/lib/census/grpc_context.c',
+ 'src/core/lib/census/grpc_filter.c',
+ 'src/core/lib/census/grpc_plugin.c',
+ 'src/core/lib/channel/channel_args.c',
+ 'src/core/lib/channel/channel_stack.c',
+ 'src/core/lib/channel/channel_stack_builder.c',
+ 'src/core/lib/channel/client_channel.c',
+ 'src/core/lib/channel/compress_filter.c',
+ 'src/core/lib/channel/connected_channel.c',
+ 'src/core/lib/channel/http_client_filter.c',
+ 'src/core/lib/channel/http_server_filter.c',
+ 'src/core/lib/channel/subchannel_call_holder.c',
+ 'src/core/lib/client_config/client_config.c',
+ 'src/core/lib/client_config/connector.c',
+ 'src/core/lib/client_config/default_initial_connect_string.c',
+ 'src/core/lib/client_config/initial_connect_string.c',
+ 'src/core/lib/client_config/lb_policies/load_balancer_api.c',
+ 'src/core/lib/client_config/lb_policies/pick_first.c',
+ 'src/core/lib/client_config/lb_policies/round_robin.c',
+ 'src/core/lib/client_config/lb_policy.c',
+ 'src/core/lib/client_config/lb_policy_factory.c',
+ 'src/core/lib/client_config/lb_policy_registry.c',
+ 'src/core/lib/client_config/resolver.c',
+ 'src/core/lib/client_config/resolver_factory.c',
+ 'src/core/lib/client_config/resolver_registry.c',
+ 'src/core/lib/client_config/resolvers/dns_resolver.c',
+ 'src/core/lib/client_config/resolvers/sockaddr_resolver.c',
+ 'src/core/lib/client_config/subchannel.c',
+ 'src/core/lib/client_config/subchannel_factory.c',
+ 'src/core/lib/client_config/subchannel_index.c',
+ 'src/core/lib/client_config/uri_parser.c',
+ 'src/core/lib/compression/compression_algorithm.c',
+ 'src/core/lib/compression/message_compress.c',
+ 'src/core/lib/debug/trace.c',
+ 'src/core/lib/http/format_request.c',
+ 'src/core/lib/http/httpcli.c',
+ 'src/core/lib/http/parser.c',
+ 'src/core/lib/iomgr/closure.c',
+ 'src/core/lib/iomgr/endpoint.c',
+ 'src/core/lib/iomgr/endpoint_pair_posix.c',
+ 'src/core/lib/iomgr/endpoint_pair_windows.c',
+ 'src/core/lib/iomgr/exec_ctx.c',
+ 'src/core/lib/iomgr/executor.c',
+ 'src/core/lib/iomgr/fd_posix.c',
+ 'src/core/lib/iomgr/iocp_windows.c',
+ 'src/core/lib/iomgr/iomgr.c',
+ 'src/core/lib/iomgr/iomgr_posix.c',
+ 'src/core/lib/iomgr/iomgr_windows.c',
+ 'src/core/lib/iomgr/pollset_multipoller_with_epoll.c',
+ 'src/core/lib/iomgr/pollset_multipoller_with_poll_posix.c',
+ 'src/core/lib/iomgr/pollset_posix.c',
+ 'src/core/lib/iomgr/pollset_set_posix.c',
+ 'src/core/lib/iomgr/pollset_set_windows.c',
+ 'src/core/lib/iomgr/pollset_windows.c',
+ 'src/core/lib/iomgr/resolve_address_posix.c',
+ 'src/core/lib/iomgr/resolve_address_windows.c',
+ 'src/core/lib/iomgr/sockaddr_utils.c',
+ 'src/core/lib/iomgr/socket_utils_common_posix.c',
+ 'src/core/lib/iomgr/socket_utils_linux.c',
+ 'src/core/lib/iomgr/socket_utils_posix.c',
+ 'src/core/lib/iomgr/socket_windows.c',
+ 'src/core/lib/iomgr/tcp_client_posix.c',
+ 'src/core/lib/iomgr/tcp_client_windows.c',
+ 'src/core/lib/iomgr/tcp_posix.c',
+ 'src/core/lib/iomgr/tcp_server_posix.c',
+ 'src/core/lib/iomgr/tcp_server_windows.c',
+ 'src/core/lib/iomgr/tcp_windows.c',
+ 'src/core/lib/iomgr/time_averaged_stats.c',
+ 'src/core/lib/iomgr/timer.c',
+ 'src/core/lib/iomgr/timer_heap.c',
+ 'src/core/lib/iomgr/udp_server.c',
+ 'src/core/lib/iomgr/unix_sockets_posix.c',
+ 'src/core/lib/iomgr/unix_sockets_posix_noop.c',
+ 'src/core/lib/iomgr/wakeup_fd_eventfd.c',
+ 'src/core/lib/iomgr/wakeup_fd_nospecial.c',
+ 'src/core/lib/iomgr/wakeup_fd_pipe.c',
+ 'src/core/lib/iomgr/wakeup_fd_posix.c',
+ 'src/core/lib/iomgr/workqueue_posix.c',
+ 'src/core/lib/iomgr/workqueue_windows.c',
+ 'src/core/lib/json/json.c',
+ 'src/core/lib/json/json_reader.c',
+ 'src/core/lib/json/json_string.c',
+ 'src/core/lib/json/json_writer.c',
+ 'src/core/lib/proto/grpc/lb/v0/load_balancer.pb.c',
+ 'src/core/lib/surface/alarm.c',
+ 'src/core/lib/surface/api_trace.c',
+ 'src/core/lib/surface/byte_buffer.c',
+ 'src/core/lib/surface/byte_buffer_reader.c',
+ 'src/core/lib/surface/call.c',
+ 'src/core/lib/surface/call_details.c',
+ 'src/core/lib/surface/call_log_batch.c',
+ 'src/core/lib/surface/channel.c',
+ 'src/core/lib/surface/channel_connectivity.c',
+ 'src/core/lib/surface/channel_create.c',
+ 'src/core/lib/surface/channel_init.c',
+ 'src/core/lib/surface/channel_ping.c',
+ 'src/core/lib/surface/channel_stack_type.c',
+ 'src/core/lib/surface/completion_queue.c',
+ 'src/core/lib/surface/event_string.c',
+ 'src/core/lib/surface/init.c',
+ 'src/core/lib/surface/lame_client.c',
+ 'src/core/lib/surface/metadata_array.c',
+ 'src/core/lib/surface/server.c',
+ 'src/core/lib/surface/server_chttp2.c',
+ 'src/core/lib/surface/validate_metadata.c',
+ 'src/core/lib/surface/version.c',
+ 'src/core/lib/transport/byte_stream.c',
+ 'src/core/lib/transport/chttp2/alpn.c',
+ 'src/core/lib/transport/chttp2/bin_encoder.c',
+ 'src/core/lib/transport/chttp2/frame_data.c',
+ 'src/core/lib/transport/chttp2/frame_goaway.c',
+ 'src/core/lib/transport/chttp2/frame_ping.c',
+ 'src/core/lib/transport/chttp2/frame_rst_stream.c',
+ 'src/core/lib/transport/chttp2/frame_settings.c',
+ 'src/core/lib/transport/chttp2/frame_window_update.c',
+ 'src/core/lib/transport/chttp2/hpack_encoder.c',
+ 'src/core/lib/transport/chttp2/hpack_parser.c',
+ 'src/core/lib/transport/chttp2/hpack_table.c',
+ 'src/core/lib/transport/chttp2/huffsyms.c',
+ 'src/core/lib/transport/chttp2/incoming_metadata.c',
+ 'src/core/lib/transport/chttp2/parsing.c',
+ 'src/core/lib/transport/chttp2/status_conversion.c',
+ 'src/core/lib/transport/chttp2/stream_lists.c',
+ 'src/core/lib/transport/chttp2/stream_map.c',
+ 'src/core/lib/transport/chttp2/timeout_encoding.c',
+ 'src/core/lib/transport/chttp2/varint.c',
+ 'src/core/lib/transport/chttp2/writing.c',
+ 'src/core/lib/transport/chttp2_transport.c',
+ 'src/core/lib/transport/connectivity_state.c',
+ 'src/core/lib/transport/metadata.c',
+ 'src/core/lib/transport/metadata_batch.c',
+ 'src/core/lib/transport/static_metadata.c',
+ 'src/core/lib/transport/transport.c',
+ 'src/core/lib/transport/transport_op_string.c',
+ 'src/core/lib/http/httpcli_security_connector.c',
+ 'src/core/lib/security/b64.c',
+ 'src/core/lib/security/client_auth_filter.c',
+ 'src/core/lib/security/credentials.c',
+ 'src/core/lib/security/credentials_metadata.c',
+ 'src/core/lib/security/credentials_posix.c',
+ 'src/core/lib/security/credentials_win32.c',
+ 'src/core/lib/security/google_default_credentials.c',
+ 'src/core/lib/security/handshake.c',
+ 'src/core/lib/security/json_token.c',
+ 'src/core/lib/security/jwt_verifier.c',
+ 'src/core/lib/security/secure_endpoint.c',
+ 'src/core/lib/security/security_connector.c',
+ 'src/core/lib/security/security_context.c',
+ 'src/core/lib/security/server_auth_filter.c',
+ 'src/core/lib/security/server_secure_chttp2.c',
+ 'src/core/lib/surface/init_secure.c',
+ 'src/core/lib/surface/secure_channel_create.c',
+ 'src/core/lib/tsi/fake_transport_security.c',
+ 'src/core/lib/tsi/ssl_transport_security.c',
+ 'src/core/lib/tsi/transport_security.c',
+ 'src/core/lib/census/context.c',
+ 'src/core/lib/census/initialize.c',
+ 'src/core/lib/census/mlog.c',
+ 'src/core/lib/census/operation.c',
+ 'src/core/lib/census/placeholders.c',
+ 'src/core/lib/census/tracing.c',
'third_party/nanopb/pb_common.c',
'third_party/nanopb/pb_decode.c',
'third_party/nanopb/pb_encode.c',
diff --git a/src/python/grpcio/tests/__init__.py b/src/python/grpcio/tests/__init__.py
index b76b3985a1..c3b80d766d 100644
--- a/src/python/grpcio/tests/__init__.py
+++ b/src/python/grpcio/tests/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -27,6 +27,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import absolute_import
+
from tests import _loader
from tests import _runner
diff --git a/src/python/grpcio/tests/_loader.py b/src/python/grpcio/tests/_loader.py
index 6992029b5e..2f9e5c660e 100644
--- a/src/python/grpcio/tests/_loader.py
+++ b/src/python/grpcio/tests/_loader.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -27,6 +27,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+from __future__ import absolute_import
+
import importlib
import pkgutil
import re
diff --git a/src/python/grpcio/tests/_result.py b/src/python/grpcio/tests/_result.py
index 0670be921f..18b0f43963 100644
--- a/src/python/grpcio/tests/_result.py
+++ b/src/python/grpcio/tests/_result.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import cStringIO as StringIO
+from __future__ import absolute_import
+
import collections
import itertools
import traceback
@@ -35,6 +36,7 @@ import unittest
from xml.etree import ElementTree
import coverage
+from six import moves
from tests import _loader
@@ -202,7 +204,7 @@ class AugmentedResult(unittest.TestResult):
"""
case_id = self.id_map(test)
self.cases[case_id] = self.cases[case_id].updated(
- stdout=stdout, stderr=stderr)
+ stdout=stdout.decode(), stderr=stderr.decode())
def augmented_results(self, filter):
"""Convenience method to retrieve filtered case results.
@@ -356,7 +358,7 @@ def _traceback_string(type, value, trace):
Returns:
str: Formatted exception descriptive string.
"""
- buffer = StringIO.StringIO()
+ buffer = moves.cStringIO()
traceback.print_exception(type, value, trace, file=buffer)
return buffer.getvalue()
diff --git a/src/python/grpcio/tests/_runner.py b/src/python/grpcio/tests/_runner.py
index 3b5ca03dd9..173a170409 100644
--- a/src/python/grpcio/tests/_runner.py
+++ b/src/python/grpcio/tests/_runner.py
@@ -27,7 +27,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-import cStringIO as StringIO
+from __future__ import absolute_import
+
import collections
import fcntl
import multiprocessing
@@ -41,6 +42,9 @@ import time
import unittest
import uuid
+import six
+from six import moves
+
from tests import _loader
from tests import _result
@@ -92,6 +96,8 @@ class CaptureFile(object):
Arguments:
value (str): What to write to the original file.
"""
+ if six.PY3 and not isinstance(value, six.binary_type):
+ value = bytes(value, 'ascii')
if self._saved_fd is None:
os.write(self._redirect_fd, value)
else:
@@ -143,7 +149,7 @@ class Runner(object):
for case in filtered_cases]
case_id_by_case = dict((augmented_case.case, augmented_case.id)
for augmented_case in augmented_cases)
- result_out = StringIO.StringIO()
+ result_out = moves.cStringIO()
result = _result.TerminalResult(
result_out, id_map=lambda case: case_id_by_case[case])
stdout_pipe = CaptureFile(sys.stdout.fileno())
@@ -168,9 +174,9 @@ class Runner(object):
result.stopTestRun()
stdout_pipe.write_bypass(result_out.getvalue())
stdout_pipe.write_bypass(
- '\ninterrupted stdout:\n{}\n'.format(stdout_pipe.output()))
+ '\ninterrupted stdout:\n{}\n'.format(stdout_pipe.output().decode()))
stderr_pipe.write_bypass(
- '\ninterrupted stderr:\n{}\n'.format(stderr_pipe.output()))
+ '\ninterrupted stderr:\n{}\n'.format(stderr_pipe.output().decode()))
os._exit(1)
signal.signal(signal.SIGINT, sigint_handler)
signal.signal(signal.SIGSEGV, fault_handler)
@@ -213,7 +219,7 @@ class Runner(object):
sys.stdout.write(result_out.getvalue())
sys.stdout.flush()
signal.signal(signal.SIGINT, signal.SIG_DFL)
- with open('report.xml', 'w') as report_xml_file:
+ with open('report.xml', 'wb') as report_xml_file:
_result.jenkins_junit_xml(result).write(report_xml_file)
return result
diff --git a/src/python/grpcio/tests/interop/methods.py b/src/python/grpcio/tests/interop/methods.py
index 1f5561c1f0..7f42b4a005 100644
--- a/src/python/grpcio/tests/interop/methods.py
+++ b/src/python/grpcio/tests/interop/methods.py
@@ -29,6 +29,8 @@
"""Implementations of interoperability test methods."""
+from __future__ import print_function
+
import enum
import json
import os
@@ -208,7 +210,7 @@ def _ping_pong(stub):
with stub, _Pipe() as pipe:
response_iterator = stub.FullDuplexCall(pipe, _TIMEOUT)
- print 'Starting ping-pong with response iterator %s' % response_iterator
+ print('Starting ping-pong with response iterator %s' % response_iterator)
for response_size, payload_size in zip(
request_response_sizes, request_payload_sizes):
request = messages_pb2.StreamingOutputCallRequest(
diff --git a/src/python/grpcio/tests/protoc_plugin/beta_python_plugin_test.py b/src/python/grpcio/tests/protoc_plugin/beta_python_plugin_test.py
index ba5b219a88..230ec6487d 100644
--- a/src/python/grpcio/tests/protoc_plugin/beta_python_plugin_test.py
+++ b/src/python/grpcio/tests/protoc_plugin/beta_python_plugin_test.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -42,6 +42,8 @@ import threading
import time
import unittest
+from six import moves
+
from grpc.beta import implementations
from grpc.framework.foundation import future
from grpc.framework.interfaces.face import face
@@ -250,7 +252,7 @@ class PythonPluginTest(unittest.TestCase):
def testImportAttributes(self):
# check that we can access the generated module and its members.
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
self.assertIsNotNone(getattr(test_pb2, SERVICER_IDENTIFIER, None))
self.assertIsNotNone(getattr(test_pb2, STUB_IDENTIFIER, None))
self.assertIsNotNone(getattr(test_pb2, SERVER_FACTORY_IDENTIFIER, None))
@@ -258,13 +260,13 @@ class PythonPluginTest(unittest.TestCase):
def testUpDown(self):
import protoc_plugin_test_pb2 as test_pb2
- reload(test_pb2)
+ moves.reload_module(test_pb2)
with _CreateService(test_pb2) as (servicer, stub):
request = test_pb2.SimpleRequest(response_size=13)
def testUnaryCall(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
request = test_pb2.SimpleRequest(response_size=13)
response = stub.UnaryCall(request, test_constants.LONG_TIMEOUT)
@@ -273,7 +275,7 @@ class PythonPluginTest(unittest.TestCase):
def testUnaryCallFuture(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
request = test_pb2.SimpleRequest(response_size=13)
with _CreateService(test_pb2) as (methods, stub):
# Check that the call does not block waiting for the server to respond.
@@ -286,7 +288,7 @@ class PythonPluginTest(unittest.TestCase):
def testUnaryCallFutureExpired(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
request = test_pb2.SimpleRequest(response_size=13)
with methods.pause():
@@ -297,7 +299,7 @@ class PythonPluginTest(unittest.TestCase):
def testUnaryCallFutureCancelled(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
request = test_pb2.SimpleRequest(response_size=13)
with _CreateService(test_pb2) as (methods, stub):
with methods.pause():
@@ -307,7 +309,7 @@ class PythonPluginTest(unittest.TestCase):
def testUnaryCallFutureFailed(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
request = test_pb2.SimpleRequest(response_size=13)
with _CreateService(test_pb2) as (methods, stub):
with methods.fail():
@@ -317,20 +319,20 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingOutputCall(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
request = _streaming_output_request(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
responses = stub.StreamingOutputCall(
request, test_constants.LONG_TIMEOUT)
expected_responses = methods.StreamingOutputCall(
request, 'not a real RpcContext!')
- for expected_response, response in itertools.izip_longest(
+ for expected_response, response in moves.zip_longest(
expected_responses, responses):
self.assertEqual(expected_response, response)
def testStreamingOutputCallExpired(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
request = _streaming_output_request(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
with methods.pause():
@@ -341,7 +343,7 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingOutputCallCancelled(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
request = _streaming_output_request(test_pb2)
with _CreateService(test_pb2) as (unused_methods, stub):
responses = stub.StreamingOutputCall(
@@ -353,7 +355,7 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingOutputCallFailed(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
request = _streaming_output_request(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
with methods.fail():
@@ -364,7 +366,7 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingInputCall(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
response = stub.StreamingInputCall(
_streaming_input_request_iterator(test_pb2),
@@ -375,7 +377,7 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingInputCallFuture(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
with methods.pause():
response_future = stub.StreamingInputCall.future(
@@ -388,7 +390,7 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingInputCallFutureExpired(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
with methods.pause():
response_future = stub.StreamingInputCall.future(
@@ -401,7 +403,7 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingInputCallFutureCancelled(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
with methods.pause():
response_future = stub.StreamingInputCall.future(
@@ -414,7 +416,7 @@ class PythonPluginTest(unittest.TestCase):
def testStreamingInputCallFutureFailed(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
with methods.fail():
response_future = stub.StreamingInputCall.future(
@@ -424,19 +426,19 @@ class PythonPluginTest(unittest.TestCase):
def testFullDuplexCall(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
responses = stub.FullDuplexCall(
_full_duplex_request_iterator(test_pb2), test_constants.LONG_TIMEOUT)
expected_responses = methods.FullDuplexCall(
_full_duplex_request_iterator(test_pb2), 'not a real RpcContext!')
- for expected_response, response in itertools.izip_longest(
+ for expected_response, response in moves.zip_longest(
expected_responses, responses):
self.assertEqual(expected_response, response)
def testFullDuplexCallExpired(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
request_iterator = _full_duplex_request_iterator(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
with methods.pause():
@@ -447,7 +449,7 @@ class PythonPluginTest(unittest.TestCase):
def testFullDuplexCallCancelled(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
request_iterator = _full_duplex_request_iterator(test_pb2)
responses = stub.FullDuplexCall(
@@ -459,7 +461,7 @@ class PythonPluginTest(unittest.TestCase):
def testFullDuplexCallFailed(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
request_iterator = _full_duplex_request_iterator(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
with methods.fail():
@@ -471,7 +473,7 @@ class PythonPluginTest(unittest.TestCase):
def testHalfDuplexCall(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
with _CreateService(test_pb2) as (methods, stub):
def half_duplex_request_iterator():
request = test_pb2.StreamingOutputCallRequest()
@@ -485,13 +487,13 @@ class PythonPluginTest(unittest.TestCase):
half_duplex_request_iterator(), test_constants.LONG_TIMEOUT)
expected_responses = methods.HalfDuplexCall(
half_duplex_request_iterator(), 'not a real RpcContext!')
- for check in itertools.izip_longest(expected_responses, responses):
+ for check in moves.zip_longest(expected_responses, responses):
expected_response, response = check
self.assertEqual(expected_response, response)
def testHalfDuplexCallWedged(self):
import protoc_plugin_test_pb2 as test_pb2 # pylint: disable=g-import-not-at-top
- reload(test_pb2)
+ moves.reload_module(test_pb2)
condition = threading.Condition()
wait_cell = [False]
@contextlib.contextmanager
diff --git a/src/python/grpcio/tests/unit/_adapter/_intermediary_low_test.py b/src/python/grpcio/tests/unit/_adapter/_intermediary_low_test.py
index a6fd82388c..06bfc34977 100644
--- a/src/python/grpcio/tests/unit/_adapter/_intermediary_low_test.py
+++ b/src/python/grpcio/tests/unit/_adapter/_intermediary_low_test.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -29,11 +29,13 @@
"""Tests for the old '_low'."""
-import Queue
import threading
import time
import unittest
+import six
+from six.moves import queue
+
from grpc._adapter import _intermediary_low as _low
_STREAM_LENGTH = 300
@@ -67,7 +69,7 @@ class LonelyClientTest(unittest.TestCase):
second_event = completion_queue.get(after_deadline)
self.assertIsNotNone(second_event)
kinds = [event.kind for event in (first_event, second_event)]
- self.assertItemsEqual(
+ six.assertCountEqual(self,
(_low.Event.Kind.METADATA_ACCEPTED, _low.Event.Kind.FINISH),
kinds)
@@ -99,7 +101,7 @@ class EchoTest(unittest.TestCase):
self.server = _low.Server(self.server_completion_queue)
port = self.server.add_http2_addr('[::]:0')
self.server.start()
- self.server_events = Queue.Queue()
+ self.server_events = queue.Queue()
self.server_completion_queue_thread = threading.Thread(
target=_drive_completion_queue,
args=(self.server_completion_queue, self.server_events))
@@ -107,7 +109,7 @@ class EchoTest(unittest.TestCase):
self.client_completion_queue = _low.CompletionQueue()
self.channel = _low.Channel('%s:%d' % (self.host, port), None)
- self.client_events = Queue.Queue()
+ self.client_events = queue.Queue()
self.client_completion_queue_thread = threading.Thread(
target=_drive_completion_queue,
args=(self.client_completion_queue, self.client_events))
@@ -315,7 +317,7 @@ class CancellationTest(unittest.TestCase):
self.server = _low.Server(self.server_completion_queue)
port = self.server.add_http2_addr('[::]:0')
self.server.start()
- self.server_events = Queue.Queue()
+ self.server_events = queue.Queue()
self.server_completion_queue_thread = threading.Thread(
target=_drive_completion_queue,
args=(self.server_completion_queue, self.server_events))
@@ -323,7 +325,7 @@ class CancellationTest(unittest.TestCase):
self.client_completion_queue = _low.CompletionQueue()
self.channel = _low.Channel('%s:%d' % (self.host, port), None)
- self.client_events = Queue.Queue()
+ self.client_events = queue.Queue()
self.client_completion_queue_thread = threading.Thread(
target=_drive_completion_queue,
args=(self.client_completion_queue, self.client_events))
diff --git a/src/python/grpcio/tests/unit/_core_over_links_base_interface_test.py b/src/python/grpcio/tests/unit/_core_over_links_base_interface_test.py
index efc990421a..881633754c 100644
--- a/src/python/grpcio/tests/unit/_core_over_links_base_interface_test.py
+++ b/src/python/grpcio/tests/unit/_core_over_links_base_interface_test.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,8 @@ import random
import time
import unittest
+import six
+
from grpc._adapter import _intermediary_low
from grpc._links import invocation
from grpc._links import service
@@ -68,7 +70,7 @@ def _serialization_behaviors_from_serializations(serializations):
request_deserializers = {}
response_serializers = {}
response_deserializers = {}
- for (group, method), serialization in serializations.iteritems():
+ for (group, method), serialization in six.iteritems(serializations):
request_serializers[group, method] = serialization.serialize_request
request_deserializers[group, method] = serialization.deserialize_request
response_serializers[group, method] = serialization.serialize_response
diff --git a/src/python/grpcio/tests/unit/_crust_over_core_over_links_face_interface_test.py b/src/python/grpcio/tests/unit/_crust_over_core_over_links_face_interface_test.py
index 4faaaadc2b..3be3b051fb 100644
--- a/src/python/grpcio/tests/unit/_crust_over_core_over_links_face_interface_test.py
+++ b/src/python/grpcio/tests/unit/_crust_over_core_over_links_face_interface_test.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -32,6 +32,8 @@
import collections
import unittest
+import six
+
from grpc._adapter import _intermediary_low
from grpc._links import invocation
from grpc._links import service
@@ -59,7 +61,7 @@ def _serialization_behaviors_from_test_methods(test_methods):
request_deserializers = {}
response_serializers = {}
response_deserializers = {}
- for (group, method), test_method in test_methods.iteritems():
+ for (group, method), test_method in six.iteritems(test_methods):
request_serializers[group, method] = test_method.serialize_request
request_deserializers[group, method] = test_method.deserialize_request
response_serializers[group, method] = test_method.serialize_response
@@ -108,7 +110,7 @@ class _Implementation(test_interfaces.Implementation):
# _digest.TestServiceDigest.
cardinalities = {
method: method_object.cardinality()
- for (group, method), method_object in methods.iteritems()}
+ for (group, method), method_object in six.iteritems(methods)}
dynamic_stub = crust_implementations.dynamic_stub(
invocation_end_link, group, cardinalities, pool)
diff --git a/src/python/grpcio/tests/unit/beta/_face_interface_test.py b/src/python/grpcio/tests/unit/beta/_face_interface_test.py
index 1c21dfd03d..cb302bbf68 100644
--- a/src/python/grpcio/tests/unit/beta/_face_interface_test.py
+++ b/src/python/grpcio/tests/unit/beta/_face_interface_test.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -32,6 +32,8 @@
import collections
import unittest
+import six
+
from grpc.beta import implementations
from grpc.beta import interfaces
from tests.unit import resources
@@ -57,7 +59,7 @@ def _serialization_behaviors_from_test_methods(test_methods):
request_deserializers = {}
response_serializers = {}
response_deserializers = {}
- for (group, method), test_method in test_methods.iteritems():
+ for (group, method), test_method in six.iteritems(test_methods):
request_serializers[group, method] = test_method.serialize_request
request_deserializers[group, method] = test_method.deserialize_request
response_serializers[group, method] = test_method.serialize_response
@@ -79,7 +81,7 @@ class _Implementation(test_interfaces.Implementation):
# _digest.TestServiceDigest.
cardinalities = {
method: method_object.cardinality()
- for (group, method), method_object in methods.iteritems()}
+ for (group, method), method_object in six.iteritems(methods)}
server_options = implementations.server_options(
request_deserializers=serialization_behaviors.request_deserializers,
diff --git a/src/python/grpcio/tests/unit/framework/_crust_over_core_face_interface_test.py b/src/python/grpcio/tests/unit/framework/_crust_over_core_face_interface_test.py
index 360ecc95d5..fd2d4298f9 100644
--- a/src/python/grpcio/tests/unit/framework/_crust_over_core_face_interface_test.py
+++ b/src/python/grpcio/tests/unit/framework/_crust_over_core_face_interface_test.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -32,6 +32,8 @@
import collections
import unittest
+import six
+
from grpc.framework.core import implementations as core_implementations
from grpc.framework.crust import implementations as crust_implementations
from grpc.framework.foundation import logging_pool
@@ -66,7 +68,7 @@ class _Implementation(test_interfaces.Implementation):
# _digest.TestServiceDigest.
cardinalities = {
method: method_object.cardinality()
- for (group, method), method_object in methods.iteritems()}
+ for (group, method), method_object in six.iteritems(methods)}
dynamic_stub = crust_implementations.dynamic_stub(
invocation_end_link, group, cardinalities, pool)
diff --git a/src/python/grpcio/tests/unit/framework/face/testing/blocking_invocation_inline_service_test_case.py b/src/python/grpcio/tests/unit/framework/face/testing/blocking_invocation_inline_service_test_case.py
index 2fc67f6292..b0b00bfa81 100644
--- a/src/python/grpcio/tests/unit/framework/face/testing/blocking_invocation_inline_service_test_case.py
+++ b/src/python/grpcio/tests/unit/framework/face/testing/blocking_invocation_inline_service_test_case.py
@@ -74,7 +74,7 @@ class BlockingInvocationInlineServiceTestCase(
def testSuccessfulUnaryRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -85,7 +85,7 @@ class BlockingInvocationInlineServiceTestCase(
def testSuccessfulUnaryRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -97,7 +97,7 @@ class BlockingInvocationInlineServiceTestCase(
def testSuccessfulStreamRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -108,7 +108,7 @@ class BlockingInvocationInlineServiceTestCase(
def testSuccessfulStreamRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -120,7 +120,7 @@ class BlockingInvocationInlineServiceTestCase(
def testSequentialInvocations(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
first_request = test_messages.request()
second_request = test_messages.request()
@@ -137,7 +137,7 @@ class BlockingInvocationInlineServiceTestCase(
def testExpiredUnaryRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -148,7 +148,7 @@ class BlockingInvocationInlineServiceTestCase(
def testExpiredUnaryRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -160,7 +160,7 @@ class BlockingInvocationInlineServiceTestCase(
def testExpiredStreamRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -171,7 +171,7 @@ class BlockingInvocationInlineServiceTestCase(
def testExpiredStreamRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -183,7 +183,7 @@ class BlockingInvocationInlineServiceTestCase(
def testFailedUnaryRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -193,7 +193,7 @@ class BlockingInvocationInlineServiceTestCase(
def testFailedUnaryRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -204,7 +204,7 @@ class BlockingInvocationInlineServiceTestCase(
def testFailedStreamRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -214,7 +214,7 @@ class BlockingInvocationInlineServiceTestCase(
def testFailedStreamRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
diff --git a/src/python/grpcio/tests/unit/framework/face/testing/digest.py b/src/python/grpcio/tests/unit/framework/face/testing/digest.py
index 39f28b9657..100067cc83 100644
--- a/src/python/grpcio/tests/unit/framework/face/testing/digest.py
+++ b/src/python/grpcio/tests/unit/framework/face/testing/digest.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -32,6 +32,8 @@
import collections
import threading
+import six
+
# testing_control, interfaces, and testing_service are referenced from
# specification in this module.
from grpc.framework.common import cardinality
@@ -368,7 +370,7 @@ def _assemble(
events = {}
adaptations = {}
messages = {}
- for name, scenario in scenarios.iteritems():
+ for name, scenario in six.iteritems(scenarios):
if name in names:
raise ValueError('Repeated name "%s"!' % name)
diff --git a/src/python/grpcio/tests/unit/framework/face/testing/event_invocation_synchronous_event_service_test_case.py b/src/python/grpcio/tests/unit/framework/face/testing/event_invocation_synchronous_event_service_test_case.py
index b707dcdf6c..db901cfe4e 100644
--- a/src/python/grpcio/tests/unit/framework/face/testing/event_invocation_synchronous_event_service_test_case.py
+++ b/src/python/grpcio/tests/unit/framework/face/testing/event_invocation_synchronous_event_service_test_case.py
@@ -74,7 +74,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testSuccessfulUnaryRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = testing_callback.Callback()
@@ -89,7 +89,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testSuccessfulUnaryRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = testing_callback.Callback()
@@ -104,7 +104,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testSuccessfulStreamRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
callback = testing_callback.Callback()
@@ -122,7 +122,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testSuccessfulStreamRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
callback = testing_callback.Callback()
@@ -140,7 +140,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testSequentialInvocations(self):
# pylint: disable=cell-var-from-loop
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
first_request = test_messages.request()
second_request = test_messages.request()
@@ -165,7 +165,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testExpiredUnaryRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = testing_callback.Callback()
@@ -180,7 +180,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testExpiredUnaryRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = testing_callback.Callback()
@@ -195,7 +195,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testExpiredStreamRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_unary_messages_sequences)):
for unused_test_messages in test_messages_sequence:
callback = testing_callback.Callback()
@@ -208,7 +208,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testExpiredStreamRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
callback = testing_callback.Callback()
@@ -223,7 +223,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testFailedUnaryRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = testing_callback.Callback()
@@ -239,7 +239,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testFailedUnaryRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = testing_callback.Callback()
@@ -255,7 +255,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testFailedStreamRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
callback = testing_callback.Callback()
@@ -274,7 +274,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testFailedStreamRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
callback = testing_callback.Callback()
@@ -291,7 +291,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testParallelInvocations(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
first_request = test_messages.request()
first_callback = testing_callback.Callback()
@@ -318,7 +318,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testCancelledUnaryRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = testing_callback.Callback()
@@ -334,7 +334,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testCancelledUnaryRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = testing_callback.Callback()
@@ -349,7 +349,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testCancelledStreamRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
callback = testing_callback.Callback()
@@ -366,7 +366,7 @@ class EventInvocationSynchronousEventServiceTestCase(
def testCancelledStreamRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_stream_messages_sequences)):
for unused_test_messages in test_messages_sequence:
callback = testing_callback.Callback()
diff --git a/src/python/grpcio/tests/unit/framework/face/testing/future_invocation_asynchronous_event_service_test_case.py b/src/python/grpcio/tests/unit/framework/face/testing/future_invocation_asynchronous_event_service_test_case.py
index 8adfc613c6..d8706aa39e 100644
--- a/src/python/grpcio/tests/unit/framework/face/testing/future_invocation_asynchronous_event_service_test_case.py
+++ b/src/python/grpcio/tests/unit/framework/face/testing/future_invocation_asynchronous_event_service_test_case.py
@@ -110,7 +110,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testSuccessfulUnaryRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -122,7 +122,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testSuccessfulUnaryRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -134,7 +134,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testSuccessfulStreamRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
request_iterator = _PauseableIterator(iter(requests))
@@ -150,7 +150,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testSuccessfulStreamRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
request_iterator = _PauseableIterator(iter(requests))
@@ -166,7 +166,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testSequentialInvocations(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
first_request = test_messages.request()
second_request = test_messages.request()
@@ -185,7 +185,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testExpiredUnaryRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -200,7 +200,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testExpiredUnaryRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -212,7 +212,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testExpiredStreamRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -227,7 +227,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testExpiredStreamRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -239,7 +239,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testFailedUnaryRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -258,7 +258,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testFailedUnaryRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -273,7 +273,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testFailedStreamRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -292,7 +292,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testFailedStreamRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -307,7 +307,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testParallelInvocations(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
first_request = test_messages.request()
second_request = test_messages.request()
@@ -329,7 +329,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testCancelledUnaryRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -343,7 +343,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testCancelledUnaryRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -357,7 +357,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testCancelledStreamRequestUnaryResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -371,7 +371,7 @@ class FutureInvocationAsynchronousEventServiceTestCase(
def testCancelledStreamRequestStreamResponse(self):
for name, test_messages_sequence in (
- self.digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self.digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
diff --git a/src/python/grpcio/tests/unit/framework/interfaces/base/_control.py b/src/python/grpcio/tests/unit/framework/interfaces/base/_control.py
index fe69e63995..94bcc1428e 100644
--- a/src/python/grpcio/tests/unit/framework/interfaces/base/_control.py
+++ b/src/python/grpcio/tests/unit/framework/interfaces/base/_control.py
@@ -29,6 +29,8 @@
"""Part of the tests of the base interface of RPC Framework."""
+from __future__ import division
+
import abc
import collections
import enum
@@ -47,8 +49,8 @@ from tests.unit.framework.interfaces.base import test_interfaces # pylint: disa
_GROUP = 'base test cases test group'
_METHOD = 'base test cases test method'
-_PAYLOAD_RANDOM_SECTION_MAXIMUM_SIZE = test_constants.PAYLOAD_SIZE / 20
-_MINIMUM_PAYLOAD_SIZE = test_constants.PAYLOAD_SIZE / 600
+_PAYLOAD_RANDOM_SECTION_MAXIMUM_SIZE = test_constants.PAYLOAD_SIZE // 20
+_MINIMUM_PAYLOAD_SIZE = test_constants.PAYLOAD_SIZE // 600
def _create_payload(randomness):
@@ -59,7 +61,7 @@ def _create_payload(randomness):
random_section = bytes(
bytearray(
randomness.getrandbits(8) for _ in range(random_section_length)))
- sevens_section = '\x07' * (length - random_section_length)
+ sevens_section = b'\x07' * (length - random_section_length)
return b''.join(randomness.sample((random_section, sevens_section), 2))
@@ -385,13 +387,13 @@ class _SequenceController(Controller):
return request + request
def deserialize_request(self, serialized_request):
- return serialized_request[:len(serialized_request) / 2]
+ return serialized_request[:len(serialized_request) // 2]
def serialize_response(self, response):
return response * 3
def deserialize_response(self, serialized_response):
- return serialized_response[2 * len(serialized_response) / 3:]
+ return serialized_response[2 * len(serialized_response) // 3:]
def invocation(self):
with self._condition:
diff --git a/src/python/grpcio/tests/unit/framework/interfaces/face/_blocking_invocation_inline_service.py b/src/python/grpcio/tests/unit/framework/interfaces/face/_blocking_invocation_inline_service.py
index a47fcd3681..936b87f597 100644
--- a/src/python/grpcio/tests/unit/framework/interfaces/face/_blocking_invocation_inline_service.py
+++ b/src/python/grpcio/tests/unit/framework/interfaces/face/_blocking_invocation_inline_service.py
@@ -29,6 +29,8 @@
"""Test code for the Face layer of RPC Framework."""
+from __future__ import division
+
import abc
import itertools
import unittest
@@ -82,7 +84,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testSuccessfulUnaryRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -93,7 +95,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testSuccessfulUnaryRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -105,7 +107,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testSuccessfulStreamRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -116,7 +118,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testSuccessfulStreamRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -128,7 +130,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testSequentialInvocations(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
first_request = test_messages.request()
second_request = test_messages.request()
@@ -146,7 +148,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testParallelInvocations(self):
pool = logging_pool.pool(test_constants.PARALLELISM)
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = []
response_futures = []
@@ -168,7 +170,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testWaitingForSomeButNotAllParallelInvocations(self):
pool = logging_pool.pool(test_constants.PARALLELISM)
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = []
response_futures_to_indices = {}
@@ -182,7 +184,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
some_completed_response_futures_iterator = itertools.islice(
futures.as_completed(response_futures_to_indices),
- test_constants.PARALLELISM / 2)
+ test_constants.PARALLELISM // 2)
for response_future in some_completed_response_futures_iterator:
index = response_futures_to_indices[response_future]
test_messages.verify(requests[index], response_future.result(), self)
@@ -206,7 +208,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testExpiredUnaryRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -217,7 +219,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testExpiredUnaryRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -229,7 +231,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testExpiredStreamRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -240,7 +242,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testExpiredStreamRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -252,7 +254,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testFailedUnaryRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -262,7 +264,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testFailedUnaryRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -273,7 +275,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testFailedStreamRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -283,7 +285,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testFailedStreamRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
diff --git a/src/python/grpcio/tests/unit/framework/interfaces/face/_digest.py b/src/python/grpcio/tests/unit/framework/interfaces/face/_digest.py
index 9304b6b1db..40c03f9e71 100644
--- a/src/python/grpcio/tests/unit/framework/interfaces/face/_digest.py
+++ b/src/python/grpcio/tests/unit/framework/interfaces/face/_digest.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -32,6 +32,8 @@
import collections
import threading
+import six
+
# test_control, _service, and test_interfaces are referenced from specification
# in this module.
from grpc.framework.common import cardinality
@@ -363,7 +365,7 @@ def _assemble(
events = {}
adaptations = {}
messages = {}
- for identifier, scenario in scenarios.iteritems():
+ for identifier, scenario in six.iteritems(scenarios):
if identifier in identifiers:
raise ValueError('Repeated identifier "(%s, %s)"!' % identifier)
diff --git a/src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py b/src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py
index c1081a7d99..401b52f614 100644
--- a/src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py
+++ b/src/python/grpcio/tests/unit/framework/interfaces/face/_future_invocation_asynchronous_event_service.py
@@ -29,6 +29,8 @@
"""Test code for the Face layer of RPC Framework."""
+from __future__ import division
+
import abc
import contextlib
import itertools
@@ -145,7 +147,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testSuccessfulUnaryRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = _Callback()
@@ -160,7 +162,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testSuccessfulUnaryRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -172,7 +174,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testSuccessfulStreamRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
request_iterator = _PauseableIterator(iter(requests))
@@ -192,7 +194,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testSuccessfulStreamRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
request_iterator = _PauseableIterator(iter(requests))
@@ -208,7 +210,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testSequentialInvocations(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
first_request = test_messages.request()
second_request = test_messages.request()
@@ -227,7 +229,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testParallelInvocations(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
first_request = test_messages.request()
second_request = test_messages.request()
@@ -243,7 +245,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
test_messages.verify(second_request, second_response, self)
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = []
response_futures = []
@@ -263,7 +265,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testWaitingForSomeButNotAllParallelInvocations(self):
pool = logging_pool.pool(test_constants.PARALLELISM)
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = []
response_futures_to_indices = {}
@@ -277,7 +279,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
some_completed_response_futures_iterator = itertools.islice(
futures.as_completed(response_futures_to_indices),
- test_constants.PARALLELISM / 2)
+ test_constants.PARALLELISM // 2)
for response_future in some_completed_response_futures_iterator:
index = response_futures_to_indices[response_future]
test_messages.verify(requests[index], response_future.result(), self)
@@ -285,7 +287,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testCancelledUnaryRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = _Callback()
@@ -302,7 +304,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testCancelledUnaryRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -316,7 +318,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testCancelledStreamRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
callback = _Callback()
@@ -333,7 +335,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testCancelledStreamRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -347,7 +349,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testExpiredUnaryRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = _Callback()
@@ -364,7 +366,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testExpiredUnaryRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -376,7 +378,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testExpiredStreamRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
callback = _Callback()
@@ -393,7 +395,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testExpiredStreamRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
@@ -405,7 +407,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testFailedUnaryRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_unary_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
callback = _Callback()
@@ -427,7 +429,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testFailedUnaryRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.unary_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.unary_stream_messages_sequences)):
for test_messages in test_messages_sequence:
request = test_messages.request()
@@ -442,7 +444,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testFailedStreamRequestUnaryResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_unary_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_unary_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
callback = _Callback()
@@ -464,7 +466,7 @@ class TestCase(six.with_metaclass(abc.ABCMeta, test_coverage.Coverage, unittest.
def testFailedStreamRequestStreamResponse(self):
for (group, method), test_messages_sequence in (
- self._digest.stream_stream_messages_sequences.iteritems()):
+ six.iteritems(self._digest.stream_stream_messages_sequences)):
for test_messages in test_messages_sequence:
requests = test_messages.requests()
diff --git a/src/python/grpcio/tests/unit/test_common.py b/src/python/grpcio/tests/unit/test_common.py
index 29431bfb9d..824f1cbd16 100644
--- a/src/python/grpcio/tests/unit/test_common.py
+++ b/src/python/grpcio/tests/unit/test_common.py
@@ -1,4 +1,4 @@
-# Copyright 2015, Google Inc.
+# Copyright 2015-2016, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,8 @@
import collections
+import six
+
INVOCATION_INITIAL_METADATA = ((b'0', b'abc'), (b'1', b'def'), (b'2', b'ghi'),)
SERVICE_INITIAL_METADATA = ((b'3', b'jkl'), (b'4', b'mno'), (b'5', b'pqr'),)
SERVICE_TERMINAL_METADATA = ((b'6', b'stu'), (b'7', b'vwx'), (b'8', b'yza'),)
@@ -65,7 +67,7 @@ def metadata_transmitted(original_metadata, transmitted_metadata):
key, value = tuple(key_value_pair)
transmitted[key].append(value)
- for key, values in original.iteritems():
+ for key, values in six.iteritems(original):
transmitted_values = transmitted[key]
transmitted_iterator = iter(transmitted_values)
try:
diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c
index af05ddf6e7..cd0aa6aaf2 100644
--- a/src/ruby/ext/grpc/rb_call.c
+++ b/src/ruby/ext/grpc/rb_call.c
@@ -72,6 +72,10 @@ static ID id_cq;
* the flags used to create metadata from a Hash */
static ID id_flags;
+/* id_credentials is the name of the hidden ivar that preserves the value
+ * of the credentials added to the call */
+static ID id_credentials;
+
/* id_input_md is the name of the hidden ivar that preserves the hash used to
* create metadata, so that references to the strings it contains last as long
* as the call the metadata is added to. */
@@ -299,6 +303,7 @@ static VALUE grpc_rb_call_set_credentials(VALUE self, VALUE credentials) {
"grpc_call_set_credentials failed with %s (code=%d)",
grpc_call_error_detail_of(err), err);
}
+ rb_ivar_set(self, id_credentials, credentials);
return Qnil;
}
@@ -859,6 +864,7 @@ void Init_grpc_call() {
id_cq = rb_intern("__cq");
id_flags = rb_intern("__flags");
id_input_md = rb_intern("__input_md");
+ id_credentials = rb_intern("__credentials");
/* Ids used in constructing the batch result. */
sym_send_message = ID2SYM(rb_intern("send_message"));
diff --git a/src/ruby/ext/grpc/rb_call_credentials.c b/src/ruby/ext/grpc/rb_call_credentials.c
index 2426f106a9..2b978fcdd0 100644
--- a/src/ruby/ext/grpc/rb_call_credentials.c
+++ b/src/ruby/ext/grpc/rb_call_credentials.c
@@ -41,6 +41,7 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
#include "rb_call.h"
#include "rb_event_thread.h"
@@ -50,9 +51,9 @@
* grpc_call_credentials */
static VALUE grpc_rb_cCallCredentials = Qnil;
-/* grpc_rb_call_credentials wraps a grpc_call_credentials. It provides a peer
- * ruby object, 'mark' to minimize copying when a credential is created from
- * ruby. */
+/* grpc_rb_call_credentials wraps a grpc_call_credentials. It provides a mark
+ * object that is used to hold references to any objects used to create the
+ * credentials. */
typedef struct grpc_rb_call_credentials {
/* Holder of ruby objects involved in contructing the credentials */
VALUE mark;
@@ -81,14 +82,23 @@ static VALUE grpc_rb_call_credentials_callback(VALUE callback_args) {
static VALUE grpc_rb_call_credentials_callback_rescue(VALUE args,
VALUE exception_object) {
VALUE result = rb_hash_new();
+ VALUE backtrace = rb_funcall(
+ rb_funcall(exception_object, rb_intern("backtrace"), 0),
+ rb_intern("join"),
+ 1, rb_str_new2("\n\tfrom "));
+ VALUE exception_info = rb_funcall(exception_object, rb_intern("to_s"), 0);
+ const char *exception_classname = rb_obj_classname(exception_object);
(void)args;
+ gpr_log(GPR_INFO, "Call credentials callback failed: %s: %s\n%s",
+ exception_classname, StringValueCStr(exception_info),
+ StringValueCStr(backtrace));
rb_hash_aset(result, rb_str_new2("metadata"), Qnil);
/* Currently only gives the exception class name. It should be possible get
more details */
rb_hash_aset(result, rb_str_new2("status"),
INT2NUM(GRPC_STATUS_PERMISSION_DENIED));
rb_hash_aset(result, rb_str_new2("details"),
- rb_str_new2(rb_obj_classname(exception_object)));
+ rb_str_new2(exception_classname));
return result;
}
@@ -146,13 +156,8 @@ static void grpc_rb_call_credentials_free(void *p) {
return;
}
wrapper = (grpc_rb_call_credentials *)p;
-
- /* Delete the wrapped object if the mark object is Qnil, which indicates that
- * no other object is the actual owner. */
- if (wrapper->wrapped != NULL && wrapper->mark == Qnil) {
- grpc_call_credentials_release(wrapper->wrapped);
- wrapper->wrapped = NULL;
- }
+ grpc_call_credentials_release(wrapper->wrapped);
+ wrapper->wrapped = NULL;
xfree(p);
}
@@ -164,8 +169,6 @@ static void grpc_rb_call_credentials_mark(void *p) {
return;
}
wrapper = (grpc_rb_call_credentials *)p;
-
- /* If it's not already cleaned up, mark the mark object */
if (wrapper->mark != Qnil) {
rb_gc_mark(wrapper->mark);
}
@@ -194,7 +197,7 @@ static VALUE grpc_rb_call_credentials_alloc(VALUE cls) {
/* Creates a wrapping object for a given call credentials. This should only be
* called with grpc_call_credentials objects that are not already associated
* with any Ruby object */
-VALUE grpc_rb_wrap_call_credentials(grpc_call_credentials *c) {
+VALUE grpc_rb_wrap_call_credentials(grpc_call_credentials *c, VALUE mark) {
VALUE rb_wrapper;
grpc_rb_call_credentials *wrapper;
if (c == NULL) {
@@ -204,6 +207,7 @@ VALUE grpc_rb_wrap_call_credentials(grpc_call_credentials *c) {
TypedData_Get_Struct(rb_wrapper, grpc_rb_call_credentials,
&grpc_rb_call_credentials_data_type, wrapper);
wrapper->wrapped = c;
+ wrapper->mark = mark;
return rb_wrapper;
}
@@ -267,6 +271,7 @@ static VALUE grpc_rb_call_credentials_init(VALUE self, VALUE proc) {
return Qnil;
}
+ wrapper->mark = proc;
wrapper->wrapped = creds;
rb_ivar_set(self, id_callback, proc);
@@ -277,15 +282,18 @@ static VALUE grpc_rb_call_credentials_compose(int argc, VALUE *argv,
VALUE self) {
grpc_call_credentials *creds;
grpc_call_credentials *other;
+ VALUE mark;
if (argc == 0) {
return self;
}
+ mark = rb_ary_new();
creds = grpc_rb_get_wrapped_call_credentials(self);
for (int i = 0; i < argc; i++) {
+ rb_ary_push(mark, argv[i]);
other = grpc_rb_get_wrapped_call_credentials(argv[i]);
creds = grpc_composite_call_credentials_create(creds, other, NULL);
}
- return grpc_rb_wrap_call_credentials(creds);
+ return grpc_rb_wrap_call_credentials(creds, mark);
}
void Init_grpc_call_credentials() {
diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c
index 0e6badbdaf..e1aaa539db 100644
--- a/src/ruby/ext/grpc/rb_channel.c
+++ b/src/ruby/ext/grpc/rb_channel.c
@@ -70,11 +70,10 @@ static VALUE grpc_rb_cChannel = Qnil;
/* Used during the conversion of a hash to channel args during channel setup */
static VALUE grpc_rb_cChannelArgs;
-/* grpc_rb_channel wraps a grpc_channel. It provides a peer ruby object,
- * 'mark' to minimize copying when a channel is created from ruby. */
+/* grpc_rb_channel wraps a grpc_channel. */
typedef struct grpc_rb_channel {
- /* Holder of ruby objects involved in constructing the channel */
- VALUE mark;
+ VALUE credentials;
+
/* The actual channel */
grpc_channel *wrapped;
} grpc_rb_channel;
@@ -87,13 +86,8 @@ static void grpc_rb_channel_free(void *p) {
};
ch = (grpc_rb_channel *)p;
- /* Deletes the wrapped object if the mark object is Qnil, which indicates
- * that no other object is the actual owner. */
- if (ch->wrapped != NULL && ch->mark == Qnil) {
+ if (ch->wrapped != NULL) {
grpc_channel_destroy(ch->wrapped);
- rb_warning("channel gc: destroyed the c channel");
- } else {
- rb_warning("channel gc: did not destroy the c channel");
}
xfree(p);
@@ -106,8 +100,8 @@ static void grpc_rb_channel_mark(void *p) {
return;
}
channel = (grpc_rb_channel *)p;
- if (channel->mark != Qnil) {
- rb_gc_mark(channel->mark);
+ if (channel->credentials != Qnil) {
+ rb_gc_mark(channel->credentials);
}
}
@@ -125,7 +119,7 @@ static rb_data_type_t grpc_channel_data_type = {
static VALUE grpc_rb_channel_alloc(VALUE cls) {
grpc_rb_channel *wrapper = ALLOC(grpc_rb_channel);
wrapper->wrapped = NULL;
- wrapper->mark = Qnil;
+ wrapper->credentials = Qnil;
return TypedData_Wrap_Struct(cls, &grpc_channel_data_type, wrapper);
}
@@ -162,6 +156,7 @@ static VALUE grpc_rb_channel_init(int argc, VALUE *argv, VALUE self) {
}
ch = grpc_insecure_channel_create(target_chars, &args, NULL);
} else {
+ wrapper->credentials = credentials;
creds = grpc_rb_get_wrapped_channel_credentials(credentials);
ch = grpc_secure_channel_create(creds, target_chars, &args, NULL);
}
@@ -330,7 +325,6 @@ static VALUE grpc_rb_channel_destroy(VALUE self) {
if (ch != NULL) {
grpc_channel_destroy(ch);
wrapper->wrapped = NULL;
- wrapper->mark = Qnil;
}
return Qnil;
diff --git a/src/ruby/ext/grpc/rb_channel_credentials.c b/src/ruby/ext/grpc/rb_channel_credentials.c
index 8c6fc3b7eb..f649084311 100644
--- a/src/ruby/ext/grpc/rb_channel_credentials.c
+++ b/src/ruby/ext/grpc/rb_channel_credentials.c
@@ -49,8 +49,8 @@
static VALUE grpc_rb_cChannelCredentials = Qnil;
/* grpc_rb_channel_credentials wraps a grpc_channel_credentials. It provides a
- * peer ruby object, 'mark' to minimize copying when a credential is
- * created from ruby. */
+ * mark object that is used to hold references to any objects used to create
+ * the credentials. */
typedef struct grpc_rb_channel_credentials {
/* Holder of ruby objects involved in constructing the credentials */
VALUE mark;
@@ -66,13 +66,8 @@ static void grpc_rb_channel_credentials_free(void *p) {
return;
};
wrapper = (grpc_rb_channel_credentials *)p;
-
- /* Delete the wrapped object if the mark object is Qnil, which indicates that
- * no other object is the actual owner. */
- if (wrapper->wrapped != NULL && wrapper->mark == Qnil) {
- grpc_channel_credentials_release(wrapper->wrapped);
- wrapper->wrapped = NULL;
- }
+ grpc_channel_credentials_release(wrapper->wrapped);
+ wrapper->wrapped = NULL;
xfree(p);
}
@@ -85,7 +80,6 @@ static void grpc_rb_channel_credentials_mark(void *p) {
}
wrapper = (grpc_rb_channel_credentials *)p;
- /* If it's not already cleaned up, mark the mark object */
if (wrapper->mark != Qnil) {
rb_gc_mark(wrapper->mark);
}
@@ -114,7 +108,7 @@ static VALUE grpc_rb_channel_credentials_alloc(VALUE cls) {
/* Creates a wrapping object for a given channel credentials. This should only
* be called with grpc_channel_credentials objects that are not already
* associated with any Ruby object. */
-VALUE grpc_rb_wrap_channel_credentials(grpc_channel_credentials *c) {
+VALUE grpc_rb_wrap_channel_credentials(grpc_channel_credentials *c, VALUE mark) {
VALUE rb_wrapper;
grpc_rb_channel_credentials *wrapper;
if (c == NULL) {
@@ -124,6 +118,7 @@ VALUE grpc_rb_wrap_channel_credentials(grpc_channel_credentials *c) {
TypedData_Get_Struct(rb_wrapper, grpc_rb_channel_credentials,
&grpc_rb_channel_credentials_data_type, wrapper);
wrapper->wrapped = c;
+ wrapper->mark = mark;
return rb_wrapper;
}
@@ -222,11 +217,15 @@ static VALUE grpc_rb_channel_credentials_compose(int argc, VALUE *argv,
VALUE self) {
grpc_channel_credentials *creds;
grpc_call_credentials *other;
+ VALUE mark;
if (argc == 0) {
return self;
}
+ mark = rb_ary_new();
+ rb_ary_push(mark, self);
creds = grpc_rb_get_wrapped_channel_credentials(self);
for (int i = 0; i < argc; i++) {
+ rb_ary_push(mark, argv[i]);
other = grpc_rb_get_wrapped_call_credentials(argv[i]);
creds = grpc_composite_channel_credentials_create(creds, other, NULL);
if (creds == NULL) {
@@ -234,7 +233,7 @@ static VALUE grpc_rb_channel_credentials_compose(int argc, VALUE *argv,
"Failed to compose channel and call credentials");
}
}
- return grpc_rb_wrap_channel_credentials(creds);
+ return grpc_rb_wrap_channel_credentials(creds, mark);
}
void Init_grpc_channel_credentials() {