diff --git a/Makefile b/Makefile index d68abcfb717..fa3c350e5ba 100644 --- a/Makefile +++ b/Makefile @@ -791,14 +791,14 @@ LIBGPR_SRC = \ src/core/support/cpu_posix.c \ src/core/support/histogram.c \ src/core/support/host_port.c \ + src/core/support/log_android.c \ src/core/support/log.c \ - src/core/support/log_posix.c \ src/core/support/log_linux.c \ - src/core/support/log_android.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/slice.c \ src/core/support/string.c \ src/core/support/string_posix.c \ src/core/support/string_win32.c \ @@ -881,12 +881,11 @@ LIBGRPC_SRC = \ src/core/channel/noop_filter.c \ src/core/compression/algorithm.c \ src/core/compression/message_compress.c \ - src/core/endpoint/endpoint.c \ - src/core/endpoint/secure_endpoint.c \ src/core/httpcli/format_request.c \ src/core/httpcli/httpcli.c \ src/core/httpcli/httpcli_security_context.c \ src/core/httpcli/parser.c \ + src/core/iomgr/endpoint.c \ src/core/iomgr/endpoint_pair_posix.c \ src/core/iomgr/iomgr_libevent.c \ src/core/iomgr/iomgr_libevent_use_threads.c \ @@ -904,14 +903,15 @@ LIBGRPC_SRC = \ src/core/security/credentials.c \ src/core/security/google_root_certs.c \ src/core/security/json_token.c \ + src/core/security/secure_endpoint.c \ src/core/security/secure_transport_setup.c \ src/core/security/security_context.c \ src/core/security/server_secure_chttp2.c \ src/core/statistics/census_init.c \ + src/core/statistics/census_log.c \ src/core/statistics/census_rpc_stats.c \ src/core/statistics/census_tracing.c \ src/core/statistics/hash_table.c \ - src/core/statistics/census_log.c \ src/core/statistics/window_stats.c \ src/core/surface/byte_buffer.c \ src/core/surface/byte_buffer_reader.c \ @@ -1004,19 +1004,19 @@ clean_libgrpc: LIBGRPC_TEST_UTIL_SRC = \ + test/core/end2end/cq_verifier.c \ + test/core/end2end/data/ca_cert.c \ + test/core/end2end/data/server1_cert.c \ + test/core/end2end/data/server1_key.c \ + test/core/iomgr/endpoint_tests.c \ + test/core/statistics/census_log_tests.c \ + test/core/transport/transport_end2end_tests.c \ test/core/util/grpc_profiler.c \ test/core/util/ipv6_posix.c \ test/core/util/parse_hexstring.c \ test/core/util/port_posix.c \ test/core/util/slice_splitter.c \ test/core/util/test_config.c \ - test/core/end2end/data/server1_cert.c \ - test/core/end2end/data/server1_key.c \ - test/core/end2end/data/ca_cert.c \ - test/core/end2end/cq_verifier.c \ - test/core/endpoint/endpoint_tests.c \ - test/core/transport/transport_end2end_tests.c \ - test/core/statistics/census_log_tests.c \ LIBGRPC_TEST_UTIL_OBJS = $(addprefix objs/, $(addsuffix .o, $(basename $(LIBGRPC_TEST_UTIL_SRC)))) @@ -1054,37 +1054,37 @@ clean_libgrpc_test_util: LIBGRPC++_SRC = \ - src/cpp/server/server.cc \ - src/cpp/server/server_rpc_handler.cc \ - src/cpp/server/thread_pool.cc \ - src/cpp/server/async_server_context.cc \ - src/cpp/server/async_server.cc \ - src/cpp/server/completion_queue.cc \ - src/cpp/server/server_builder.cc \ - src/cpp/stream/stream_context.cc \ - src/cpp/client/create_channel.cc \ src/cpp/client/channel.cc \ src/cpp/client/client_context.cc \ + src/cpp/client/create_channel.cc \ src/cpp/client/internal_stub.cc \ - src/cpp/util/time.cc \ - src/cpp/util/status.cc \ src/cpp/proto/proto_utils.cc \ src/cpp/rpc_method.cc \ + src/cpp/server/async_server.cc \ + src/cpp/server/async_server_context.cc \ + src/cpp/server/completion_queue.cc \ + src/cpp/server/server_builder.cc \ + src/cpp/server/server.cc \ + src/cpp/server/server_rpc_handler.cc \ + src/cpp/server/thread_pool.cc \ + src/cpp/stream/stream_context.cc \ + src/cpp/util/status.cc \ + src/cpp/util/time.cc \ PUBLIC_HEADERS_CXX += \ - include/grpc++/channel_interface.h \ + include/grpc++/async_server_context.h \ include/grpc++/async_server.h \ + include/grpc++/channel_interface.h \ + include/grpc++/client_context.h \ + include/grpc++/completion_queue.h \ + include/grpc++/config.h \ include/grpc++/create_channel.h \ include/grpc++/server_builder.h \ - include/grpc++/thread_pool_interface.h \ - include/grpc++/stream_context_interface.h \ + include/grpc++/server.h \ include/grpc++/status.h \ - include/grpc++/config.h \ - include/grpc++/completion_queue.h \ + include/grpc++/stream_context_interface.h \ include/grpc++/stream.h \ - include/grpc++/async_server_context.h \ - include/grpc++/server.h \ - include/grpc++/client_context.h \ + include/grpc++/thread_pool_interface.h \ LIBGRPC++_OBJS = $(addprefix objs/, $(addsuffix .o, $(basename $(LIBGRPC++_SRC)))) LIBGRPC++_DEPS = $(addprefix deps/, $(addsuffix .dep, $(basename $(LIBGRPC++_SRC)))) @@ -1124,9 +1124,9 @@ clean_libgrpc++: LIBGRPC++_TEST_UTIL_SRC = \ - test/cpp/util/test_ssl_channel.cc \ - gens/test/cpp/util/echo.pb.cc \ test/cpp/end2end/async_test_server.cc \ + gens/test/cpp/util/echo.pb.cc \ + test/cpp/util/test_ssl_channel.cc \ LIBGRPC++_TEST_UTIL_OBJS = $(addprefix objs/, $(addsuffix .o, $(basename $(LIBGRPC++_TEST_UTIL_SRC)))) @@ -2007,12 +2007,11 @@ LIBGRPC_UNSECURE_SRC = \ src/core/channel/noop_filter.c \ src/core/compression/algorithm.c \ src/core/compression/message_compress.c \ - src/core/endpoint/endpoint.c \ - src/core/endpoint/secure_endpoint.c \ src/core/httpcli/format_request.c \ src/core/httpcli/httpcli.c \ src/core/httpcli/httpcli_security_context.c \ src/core/httpcli/parser.c \ + src/core/iomgr/endpoint.c \ src/core/iomgr/endpoint_pair_posix.c \ src/core/iomgr/iomgr_libevent.c \ src/core/iomgr/iomgr_libevent_use_threads.c \ @@ -2026,10 +2025,10 @@ LIBGRPC_UNSECURE_SRC = \ src/core/iomgr/tcp_server_posix.c \ src/core/iomgr/time_averaged_stats.c \ src/core/statistics/census_init.c \ + src/core/statistics/census_log.c \ src/core/statistics/census_rpc_stats.c \ src/core/statistics/census_tracing.c \ src/core/statistics/hash_table.c \ - src/core/statistics/census_log.c \ src/core/statistics/window_stats.c \ src/core/surface/byte_buffer.c \ src/core/surface/byte_buffer_reader.c \ @@ -3959,7 +3958,7 @@ clean_bin_encoder_test: SECURE_ENDPOINT_TEST_SRC = \ - test/core/endpoint/secure_endpoint_test.c \ + test/core/security/secure_endpoint_test.c \ SECURE_ENDPOINT_TEST_OBJS = $(addprefix objs/, $(addsuffix .o, $(basename $(SECURE_ENDPOINT_TEST_SRC)))) SECURE_ENDPOINT_TEST_DEPS = $(addprefix deps/, $(addsuffix .dep, $(basename $(SECURE_ENDPOINT_TEST_SRC)))) diff --git a/build.json b/build.json index 386711fc4df..a1a9bd3810a 100644 --- a/build.json +++ b/build.json @@ -21,14 +21,14 @@ "src/core/support/cpu_posix.c", "src/core/support/histogram.c", "src/core/support/host_port.c", + "src/core/support/log_android.c", "src/core/support/log.c", - "src/core/support/log_posix.c", "src/core/support/log_linux.c", - "src/core/support/log_android.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/slice.c", "src/core/support/string.c", "src/core/support/string_posix.c", "src/core/support/string_win32.c", @@ -111,12 +111,11 @@ "src/core/channel/noop_filter.c", "src/core/compression/algorithm.c", "src/core/compression/message_compress.c", - "src/core/endpoint/endpoint.c", - "src/core/endpoint/secure_endpoint.c", "src/core/httpcli/format_request.c", "src/core/httpcli/httpcli.c", "src/core/httpcli/httpcli_security_context.c", "src/core/httpcli/parser.c", + "src/core/iomgr/endpoint.c", "src/core/iomgr/endpoint_pair_posix.c", "src/core/iomgr/iomgr_libevent.c", "src/core/iomgr/iomgr_libevent_use_threads.c", @@ -134,14 +133,15 @@ "src/core/security/credentials.c", "src/core/security/google_root_certs.c", "src/core/security/json_token.c", + "src/core/security/secure_endpoint.c", "src/core/security/secure_transport_setup.c", "src/core/security/security_context.c", "src/core/security/server_secure_chttp2.c", "src/core/statistics/census_init.c", + "src/core/statistics/census_log.c", "src/core/statistics/census_rpc_stats.c", "src/core/statistics/census_tracing.c", "src/core/statistics/hash_table.c", - "src/core/statistics/census_log.c", "src/core/statistics/window_stats.c", "src/core/surface/byte_buffer.c", "src/core/surface/byte_buffer_reader.c", @@ -205,12 +205,12 @@ "src/core/channel/noop_filter.h", "src/core/compression/algorithm.h", "src/core/compression/message_compress.h", - "src/core/endpoint/endpoint.h", "src/core/httpcli/format_request.h", "src/core/httpcli/httpcli.h", "src/core/httpcli/httpcli_security_context.h", "src/core/httpcli/parser.h", "src/core/iomgr/alarm.h", + "src/core/iomgr/endpoint.h", "src/core/iomgr/endpoint_pair.h", "src/core/iomgr/iomgr_completion_queue_interface.h", "src/core/iomgr/iomgr.h", @@ -233,9 +233,9 @@ "src/core/security/secure_transport_setup.h", "src/core/security/security_context.h", "src/core/statistics/census_interface.h", + "src/core/statistics/census_log.h", "src/core/statistics/census_rpc_stats.h", "src/core/statistics/hash_table.h", - "src/core/statistics/census_log.h", "src/core/statistics/window_stats.h", "src/core/surface/call.h", "src/core/surface/channel.h", @@ -279,19 +279,19 @@ "build": "private", "vs_project_guid": "{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}", "src": [ + "test/core/end2end/cq_verifier.c", + "test/core/end2end/data/ca_cert.c", + "test/core/end2end/data/server1_cert.c", + "test/core/end2end/data/server1_key.c", + "test/core/iomgr/endpoint_tests.c", + "test/core/statistics/census_log_tests.c", + "test/core/transport/transport_end2end_tests.c", "test/core/util/grpc_profiler.c", "test/core/util/ipv6_posix.c", "test/core/util/parse_hexstring.c", "test/core/util/port_posix.c", "test/core/util/slice_splitter.c", - "test/core/util/test_config.c", - "test/core/end2end/data/server1_cert.c", - "test/core/end2end/data/server1_key.c", - "test/core/end2end/data/ca_cert.c", - "test/core/end2end/cq_verifier.c", - "test/core/endpoint/endpoint_tests.c", - "test/core/transport/transport_end2end_tests.c", - "test/core/statistics/census_log_tests.c" + "test/core/util/test_config.c" ] }, { @@ -301,57 +301,57 @@ "secure": true, "vs_project_guid": "{C187A093-A0FE-489D-A40A-6E33DE0F9FEB}", "src": [ - "src/cpp/server/server.cc", - "src/cpp/server/server_rpc_handler.cc", - "src/cpp/server/thread_pool.cc", - "src/cpp/server/async_server_context.cc", + "src/cpp/client/channel.cc", + "src/cpp/client/client_context.cc", + "src/cpp/client/create_channel.cc", + "src/cpp/client/internal_stub.cc", + "src/cpp/proto/proto_utils.cc", + "src/cpp/rpc_method.cc", "src/cpp/server/async_server.cc", + "src/cpp/server/async_server_context.cc", "src/cpp/server/completion_queue.cc", "src/cpp/server/server_builder.cc", + "src/cpp/server/server.cc", + "src/cpp/server/server_rpc_handler.cc", + "src/cpp/server/thread_pool.cc", "src/cpp/stream/stream_context.cc", - "src/cpp/client/create_channel.cc", - "src/cpp/client/channel.cc", - "src/cpp/client/client_context.cc", - "src/cpp/client/internal_stub.cc", - "src/cpp/util/time.cc", "src/cpp/util/status.cc", - "src/cpp/proto/proto_utils.cc", - "src/cpp/rpc_method.cc" + "src/cpp/util/time.cc" ], "public_headers": [ - "include/grpc++/channel_interface.h", + "include/grpc++/async_server_context.h", "include/grpc++/async_server.h", + "include/grpc++/channel_interface.h", + "include/grpc++/client_context.h", + "include/grpc++/completion_queue.h", + "include/grpc++/config.h", "include/grpc++/create_channel.h", "include/grpc++/server_builder.h", - "include/grpc++/thread_pool_interface.h", - "include/grpc++/stream_context_interface.h", + "include/grpc++/server.h", "include/grpc++/status.h", - "include/grpc++/config.h", - "include/grpc++/completion_queue.h", + "include/grpc++/stream_context_interface.h", "include/grpc++/stream.h", - "include/grpc++/async_server_context.h", - "include/grpc++/server.h", - "include/grpc++/client_context.h" + "include/grpc++/thread_pool_interface.h" ], "headers": [ + "src/cpp/client/channel.h", + "src/cpp/client/internal_stub.h", + "src/cpp/proto/proto_utils.h", + "src/cpp/rpc_method.h", "src/cpp/server/rpc_service_method.h", "src/cpp/server/server_rpc_handler.h", "src/cpp/server/thread_pool.h", "src/cpp/stream/stream_context.h", - "src/cpp/client/channel.h", - "src/cpp/client/internal_stub.h", - "src/cpp/util/time.h", - "src/cpp/rpc_method.h", - "src/cpp/proto/proto_utils.h" + "src/cpp/util/time.h" ] }, { "name": "grpc++_test_util", "build": "test", "src": [ - "test/cpp/util/test_ssl_channel.cc", + "test/cpp/end2end/async_test_server.cc", "test/cpp/util/echo.proto", - "test/cpp/end2end/async_test_server.cc" + "test/cpp/util/test_ssl_channel.cc" ], "c++": true } @@ -1023,7 +1023,7 @@ "name": "secure_endpoint_test", "build": "test", "src": [ - "test/core/endpoint/secure_endpoint_test.c" + "test/core/security/secure_endpoint_test.c" ], "deps": [ "grpc_test_util", diff --git a/src/core/httpcli/httpcli.c b/src/core/httpcli/httpcli.c index 84a97a47839..bbca57b7dd5 100644 --- a/src/core/httpcli/httpcli.c +++ b/src/core/httpcli/httpcli.c @@ -35,7 +35,7 @@ #include -#include "src/core/endpoint/endpoint.h" +#include "src/core/iomgr/endpoint.h" #include "src/core/iomgr/resolve_address.h" #include "src/core/iomgr/tcp_client.h" #include "src/core/httpcli/format_request.h" diff --git a/src/core/endpoint/endpoint.c b/src/core/iomgr/endpoint.c similarity index 98% rename from src/core/endpoint/endpoint.c rename to src/core/iomgr/endpoint.c index 07353751b0f..259c948720e 100644 --- a/src/core/endpoint/endpoint.c +++ b/src/core/iomgr/endpoint.c @@ -31,7 +31,7 @@ * */ -#include "src/core/endpoint/endpoint.h" +#include "src/core/iomgr/endpoint.h" void grpc_endpoint_notify_on_read(grpc_endpoint *ep, grpc_endpoint_read_cb cb, void *user_data, gpr_timespec deadline) { diff --git a/src/core/endpoint/endpoint.h b/src/core/iomgr/endpoint.h similarity index 100% rename from src/core/endpoint/endpoint.h rename to src/core/iomgr/endpoint.h diff --git a/src/core/iomgr/endpoint_pair.h b/src/core/iomgr/endpoint_pair.h index 4a97ebf0f65..55678b5ddb1 100644 --- a/src/core/iomgr/endpoint_pair.h +++ b/src/core/iomgr/endpoint_pair.h @@ -34,7 +34,7 @@ #ifndef __GRPC_INTERNAL_IOMGR_ENDPOINT_PAIR_H_ #define __GRPC_INTERNAL_IOMGR_ENDPOINT_PAIR_H_ -#include "src/core/endpoint/endpoint.h" +#include "src/core/iomgr/endpoint.h" typedef struct { grpc_endpoint *client; diff --git a/src/core/iomgr/socket_utils_posix.c b/src/core/iomgr/socket_utils_posix.c index 262d606af98..e8c80710377 100644 --- a/src/core/iomgr/socket_utils_posix.c +++ b/src/core/iomgr/socket_utils_posix.c @@ -36,7 +36,7 @@ #ifdef GPR_POSIX_SOCKETUTILS #define _BSD_SOURCE -#include "src/core/endpoint/socket_utils.h" +#include "src/core/iomgr/socket_utils_posix.h" #include #include diff --git a/src/core/iomgr/tcp_client.h b/src/core/iomgr/tcp_client.h index a4632d81cfc..ef2c4faf473 100644 --- a/src/core/iomgr/tcp_client.h +++ b/src/core/iomgr/tcp_client.h @@ -34,7 +34,7 @@ #ifndef __GRPC_INTERNAL_IOMGR_TCP_CLIENT_H__ #define __GRPC_INTERNAL_IOMGR_TCP_CLIENT_H__ -#include "src/core/endpoint/endpoint.h" +#include "src/core/iomgr/endpoint.h" #include "src/core/iomgr/sockaddr.h" #include diff --git a/src/core/iomgr/tcp_posix.h b/src/core/iomgr/tcp_posix.h index 8a3c52894c6..830394d5344 100644 --- a/src/core/iomgr/tcp_posix.h +++ b/src/core/iomgr/tcp_posix.h @@ -44,7 +44,7 @@ otherwise specified. */ -#include "src/core/endpoint/endpoint.h" +#include "src/core/iomgr/endpoint.h" #include "src/core/iomgr/iomgr_libevent.h" #define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192 diff --git a/src/core/iomgr/tcp_server.h b/src/core/iomgr/tcp_server.h index bd6b46f538b..46fba13f901 100644 --- a/src/core/iomgr/tcp_server.h +++ b/src/core/iomgr/tcp_server.h @@ -37,7 +37,7 @@ #include #include -#include "src/core/endpoint/endpoint.h" +#include "src/core/iomgr/endpoint.h" /* Forward decl of grpc_tcp_server */ typedef struct grpc_tcp_server grpc_tcp_server; diff --git a/src/core/endpoint/secure_endpoint.c b/src/core/security/secure_endpoint.c similarity index 99% rename from src/core/endpoint/secure_endpoint.c rename to src/core/security/secure_endpoint.c index 964dc826dbc..34be4256a94 100644 --- a/src/core/endpoint/secure_endpoint.c +++ b/src/core/security/secure_endpoint.c @@ -31,14 +31,14 @@ * */ -#include "src/core/endpoint/secure_endpoint.h" -#include "src/core/tsi/transport_security_interface.h" +#include "src/core/security/secure_endpoint.h" #include #include -#include #include +#include #include #include +#include "src/core/tsi/transport_security_interface.h" #define STAGING_BUFFER_SIZE 8192 @@ -67,7 +67,7 @@ typedef struct { static void secure_endpoint_ref(secure_endpoint *ep) { gpr_ref(&ep->ref); } static void destroy(secure_endpoint *secure_ep) { - secure_endpoint *ep = (secure_endpoint *)secure_ep; + secure_endpoint *ep = secure_ep; grpc_endpoint_destroy(ep->wrapped_ep); tsi_frame_protector_destroy(ep->protector); gpr_slice_buffer_destroy(&ep->leftover_bytes); diff --git a/src/core/endpoint/secure_endpoint.h b/src/core/security/secure_endpoint.h similarity index 98% rename from src/core/endpoint/secure_endpoint.h rename to src/core/security/secure_endpoint.h index 971170afedf..d0f0fa7d5bc 100644 --- a/src/core/endpoint/secure_endpoint.h +++ b/src/core/security/secure_endpoint.h @@ -34,8 +34,8 @@ #ifndef __GRPC_INTERNAL_ENDPOINT_SECURE_ENDPOINT_H__ #define __GRPC_INTERNAL_ENDPOINT_SECURE_ENDPOINT_H__ +#include "src/core/iomgr/endpoint.h" #include -#include "src/core/endpoint/endpoint.h" struct tsi_frame_protector; diff --git a/src/core/security/secure_transport_setup.c b/src/core/security/secure_transport_setup.c index bc2e469af6f..eb112519121 100644 --- a/src/core/security/secure_transport_setup.c +++ b/src/core/security/secure_transport_setup.c @@ -35,7 +35,7 @@ #include -#include "src/core/endpoint/secure_endpoint.h" +#include "src/core/security/secure_endpoint.h" #include #include #include diff --git a/src/core/security/secure_transport_setup.h b/src/core/security/secure_transport_setup.h index 1a20fa9a80b..50f2b08529b 100644 --- a/src/core/security/secure_transport_setup.h +++ b/src/core/security/secure_transport_setup.h @@ -34,7 +34,7 @@ #ifndef __GRPC_INTERNAL_SECURITY_SECURE_TRANSPORT_SETUP_H__ #define __GRPC_INTERNAL_SECURITY_SECURE_TRANSPORT_SETUP_H__ -#include "src/core/endpoint/endpoint.h" +#include "src/core/iomgr/endpoint.h" #include "src/core/security/security_context.h" /* --- Secure transport setup --- */ diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c index cb97c351301..13b9a847eeb 100644 --- a/src/core/security/security_context.c +++ b/src/core/security/security_context.c @@ -35,15 +35,14 @@ #include -#include "src/core/endpoint/secure_endpoint.h" #include "src/core/security/credentials.h" +#include "src/core/security/secure_endpoint.h" #include "src/core/surface/lame_client.h" #include "src/core/transport/chttp2/alpn.h" #include #include #include #include - #include "src/core/tsi/fake_transport_security.h" #include "src/core/tsi/ssl_transport_security.h" diff --git a/src/core/security/security_context.h b/src/core/security/security_context.h index 0c6025643af..bbd7ff3b1a5 100644 --- a/src/core/security/security_context.h +++ b/src/core/security/security_context.h @@ -35,7 +35,7 @@ #define __GRPC_INTERNAL_SECURITY_SECURITY_CONTEXT_H__ #include -#include "src/core/endpoint/endpoint.h" +#include "src/core/iomgr/endpoint.h" #include "src/core/security/credentials.h" #include "src/core/tsi/transport_security_interface.h" diff --git a/src/core/surface/channel_create.c b/src/core/surface/channel_create.c index 7d30b64204e..41093d78eff 100644 --- a/src/core/surface/channel_create.c +++ b/src/core/surface/channel_create.c @@ -43,7 +43,7 @@ #include "src/core/channel/connected_channel.h" #include "src/core/channel/http_client_filter.h" #include "src/core/channel/http_filter.h" -#include "src/core/endpoint/endpoint.h" +#include "src/core/iomgr/endpoint.h" #include "src/core/iomgr/resolve_address.h" #include "src/core/iomgr/tcp_client.h" #include "src/core/surface/channel.h" diff --git a/src/core/transport/chttp2_transport.h b/src/core/transport/chttp2_transport.h index 24f26068bce..dd4419b98dc 100644 --- a/src/core/transport/chttp2_transport.h +++ b/src/core/transport/chttp2_transport.h @@ -34,7 +34,7 @@ #ifndef __GRPC_INTERNAL_TRANSPORT_CHTTP2_TRANSPORT_H__ #define __GRPC_INTERNAL_TRANSPORT_CHTTP2_TRANSPORT_H__ -#include "src/core/endpoint/endpoint.h" +#include "src/core/iomgr/endpoint.h" #include "src/core/transport/transport.h" void grpc_create_chttp2_transport(grpc_transport_setup_callback setup, diff --git a/test/core/endpoint/tcp_client_test.c b/test/core/endpoint/tcp_client_test.c deleted file mode 100644 index 10138e6af5f..00000000000 --- a/test/core/endpoint/tcp_client_test.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * - * Copyright 2014, 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/endpoint/tcp_client.h" - -#include -#include -#include -#include -#include - -#include "src/core/eventmanager/em.h" -#include -#include - -static grpc_em em; - -static gpr_timespec test_deadline() { - return gpr_time_add(gpr_now(), gpr_time_from_micros(1000000)); -} - -static void must_succeed(void *arg, grpc_endpoint *tcp) { - GPR_ASSERT(tcp); - grpc_endpoint_shutdown(tcp); - grpc_endpoint_destroy(tcp); - gpr_event_set(arg, (void *)1); -} - -static void must_fail(void *arg, grpc_endpoint *tcp) { - GPR_ASSERT(!tcp); - gpr_event_set(arg, (void *)1); -} - -void test_succeeds() { - struct sockaddr_in addr; - socklen_t addr_len = sizeof(addr); - int svr_fd; - int r; - gpr_event ev; - - gpr_event_init(&ev); - - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - - /* create a dummy server */ - svr_fd = socket(AF_INET, SOCK_STREAM, 0); - GPR_ASSERT(svr_fd >= 0); - GPR_ASSERT(0 == bind(svr_fd, (struct sockaddr *)&addr, addr_len)); - GPR_ASSERT(0 == listen(svr_fd, 1)); - - /* connect to it */ - GPR_ASSERT(getsockname(svr_fd, (struct sockaddr *)&addr, &addr_len) == 0); - grpc_tcp_client_connect(must_succeed, &ev, &em, (struct sockaddr *)&addr, - addr_len, gpr_inf_future); - - /* await the connection */ - do { - addr_len = sizeof(addr); - r = accept(svr_fd, (struct sockaddr *)&addr, &addr_len); - } while (r == -1 && errno == EINTR); - GPR_ASSERT(r >= 0); - close(r); - - /* wait for the connection callback to finish */ - GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); -} - -void test_fails() { - struct sockaddr_in addr; - socklen_t addr_len = sizeof(addr); - gpr_event ev; - - gpr_event_init(&ev); - - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - - /* connect to a broken address */ - grpc_tcp_client_connect(must_fail, &ev, &em, (struct sockaddr *)&addr, - addr_len, gpr_inf_future); - - /* wait for the connection callback to finish */ - GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); -} - -void test_times_out() { - struct sockaddr_in addr; - socklen_t addr_len = sizeof(addr); - int svr_fd; -#define NUM_CLIENT_CONNECTS 10 - int client_fd[NUM_CLIENT_CONNECTS]; - int i; - int r; - gpr_event ev; - gpr_timespec connect_deadline; - - gpr_event_init(&ev); - - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - - /* create a dummy server */ - svr_fd = socket(AF_INET, SOCK_STREAM, 0); - GPR_ASSERT(svr_fd >= 0); - GPR_ASSERT(0 == bind(svr_fd, (struct sockaddr *)&addr, addr_len)); - GPR_ASSERT(0 == listen(svr_fd, 1)); - /* Get its address */ - GPR_ASSERT(getsockname(svr_fd, (struct sockaddr *)&addr, &addr_len) == 0); - - /* tie up the listen buffer, which is somewhat arbitrarily sized. */ - for (i = 0; i < NUM_CLIENT_CONNECTS; ++i) { - client_fd[i] = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0); - do { - r = connect(client_fd[i], (struct sockaddr *)&addr, addr_len); - } while (r == -1 && errno == EINTR); - GPR_ASSERT(r < 0); - GPR_ASSERT(errno == EWOULDBLOCK || errno == EINPROGRESS); - } - - /* connect to dummy server address */ - - connect_deadline = gpr_time_add(gpr_now(), gpr_time_from_micros(1000000)); - - grpc_tcp_client_connect(must_fail, &ev, &em, (struct sockaddr *)&addr, - addr_len, connect_deadline); - /* Make sure the event doesn't trigger early */ - GPR_ASSERT(!gpr_event_wait( - &ev, gpr_time_add(gpr_now(), gpr_time_from_micros(500000)))); - /* Now wait until it should have triggered */ - sleep(1); - - /* wait for the connection callback to finish */ - GPR_ASSERT(gpr_event_wait(&ev, test_deadline())); - close(svr_fd); - for (i = 0; i < NUM_CLIENT_CONNECTS; ++i) { - close(client_fd[i]); - } -} - -int main(void) { - grpc_em_init(&em); - test_succeeds(); - test_fails(); - test_times_out(); - return 0; -} diff --git a/test/core/endpoint/endpoint_tests.c b/test/core/iomgr/endpoint_tests.c similarity index 99% rename from test/core/endpoint/endpoint_tests.c rename to test/core/iomgr/endpoint_tests.c index f0abc30bdd6..6a7f6afbc6b 100644 --- a/test/core/endpoint/endpoint_tests.c +++ b/test/core/iomgr/endpoint_tests.c @@ -31,7 +31,7 @@ * */ -#include "test/core/endpoint/endpoint_tests.h" +#include "test/core/iomgr/endpoint_tests.h" #include diff --git a/test/core/endpoint/endpoint_tests.h b/test/core/iomgr/endpoint_tests.h similarity index 98% rename from test/core/endpoint/endpoint_tests.h rename to test/core/iomgr/endpoint_tests.h index d5f34374da4..4f70ad5d8b3 100644 --- a/test/core/endpoint/endpoint_tests.h +++ b/test/core/iomgr/endpoint_tests.h @@ -36,7 +36,7 @@ #include -#include "src/core/endpoint/endpoint.h" +#include "src/core/iomgr/endpoint.h" typedef struct grpc_endpoint_test_config grpc_endpoint_test_config; typedef struct grpc_endpoint_test_fixture grpc_endpoint_test_fixture; diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c index 52856b6b8ae..6a4ef0f9842 100644 --- a/test/core/iomgr/tcp_posix_test.c +++ b/test/core/iomgr/tcp_posix_test.c @@ -46,7 +46,7 @@ #include #include #include "test/core/util/test_config.h" -#include "test/core/endpoint/endpoint_tests.h" +#include "test/core/iomgr/endpoint_tests.h" /* General test notes: diff --git a/test/core/endpoint/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c similarity index 98% rename from test/core/endpoint/secure_endpoint_test.c rename to test/core/security/secure_endpoint_test.c index 18a33b5f527..9311d6ba119 100644 --- a/test/core/endpoint/secure_endpoint_test.c +++ b/test/core/security/secure_endpoint_test.c @@ -31,14 +31,14 @@ * */ -#include "endpoint_tests.h" +#include "test/core/iomgr/endpoint_tests.h" #include #include #include #include -#include "src/core/endpoint/secure_endpoint.h" +#include "src/core/security/secure_endpoint.h" #include "src/core/iomgr/endpoint_pair.h" #include "src/core/iomgr/iomgr.h" #include diff --git a/vsprojects/vs2013/gpr.vcxproj b/vsprojects/vs2013/gpr.vcxproj index 02ee948f958..d27a220d903 100644 --- a/vsprojects/vs2013/gpr.vcxproj +++ b/vsprojects/vs2013/gpr.vcxproj @@ -117,22 +117,22 @@ - + - + - + - - + + diff --git a/vsprojects/vs2013/grpc.vcxproj b/vsprojects/vs2013/grpc.vcxproj index 1460625efe5..9cc576a8ffa 100644 --- a/vsprojects/vs2013/grpc.vcxproj +++ b/vsprojects/vs2013/grpc.vcxproj @@ -94,12 +94,12 @@ - + @@ -122,9 +122,9 @@ + - @@ -193,10 +193,6 @@ - - - - @@ -205,6 +201,8 @@ + + @@ -239,6 +237,8 @@ + + @@ -247,14 +247,14 @@ + + - - diff --git a/vsprojects/vs2013/grpc_test_util.vcxproj b/vsprojects/vs2013/grpc_test_util.vcxproj index f2e9851102a..9a118cf590c 100644 --- a/vsprojects/vs2013/grpc_test_util.vcxproj +++ b/vsprojects/vs2013/grpc_test_util.vcxproj @@ -73,31 +73,31 @@ - + - + - + - + - + - + - + - + - + - + - + - + - +