Merge pull request #908 from ctiller/ssl

Hookup TSI tracer
pull/917/head
Nicolas Noble 10 years ago
commit 0aad3d7457
  1. 10
      Makefile
  2. 6
      build.json
  3. 2
      src/core/channel/channel_stack.c
  4. 4
      src/core/channel/channel_stack.h
  5. 65
      src/core/debug/trace.c
  6. 22
      src/core/debug/trace.h
  7. 3
      src/core/iomgr/iomgr_posix.c
  8. 6
      src/core/iomgr/tcp_posix.c
  9. 2
      src/core/iomgr/tcp_posix.h
  10. 6
      src/core/security/secure_endpoint.c
  11. 2
      src/core/security/secure_endpoint.h
  12. 10
      src/core/surface/init.c
  13. 39
      src/core/surface/init.h
  14. 42
      src/core/surface/init_secure.c
  15. 37
      src/core/surface/init_unsecure.c
  16. 36
      src/core/surface/surface_trace.c
  17. 4
      src/core/surface/surface_trace.h
  18. 3
      src/core/transport/chttp2/frame_settings.c
  19. 5
      src/core/transport/chttp2_transport.c
  20. 2
      src/core/transport/chttp2_transport.h
  21. 4
      src/core/tsi/transport_security.c
  22. 4
      src/core/tsi/transport_security_interface.h
  23. 5
      vsprojects/vs2013/grpc.vcxproj
  24. 9
      vsprojects/vs2013/grpc.vcxproj.filters
  25. 5
      vsprojects/vs2013/grpc_shared.vcxproj
  26. 9
      vsprojects/vs2013/grpc_shared.vcxproj.filters
  27. 5
      vsprojects/vs2013/grpc_unsecure.vcxproj
  28. 9
      vsprojects/vs2013/grpc_unsecure.vcxproj.filters

@ -2328,6 +2328,7 @@ LIBGRPC_SRC = \
src/core/security/secure_transport_setup.c \
src/core/security/security_context.c \
src/core/security/server_secure_chttp2.c \
src/core/surface/init_secure.c \
src/core/surface/secure_channel_create.c \
src/core/surface/secure_server_create.c \
src/core/tsi/fake_transport_security.c \
@ -2407,6 +2408,7 @@ LIBGRPC_SRC = \
src/core/surface/server.c \
src/core/surface/server_chttp2.c \
src/core/surface/server_create.c \
src/core/surface/surface_trace.c \
src/core/transport/chttp2/alpn.c \
src/core/transport/chttp2/bin_encoder.c \
src/core/transport/chttp2/frame_data.c \
@ -2472,6 +2474,7 @@ src/core/security/secure_endpoint.c: $(OPENSSL_DEP)
src/core/security/secure_transport_setup.c: $(OPENSSL_DEP)
src/core/security/security_context.c: $(OPENSSL_DEP)
src/core/security/server_secure_chttp2.c: $(OPENSSL_DEP)
src/core/surface/init_secure.c: $(OPENSSL_DEP)
src/core/surface/secure_channel_create.c: $(OPENSSL_DEP)
src/core/surface/secure_server_create.c: $(OPENSSL_DEP)
src/core/tsi/fake_transport_security.c: $(OPENSSL_DEP)
@ -2551,6 +2554,7 @@ src/core/surface/metadata_array.c: $(OPENSSL_DEP)
src/core/surface/server.c: $(OPENSSL_DEP)
src/core/surface/server_chttp2.c: $(OPENSSL_DEP)
src/core/surface/server_create.c: $(OPENSSL_DEP)
src/core/surface/surface_trace.c: $(OPENSSL_DEP)
src/core/transport/chttp2/alpn.c: $(OPENSSL_DEP)
src/core/transport/chttp2/bin_encoder.c: $(OPENSSL_DEP)
src/core/transport/chttp2/frame_data.c: $(OPENSSL_DEP)
@ -2633,6 +2637,7 @@ $(OBJDIR)/$(CONFIG)/src/core/security/secure_endpoint.o:
$(OBJDIR)/$(CONFIG)/src/core/security/secure_transport_setup.o:
$(OBJDIR)/$(CONFIG)/src/core/security/security_context.o:
$(OBJDIR)/$(CONFIG)/src/core/security/server_secure_chttp2.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/init_secure.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/secure_channel_create.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/secure_server_create.o:
$(OBJDIR)/$(CONFIG)/src/core/tsi/fake_transport_security.o:
@ -2712,6 +2717,7 @@ $(OBJDIR)/$(CONFIG)/src/core/surface/metadata_array.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/server.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/server_chttp2.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/server_create.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/surface_trace.o:
$(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/alpn.o:
$(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/bin_encoder.o:
$(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/frame_data.o:
@ -2811,6 +2817,7 @@ $(OBJDIR)/$(CONFIG)/test/core/util/slice_splitter.o:
LIBGRPC_UNSECURE_SRC = \
src/core/surface/init_unsecure.c \
src/core/channel/call_op_string.c \
src/core/channel/census_filter.c \
src/core/channel/channel_args.c \
@ -2885,6 +2892,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/surface/server.c \
src/core/surface/server_chttp2.c \
src/core/surface/server_create.c \
src/core/surface/surface_trace.c \
src/core/transport/chttp2/alpn.c \
src/core/transport/chttp2/bin_encoder.c \
src/core/transport/chttp2/frame_data.c \
@ -2947,6 +2955,7 @@ ifneq ($(NO_DEPS),true)
-include $(LIBGRPC_UNSECURE_OBJS:.o=.dep)
endif
$(OBJDIR)/$(CONFIG)/src/core/surface/init_unsecure.o:
$(OBJDIR)/$(CONFIG)/src/core/channel/call_op_string.o:
$(OBJDIR)/$(CONFIG)/src/core/channel/census_filter.o:
$(OBJDIR)/$(CONFIG)/src/core/channel/channel_args.o:
@ -3021,6 +3030,7 @@ $(OBJDIR)/$(CONFIG)/src/core/surface/metadata_array.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/server.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/server_chttp2.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/server_create.o:
$(OBJDIR)/$(CONFIG)/src/core/surface/surface_trace.o:
$(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/alpn.o:
$(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/bin_encoder.o:
$(OBJDIR)/$(CONFIG)/src/core/transport/chttp2/frame_data.o:

@ -79,6 +79,7 @@
"src/core/surface/client.h",
"src/core/surface/completion_queue.h",
"src/core/surface/event_string.h",
"src/core/surface/init.h",
"src/core/surface/lame_client.h",
"src/core/surface/server.h",
"src/core/surface/surface_trace.h",
@ -180,6 +181,7 @@
"src/core/surface/server.c",
"src/core/surface/server_chttp2.c",
"src/core/surface/server_create.c",
"src/core/surface/surface_trace.c",
"src/core/transport/chttp2/alpn.c",
"src/core/transport/chttp2/bin_encoder.c",
"src/core/transport/chttp2/frame_data.c",
@ -329,6 +331,7 @@
"src/core/security/secure_transport_setup.c",
"src/core/security/security_context.c",
"src/core/security/server_secure_chttp2.c",
"src/core/surface/init_secure.c",
"src/core/surface/secure_channel_create.c",
"src/core/surface/secure_server_create.c",
"src/core/tsi/fake_transport_security.c",
@ -372,6 +375,9 @@
"name": "grpc_unsecure",
"build": "all",
"language": "c",
"src": [
"src/core/surface/init_unsecure.c"
],
"deps": [
"gpr"
],

@ -36,6 +36,8 @@
#include <stdlib.h>
int grpc_trace_channel = 0;
/* Memory layouts.
Channel stack is laid out as: {

@ -298,7 +298,9 @@ void grpc_call_element_recv_metadata(grpc_call_element *cur_elem,
void grpc_call_element_send_cancel(grpc_call_element *cur_elem);
void grpc_call_element_send_finish(grpc_call_element *cur_elem);
extern int grpc_trace_channel;
#define GRPC_CALL_LOG_OP(sev, elem, op) \
if (grpc_trace_bits & GRPC_TRACE_CHANNEL) grpc_call_log_op(sev, elem, op)
if (grpc_trace_channel) grpc_call_log_op(sev, elem, op)
#endif /* GRPC_INTERNAL_CORE_CHANNEL_CHANNEL_STACK_H */

@ -39,8 +39,21 @@
#include <grpc/support/log.h>
#include "src/core/support/env.h"
#if GRPC_ENABLE_TRACING
gpr_uint32 grpc_trace_bits = 0;
typedef struct tracer {
const char *name;
int *flag;
struct tracer *next;
} tracer;
static tracer *tracers;
void grpc_register_tracer(const char *name, int *flag) {
tracer *t = gpr_malloc(sizeof(*t));
t->name = name;
t->flag = flag;
t->next = tracers;
*flag = 0;
tracers = t;
}
static void add(const char *beg, const char *end, char ***ss, size_t *ns) {
size_t n = *ns;
@ -67,26 +80,26 @@ static void parse(const char *s) {
char **strings = NULL;
size_t nstrings = 0;
size_t i;
tracer *t;
split(s, &strings, &nstrings);
grpc_trace_bits = 0;
for (i = 0; i < nstrings; i++) {
const char *s = strings[i];
if (0 == strcmp(s, "surface")) {
grpc_trace_bits |= GRPC_TRACE_SURFACE;
} else if (0 == strcmp(s, "channel")) {
grpc_trace_bits |= GRPC_TRACE_CHANNEL;
} else if (0 == strcmp(s, "tcp")) {
grpc_trace_bits |= GRPC_TRACE_TCP;
} else if (0 == strcmp(s, "secure_endpoint")) {
grpc_trace_bits |= GRPC_TRACE_SECURE_ENDPOINT;
} else if (0 == strcmp(s, "http")) {
grpc_trace_bits |= GRPC_TRACE_HTTP;
} else if (0 == strcmp(s, "all")) {
grpc_trace_bits = -1;
if (0 == strcmp(s, "all")) {
for (t = tracers; t; t = t->next) {
*t->flag = 1;
}
} else {
gpr_log(GPR_ERROR, "Unknown trace var: '%s'", s);
int found = 0;
for (t = tracers; t; t = t->next) {
if (0 == strcmp(s, t->name)) {
*t->flag = 1;
found = 1;
}
}
if (!found) {
gpr_log(GPR_ERROR, "Unknown trace var: '%s'", s);
}
}
}
@ -96,17 +109,15 @@ static void parse(const char *s) {
gpr_free(strings);
}
void grpc_init_trace_bits() {
char *e = gpr_getenv("GRPC_TRACE");
if (e == NULL) {
grpc_trace_bits = 0;
} else {
void grpc_tracer_init(const char *env_var) {
char *e = gpr_getenv(env_var);
if (e != NULL) {
parse(e);
gpr_free(e);
}
while (tracers) {
tracer *t = tracers;
tracers = t->next;
gpr_free(t);
}
}
#else
void grpc_init_trace_bits() {
}
#endif

@ -36,25 +36,7 @@
#include <grpc/support/port_platform.h>
/* set to zero to remove all debug trace code */
#ifndef GRPC_ENABLE_TRACING
# define GRPC_ENABLE_TRACING 1
#endif
typedef enum {
GRPC_TRACE_SURFACE = 1 << 0,
GRPC_TRACE_CHANNEL = 1 << 1,
GRPC_TRACE_TCP = 1 << 2,
GRPC_TRACE_SECURE_ENDPOINT = 1 << 3,
GRPC_TRACE_HTTP = 1 << 4
} grpc_trace_bit_value;
#if GRPC_ENABLE_TRACING
extern gpr_uint32 grpc_trace_bits;
#else
# define grpc_trace_bits 0
#endif
void grpc_init_trace_bits();
void grpc_register_tracer(const char *name, int *flag);
void grpc_tracer_init(const char *env_var_name);
#endif /* GRPC_INTERNAL_CORE_DEBUG_TRACE_H */

@ -36,11 +36,14 @@
#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"
void grpc_iomgr_platform_init(void) {
grpc_fd_global_init();
grpc_pollset_global_init();
grpc_register_tracer("tcp", &grpc_tcp_trace);
}
void grpc_iomgr_platform_shutdown(void) {

@ -63,6 +63,8 @@ typedef struct grpc_tcp_slice_state {
int memory_owned; /* True if slices array is owned */
} grpc_tcp_slice_state;
int grpc_tcp_trace = 0;
static void slice_state_init(grpc_tcp_slice_state *state, gpr_slice *slices,
size_t nslices, size_t valid_slices) {
state->slices = slices;
@ -294,7 +296,7 @@ static void call_read_cb(grpc_tcp *tcp, gpr_slice *slices, size_t nslices,
grpc_endpoint_cb_status status) {
grpc_endpoint_read_cb cb = tcp->read_cb;
if (grpc_trace_bits & GRPC_TRACE_TCP) {
if (grpc_tcp_trace) {
size_t i;
gpr_log(GPR_DEBUG, "read: status=%d", status);
for (i = 0; i < nslices; i++) {
@ -495,7 +497,7 @@ static grpc_endpoint_write_status grpc_tcp_write(grpc_endpoint *ep,
grpc_tcp *tcp = (grpc_tcp *)ep;
grpc_endpoint_write_status status;
if (grpc_trace_bits & GRPC_TRACE_TCP) {
if (grpc_tcp_trace) {
size_t i;
for (i = 0; i < nslices; i++) {

@ -49,6 +49,8 @@
#define GRPC_TCP_DEFAULT_READ_SLICE_SIZE 8192
extern int grpc_tcp_trace;
/* Create a tcp endpoint given a file desciptor and a read slice size.
Takes ownership of fd. */
grpc_endpoint *grpc_tcp_create(grpc_fd *fd, size_t read_slice_size);

@ -65,6 +65,8 @@ typedef struct {
gpr_refcount ref;
} secure_endpoint;
int grpc_trace_secure_endpoint = 0;
static void secure_endpoint_ref(secure_endpoint *ep) { gpr_ref(&ep->ref); }
static void destroy(secure_endpoint *secure_ep) {
@ -96,7 +98,7 @@ static void flush_read_staging_buffer(secure_endpoint *ep, gpr_uint8 **cur,
static void call_read_cb(secure_endpoint *ep, gpr_slice *slices, size_t nslices,
grpc_endpoint_cb_status error) {
if (grpc_trace_bits & GRPC_TRACE_SECURE_ENDPOINT) {
if (grpc_trace_secure_endpoint) {
size_t i;
for (i = 0; i < nslices; i++) {
char *data =
@ -231,7 +233,7 @@ static grpc_endpoint_write_status endpoint_write(grpc_endpoint *secure_ep,
grpc_endpoint_write_status status;
GPR_ASSERT(ep->output_buffer.count == 0);
if (grpc_trace_bits & GRPC_TRACE_SECURE_ENDPOINT) {
if (grpc_trace_secure_endpoint) {
for (i = 0; i < nslices; i++) {
char *data =
gpr_hexdump((char *)GPR_SLICE_START_PTR(slices[i]),

@ -39,6 +39,8 @@
struct tsi_frame_protector;
extern int grpc_trace_secure_endpoint;
/* Takes ownership of protector and to_wrap, and refs leftover_slices. */
grpc_endpoint *grpc_secure_endpoint_create(
struct tsi_frame_protector *protector, grpc_endpoint *to_wrap,

@ -35,6 +35,10 @@
#include "src/core/iomgr/iomgr.h"
#include "src/core/debug/trace.h"
#include "src/core/statistics/census_interface.h"
#include "src/core/channel/channel_stack.h"
#include "src/core/surface/init.h"
#include "src/core/surface/surface_trace.h"
#include "src/core/transport/chttp2_transport.h"
static gpr_once g_init = GPR_ONCE_INIT;
static gpr_mu g_init_mu;
@ -50,7 +54,11 @@ void grpc_init(void) {
gpr_mu_lock(&g_init_mu);
if (++g_initializations == 1) {
grpc_init_trace_bits();
grpc_register_tracer("channel", &grpc_trace_channel);
grpc_register_tracer("surface", &grpc_surface_trace);
grpc_register_tracer("http", &grpc_http_trace);
grpc_security_pre_init();
grpc_tracer_init("GRPC_TRACE");
grpc_iomgr_init();
census_init();
}

@ -0,0 +1,39 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_INTERNAL_CORE_SURFACE_INIT_H
#define GRPC_INTERNAL_CORE_SURFACE_INIT_H
void grpc_security_pre_init(void);
#endif /* GRPC_INTERNAL_CORE_SURFACE_INIT_H */

@ -0,0 +1,42 @@
/*
*
* 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/surface/init.h"
#include "src/core/debug/trace.h"
#include "src/core/security/secure_endpoint.h"
#include "src/core/tsi/transport_security_interface.h"
void grpc_security_pre_init(void) {
grpc_register_tracer("secure_endpoint", &grpc_trace_secure_endpoint);
grpc_register_tracer("transport_security", &tsi_tracing_enabled);
}

@ -0,0 +1,37 @@
/*
*
* 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/surface/init.h"
void grpc_security_pre_init(void) {
}

@ -0,0 +1,36 @@
/*
*
* 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/surface/surface_trace.h"
int grpc_surface_trace = 0;

@ -37,8 +37,10 @@
#include "src/core/debug/trace.h"
#include <grpc/support/log.h>
extern int grpc_surface_trace;
#define GRPC_SURFACE_TRACE_RETURNED_EVENT(cq, event) \
if (grpc_trace_bits & GRPC_TRACE_SURFACE) { \
if (grpc_surface_trace) { \
char *_ev = grpc_event_string(event); \
gpr_log(GPR_INFO, "RETURN_EVENT[%p]: %s", cq, _ev); \
gpr_free(_ev); \

@ -37,6 +37,7 @@
#include "src/core/debug/trace.h"
#include "src/core/transport/chttp2/frame.h"
#include "src/core/transport/chttp2_transport.h"
#include <grpc/support/log.h>
#include <grpc/support/useful.h>
@ -218,7 +219,7 @@ grpc_chttp2_parse_error grpc_chttp2_settings_parser_parse(
}
}
parser->incoming_settings[parser->id] = parser->value;
if (grpc_trace_bits & GRPC_TRACE_HTTP) {
if (grpc_http_trace) {
gpr_log(GPR_DEBUG, "CHTTP2: got setting %d = %d", parser->id,
parser->value);
}

@ -37,7 +37,6 @@
#include <stdio.h>
#include <string.h>
#include "src/core/debug/trace.h"
#include "src/core/support/string.h"
#include "src/core/transport/chttp2/frame_data.h"
#include "src/core/transport/chttp2/frame_goaway.h"
@ -64,11 +63,13 @@
#define CLIENT_CONNECT_STRING "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
#define CLIENT_CONNECT_STRLEN 24
int grpc_http_trace = 0;
typedef struct transport transport;
typedef struct stream stream;
#define IF_TRACING(stmt) \
if (!(grpc_trace_bits & GRPC_TRACE_HTTP)) \
if (!(grpc_http_trace)) \
; \
else \
stmt

@ -37,6 +37,8 @@
#include "src/core/iomgr/endpoint.h"
#include "src/core/transport/transport.h"
extern int grpc_http_trace;
void grpc_create_chttp2_transport(grpc_transport_setup_callback setup,
void *arg,
const grpc_channel_args *channel_args,

@ -40,10 +40,6 @@
int tsi_tracing_enabled = 0;
void tsi_enable_tracing() {
tsi_tracing_enabled = 1;
}
/* --- Utils. --- */
char* tsi_strdup(const char* src) {

@ -63,8 +63,8 @@ const char* tsi_result_to_string(tsi_result result);
/* --- tsi tracing --- */
/* Call this function before any other tsi function to avoid races. */
void tsi_enable_tracing(void);
/* Set this early to avoid races */
extern int tsi_tracing_enabled;
/* --- tsi_frame_protector object ---

@ -160,6 +160,7 @@
<ClInclude Include="..\..\src\core\surface\client.h" />
<ClInclude Include="..\..\src\core\surface\completion_queue.h" />
<ClInclude Include="..\..\src\core\surface\event_string.h" />
<ClInclude Include="..\..\src\core\surface\init.h" />
<ClInclude Include="..\..\src\core\surface\lame_client.h" />
<ClInclude Include="..\..\src\core\surface\server.h" />
<ClInclude Include="..\..\src\core\surface\surface_trace.h" />
@ -219,6 +220,8 @@
</ClCompile>
<ClCompile Include="..\..\src\core\security\server_secure_chttp2.c">
</ClCompile>
<ClCompile Include="..\..\src\core\surface\init_secure.c">
</ClCompile>
<ClCompile Include="..\..\src\core\surface\secure_channel_create.c">
</ClCompile>
<ClCompile Include="..\..\src\core\surface\secure_server_create.c">
@ -377,6 +380,8 @@
</ClCompile>
<ClCompile Include="..\..\src\core\surface\server_create.c">
</ClCompile>
<ClCompile Include="..\..\src\core\surface\surface_trace.c">
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\alpn.c">
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\bin_encoder.c">

@ -49,6 +49,9 @@
<ClCompile Include="..\..\src\core\security\server_secure_chttp2.c">
<Filter>src\core\security</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\surface\init_secure.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\surface\secure_channel_create.c">
<Filter>src\core\surface</Filter>
</ClCompile>
@ -286,6 +289,9 @@
<ClCompile Include="..\..\src\core\surface\server_create.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\surface\surface_trace.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\alpn.c">
<Filter>src\core\transport\chttp2</Filter>
</ClCompile>
@ -590,6 +596,9 @@
<ClInclude Include="..\..\src\core\surface\event_string.h">
<Filter>src\core\surface</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\surface\init.h">
<Filter>src\core\surface</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\surface\lame_client.h">
<Filter>src\core\surface</Filter>
</ClInclude>

@ -164,6 +164,7 @@
<ClInclude Include="..\..\src\core\surface\client.h" />
<ClInclude Include="..\..\src\core\surface\completion_queue.h" />
<ClInclude Include="..\..\src\core\surface\event_string.h" />
<ClInclude Include="..\..\src\core\surface\init.h" />
<ClInclude Include="..\..\src\core\surface\lame_client.h" />
<ClInclude Include="..\..\src\core\surface\server.h" />
<ClInclude Include="..\..\src\core\surface\surface_trace.h" />
@ -223,6 +224,8 @@
</ClCompile>
<ClCompile Include="..\..\src\core\security\server_secure_chttp2.c">
</ClCompile>
<ClCompile Include="..\..\src\core\surface\init_secure.c">
</ClCompile>
<ClCompile Include="..\..\src\core\surface\secure_channel_create.c">
</ClCompile>
<ClCompile Include="..\..\src\core\surface\secure_server_create.c">
@ -381,6 +384,8 @@
</ClCompile>
<ClCompile Include="..\..\src\core\surface\server_create.c">
</ClCompile>
<ClCompile Include="..\..\src\core\surface\surface_trace.c">
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\alpn.c">
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\bin_encoder.c">

@ -49,6 +49,9 @@
<ClCompile Include="..\..\src\core\security\server_secure_chttp2.c">
<Filter>src\core\security</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\surface\init_secure.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\surface\secure_channel_create.c">
<Filter>src\core\surface</Filter>
</ClCompile>
@ -286,6 +289,9 @@
<ClCompile Include="..\..\src\core\surface\server_create.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\surface\surface_trace.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\alpn.c">
<Filter>src\core\transport\chttp2</Filter>
</ClCompile>
@ -590,6 +596,9 @@
<ClInclude Include="..\..\src\core\surface\event_string.h">
<Filter>src\core\surface</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\surface\init.h">
<Filter>src\core\surface</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\surface\lame_client.h">
<Filter>src\core\surface</Filter>
</ClInclude>

@ -145,6 +145,7 @@
<ClInclude Include="..\..\src\core\surface\client.h" />
<ClInclude Include="..\..\src\core\surface\completion_queue.h" />
<ClInclude Include="..\..\src\core\surface\event_string.h" />
<ClInclude Include="..\..\src\core\surface\init.h" />
<ClInclude Include="..\..\src\core\surface\lame_client.h" />
<ClInclude Include="..\..\src\core\surface\server.h" />
<ClInclude Include="..\..\src\core\surface\surface_trace.h" />
@ -172,6 +173,8 @@
<ClInclude Include="..\..\src\core\transport\transport_impl.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\core\surface\init_unsecure.c">
</ClCompile>
<ClCompile Include="..\..\src\core\channel\call_op_string.c">
</ClCompile>
<ClCompile Include="..\..\src\core\channel\census_filter.c">
@ -320,6 +323,8 @@
</ClCompile>
<ClCompile Include="..\..\src\core\surface\server_create.c">
</ClCompile>
<ClCompile Include="..\..\src\core\surface\surface_trace.c">
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\alpn.c">
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\bin_encoder.c">

@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="..\..\src\core\surface\init_unsecure.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\channel\call_op_string.c">
<Filter>src\core\channel</Filter>
</ClCompile>
@ -223,6 +226,9 @@
<ClCompile Include="..\..\src\core\surface\server_create.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\surface\surface_trace.c">
<Filter>src\core\surface</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\transport\chttp2\alpn.c">
<Filter>src\core\transport\chttp2</Filter>
</ClCompile>
@ -482,6 +488,9 @@
<ClInclude Include="..\..\src\core\surface\event_string.h">
<Filter>src\core\surface</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\surface\init.h">
<Filter>src\core\surface</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\surface\lame_client.h">
<Filter>src\core\surface</Filter>
</ClInclude>

Loading…
Cancel
Save