mirror of https://github.com/grpc/grpc.git
Merge pull request #5304 from ctiller/filter-selection
Decouple filter selection from channel constructionpull/5733/head^2
commit
6e96e5ccab
58 changed files with 5181 additions and 1978 deletions
@ -0,0 +1,72 @@ |
||||
/*
|
||||
* |
||||
* 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/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" |
||||
|
||||
static bool maybe_add_census_filter(grpc_channel_stack_builder *builder, |
||||
void *arg_must_be_null) { |
||||
const grpc_channel_args *args = |
||||
grpc_channel_stack_builder_get_channel_arguments(builder); |
||||
if (grpc_channel_args_is_census_enabled(args)) { |
||||
return grpc_channel_stack_builder_prepend_filter( |
||||
builder, &grpc_client_census_filter, NULL, NULL); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
void census_grpc_plugin_init(void) { |
||||
/* Only initialize census if no one else has and some features are
|
||||
* available. */ |
||||
if (census_enabled() == CENSUS_FEATURE_NONE && |
||||
census_supported() != CENSUS_FEATURE_NONE) { |
||||
if (census_initialize(census_supported())) { /* enable all features. */ |
||||
gpr_log(GPR_ERROR, "Could not initialize census."); |
||||
} |
||||
} |
||||
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); |
||||
} |
||||
|
||||
void census_grpc_plugin_destroy(void) { census_shutdown(); } |
@ -0,0 +1,259 @@ |
||||
/*
|
||||
* |
||||
* 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/channel/channel_stack_builder.h" |
||||
|
||||
#include <string.h> |
||||
|
||||
#include <grpc/support/alloc.h> |
||||
|
||||
int grpc_trace_channel_stack_builder = 0; |
||||
|
||||
typedef struct filter_node { |
||||
struct filter_node *next; |
||||
struct filter_node *prev; |
||||
const grpc_channel_filter *filter; |
||||
grpc_post_filter_create_init_func init; |
||||
void *init_arg; |
||||
} filter_node; |
||||
|
||||
struct grpc_channel_stack_builder { |
||||
// sentinel nodes for filters that have been added
|
||||
filter_node begin; |
||||
filter_node end; |
||||
// various set/get-able parameters
|
||||
const grpc_channel_args *args; |
||||
grpc_transport *transport; |
||||
const char *name; |
||||
}; |
||||
|
||||
struct grpc_channel_stack_builder_iterator { |
||||
grpc_channel_stack_builder *builder; |
||||
filter_node *node; |
||||
}; |
||||
|
||||
grpc_channel_stack_builder *grpc_channel_stack_builder_create(void) { |
||||
grpc_channel_stack_builder *b = gpr_malloc(sizeof(*b)); |
||||
memset(b, 0, sizeof(*b)); |
||||
|
||||
b->begin.filter = NULL; |
||||
b->end.filter = NULL; |
||||
b->begin.next = &b->end; |
||||
b->begin.prev = &b->end; |
||||
b->end.next = &b->begin; |
||||
b->end.prev = &b->begin; |
||||
|
||||
return b; |
||||
} |
||||
|
||||
static grpc_channel_stack_builder_iterator *create_iterator_at_filter_node( |
||||
grpc_channel_stack_builder *builder, filter_node *node) { |
||||
grpc_channel_stack_builder_iterator *it = gpr_malloc(sizeof(*it)); |
||||
it->builder = builder; |
||||
it->node = node; |
||||
return it; |
||||
} |
||||
|
||||
void grpc_channel_stack_builder_iterator_destroy( |
||||
grpc_channel_stack_builder_iterator *it) { |
||||
gpr_free(it); |
||||
} |
||||
|
||||
grpc_channel_stack_builder_iterator * |
||||
grpc_channel_stack_builder_create_iterator_at_first( |
||||
grpc_channel_stack_builder *builder) { |
||||
return create_iterator_at_filter_node(builder, &builder->begin); |
||||
} |
||||
|
||||
grpc_channel_stack_builder_iterator * |
||||
grpc_channel_stack_builder_create_iterator_at_last( |
||||
grpc_channel_stack_builder *builder) { |
||||
return create_iterator_at_filter_node(builder, &builder->end); |
||||
} |
||||
|
||||
bool grpc_channel_stack_builder_move_next( |
||||
grpc_channel_stack_builder_iterator *iterator) { |
||||
if (iterator->node == &iterator->builder->end) return false; |
||||
iterator->node = iterator->node->next; |
||||
return true; |
||||
} |
||||
|
||||
bool grpc_channel_stack_builder_move_prev( |
||||
grpc_channel_stack_builder_iterator *iterator) { |
||||
if (iterator->node == &iterator->builder->begin) return false; |
||||
iterator->node = iterator->node->prev; |
||||
return true; |
||||
} |
||||
|
||||
bool grpc_channel_stack_builder_move_prev( |
||||
grpc_channel_stack_builder_iterator *iterator); |
||||
|
||||
void grpc_channel_stack_builder_set_name(grpc_channel_stack_builder *builder, |
||||
const char *name) { |
||||
GPR_ASSERT(builder->name == NULL); |
||||
builder->name = name; |
||||
} |
||||
|
||||
void grpc_channel_stack_builder_set_channel_arguments( |
||||
grpc_channel_stack_builder *builder, const grpc_channel_args *args) { |
||||
GPR_ASSERT(builder->args == NULL); |
||||
builder->args = args; |
||||
} |
||||
|
||||
void grpc_channel_stack_builder_set_transport( |
||||
grpc_channel_stack_builder *builder, grpc_transport *transport) { |
||||
GPR_ASSERT(builder->transport == NULL); |
||||
builder->transport = transport; |
||||
} |
||||
|
||||
grpc_transport *grpc_channel_stack_builder_get_transport( |
||||
grpc_channel_stack_builder *builder) { |
||||
return builder->transport; |
||||
} |
||||
|
||||
const grpc_channel_args *grpc_channel_stack_builder_get_channel_arguments( |
||||
grpc_channel_stack_builder *builder) { |
||||
return builder->args; |
||||
} |
||||
|
||||
bool grpc_channel_stack_builder_append_filter( |
||||
grpc_channel_stack_builder *builder, const grpc_channel_filter *filter, |
||||
grpc_post_filter_create_init_func post_init_func, void *user_data) { |
||||
grpc_channel_stack_builder_iterator *it = |
||||
grpc_channel_stack_builder_create_iterator_at_last(builder); |
||||
bool ok = grpc_channel_stack_builder_add_filter_before( |
||||
it, filter, post_init_func, user_data); |
||||
grpc_channel_stack_builder_iterator_destroy(it); |
||||
return ok; |
||||
} |
||||
|
||||
bool grpc_channel_stack_builder_prepend_filter( |
||||
grpc_channel_stack_builder *builder, const grpc_channel_filter *filter, |
||||
grpc_post_filter_create_init_func post_init_func, void *user_data) { |
||||
grpc_channel_stack_builder_iterator *it = |
||||
grpc_channel_stack_builder_create_iterator_at_first(builder); |
||||
bool ok = grpc_channel_stack_builder_add_filter_after( |
||||
it, filter, post_init_func, user_data); |
||||
grpc_channel_stack_builder_iterator_destroy(it); |
||||
return ok; |
||||
} |
||||
|
||||
static void add_after(filter_node *before, const grpc_channel_filter *filter, |
||||
grpc_post_filter_create_init_func post_init_func, |
||||
void *user_data) { |
||||
filter_node *new = gpr_malloc(sizeof(*new)); |
||||
new->next = before->next; |
||||
new->prev = before; |
||||
new->next->prev = new->prev->next = new; |
||||
new->filter = filter; |
||||
new->init = post_init_func; |
||||
new->init_arg = user_data; |
||||
} |
||||
|
||||
bool grpc_channel_stack_builder_add_filter_before( |
||||
grpc_channel_stack_builder_iterator *iterator, |
||||
const grpc_channel_filter *filter, |
||||
grpc_post_filter_create_init_func post_init_func, void *user_data) { |
||||
if (iterator->node == &iterator->builder->begin) return false; |
||||
add_after(iterator->node->prev, filter, post_init_func, user_data); |
||||
return true; |
||||
} |
||||
|
||||
bool grpc_channel_stack_builder_add_filter_after( |
||||
grpc_channel_stack_builder_iterator *iterator, |
||||
const grpc_channel_filter *filter, |
||||
grpc_post_filter_create_init_func post_init_func, void *user_data) { |
||||
if (iterator->node == &iterator->builder->end) return false; |
||||
add_after(iterator->node, filter, post_init_func, user_data); |
||||
return true; |
||||
} |
||||
|
||||
void grpc_channel_stack_builder_destroy(grpc_channel_stack_builder *builder) { |
||||
filter_node *p = builder->begin.next; |
||||
while (p != &builder->end) { |
||||
filter_node *next = p->next; |
||||
gpr_free(p); |
||||
p = next; |
||||
} |
||||
gpr_free(builder); |
||||
} |
||||
|
||||
void *grpc_channel_stack_builder_finish(grpc_exec_ctx *exec_ctx, |
||||
grpc_channel_stack_builder *builder, |
||||
size_t prefix_bytes, int initial_refs, |
||||
grpc_iomgr_cb_func destroy, |
||||
void *destroy_arg) { |
||||
// 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++; |
||||
} |
||||
|
||||
// create an array of filters
|
||||
const grpc_channel_filter **filters = |
||||
gpr_malloc(sizeof(*filters) * num_filters); |
||||
size_t i = 0; |
||||
for (filter_node *p = builder->begin.next; p != &builder->end; p = p->next) { |
||||
filters[i++] = p->filter; |
||||
} |
||||
|
||||
// calculate the size of the channel stack
|
||||
size_t channel_stack_size = grpc_channel_stack_size(filters, num_filters); |
||||
|
||||
// allocate memory, with prefix_bytes followed by channel_stack_size
|
||||
char *result = gpr_malloc(prefix_bytes + channel_stack_size); |
||||
// fetch a pointer to the channel stack
|
||||
grpc_channel_stack *channel_stack = |
||||
(grpc_channel_stack *)(result + prefix_bytes); |
||||
// and initialize it
|
||||
grpc_channel_stack_init(exec_ctx, initial_refs, destroy, |
||||
destroy_arg == NULL ? result : destroy_arg, filters, |
||||
num_filters, builder->args, builder->name, |
||||
channel_stack); |
||||
|
||||
// run post-initialization functions
|
||||
i = 0; |
||||
for (filter_node *p = builder->begin.next; p != &builder->end; p = p->next) { |
||||
if (p->init != NULL) { |
||||
p->init(channel_stack, grpc_channel_stack_element(channel_stack, i), |
||||
p->init_arg); |
||||
} |
||||
i++; |
||||
} |
||||
|
||||
grpc_channel_stack_builder_destroy(builder); |
||||
gpr_free((grpc_channel_filter **)filters); |
||||
|
||||
return result; |
||||
} |
@ -0,0 +1,155 @@ |
||||
/*
|
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef GRPC_CORE_CHANNEL_CHANNEL_STACK_BUILDER_H |
||||
#define GRPC_CORE_CHANNEL_CHANNEL_STACK_BUILDER_H |
||||
|
||||
#include <stdbool.h> |
||||
|
||||
#include "src/core/channel/channel_args.h" |
||||
#include "src/core/channel/channel_stack.h" |
||||
|
||||
/// grpc_channel_stack_builder offers a programmatic interface to selected
|
||||
/// and order channel filters
|
||||
typedef struct grpc_channel_stack_builder grpc_channel_stack_builder; |
||||
typedef struct grpc_channel_stack_builder_iterator |
||||
grpc_channel_stack_builder_iterator; |
||||
|
||||
/// Create a new channel stack builder
|
||||
grpc_channel_stack_builder *grpc_channel_stack_builder_create(void); |
||||
|
||||
/// Assign a name to the channel stack: \a name must be statically allocated
|
||||
void grpc_channel_stack_builder_set_name(grpc_channel_stack_builder *builder, |
||||
const char *name); |
||||
|
||||
/// Attach \a transport to the builder (does not take ownership)
|
||||
void grpc_channel_stack_builder_set_transport( |
||||
grpc_channel_stack_builder *builder, grpc_transport *transport); |
||||
|
||||
/// Fetch attached transport
|
||||
grpc_transport *grpc_channel_stack_builder_get_transport( |
||||
grpc_channel_stack_builder *builder); |
||||
|
||||
/// Set channel arguments: \a args must continue to exist until after
|
||||
/// grpc_channel_stack_builder_finish returns
|
||||
void grpc_channel_stack_builder_set_channel_arguments( |
||||
grpc_channel_stack_builder *builder, const grpc_channel_args *args); |
||||
|
||||
/// Return a borrowed pointer to the channel arguments
|
||||
const grpc_channel_args *grpc_channel_stack_builder_get_channel_arguments( |
||||
grpc_channel_stack_builder *builder); |
||||
|
||||
/// Begin iterating over already defined filters in the builder at the beginning
|
||||
grpc_channel_stack_builder_iterator * |
||||
grpc_channel_stack_builder_create_iterator_at_first( |
||||
grpc_channel_stack_builder *builder); |
||||
|
||||
/// Begin iterating over already defined filters in the builder at the end
|
||||
grpc_channel_stack_builder_iterator * |
||||
grpc_channel_stack_builder_create_iterator_at_last( |
||||
grpc_channel_stack_builder *builder); |
||||
|
||||
/// Is an iterator at the first element?
|
||||
bool grpc_channel_stack_builder_iterator_is_first( |
||||
grpc_channel_stack_builder_iterator *iterator); |
||||
|
||||
/// Is an iterator at the end?
|
||||
bool grpc_channel_stack_builder_iterator_is_end( |
||||
grpc_channel_stack_builder_iterator *iterator); |
||||
|
||||
/// Move an iterator to the next item
|
||||
bool grpc_channel_stack_builder_move_next( |
||||
grpc_channel_stack_builder_iterator *iterator); |
||||
|
||||
/// Move an iterator to the previous item
|
||||
bool grpc_channel_stack_builder_move_prev( |
||||
grpc_channel_stack_builder_iterator *iterator); |
||||
|
||||
typedef void (*grpc_post_filter_create_init_func)( |
||||
grpc_channel_stack *channel_stack, grpc_channel_element *elem, void *arg); |
||||
|
||||
/// Add \a filter to the stack, after \a iterator.
|
||||
/// Call \a post_init_func(..., \a user_data) once the channel stack is
|
||||
/// created.
|
||||
bool grpc_channel_stack_builder_add_filter_after( |
||||
grpc_channel_stack_builder_iterator *iterator, |
||||
const grpc_channel_filter *filter, |
||||
grpc_post_filter_create_init_func post_init_func, |
||||
void *user_data) GRPC_MUST_USE_RESULT; |
||||
|
||||
/// Add \a filter to the stack, before \a iterator.
|
||||
/// Call \a post_init_func(..., \a user_data) once the channel stack is
|
||||
/// created.
|
||||
bool grpc_channel_stack_builder_add_filter_before( |
||||
grpc_channel_stack_builder_iterator *iterator, |
||||
const grpc_channel_filter *filter, |
||||
grpc_post_filter_create_init_func post_init_func, |
||||
void *user_data) GRPC_MUST_USE_RESULT; |
||||
|
||||
/// Add \a filter to the beginning of the filter list.
|
||||
/// Call \a post_init_func(..., \a user_data) once the channel stack is
|
||||
/// created.
|
||||
bool grpc_channel_stack_builder_prepend_filter( |
||||
grpc_channel_stack_builder *builder, const grpc_channel_filter *filter, |
||||
grpc_post_filter_create_init_func post_init_func, |
||||
void *user_data) GRPC_MUST_USE_RESULT; |
||||
|
||||
/// Add \a filter to the end of the filter list.
|
||||
/// Call \a post_init_func(..., \a user_data) once the channel stack is
|
||||
/// created.
|
||||
bool grpc_channel_stack_builder_append_filter( |
||||
grpc_channel_stack_builder *builder, const grpc_channel_filter *filter, |
||||
grpc_post_filter_create_init_func post_init_func, |
||||
void *user_data) GRPC_MUST_USE_RESULT; |
||||
|
||||
/// Terminate iteration and destroy \a iterator
|
||||
void grpc_channel_stack_builder_iterator_destroy( |
||||
grpc_channel_stack_builder_iterator *iterator); |
||||
|
||||
/// Destroy the builder, return the freshly minted channel stack
|
||||
/// Allocates \a prefix_bytes bytes before the channel stack
|
||||
/// Returns the base pointer of the allocated block
|
||||
/// \a initial_refs, \a destroy, \a destroy_arg are as per
|
||||
/// grpc_channel_stack_init
|
||||
void *grpc_channel_stack_builder_finish(grpc_exec_ctx *exec_ctx, |
||||
grpc_channel_stack_builder *builder, |
||||
size_t prefix_bytes, int initial_refs, |
||||
grpc_iomgr_cb_func destroy, |
||||
void *destroy_arg); |
||||
|
||||
/// Destroy the builder without creating a channel stack
|
||||
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 */ |
@ -0,0 +1,148 @@ |
||||
/*
|
||||
* |
||||
* 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/surface/channel_init.h" |
||||
|
||||
#include <grpc/support/alloc.h> |
||||
#include <grpc/support/useful.h> |
||||
|
||||
typedef struct stage_slot { |
||||
grpc_channel_init_stage fn; |
||||
void *arg; |
||||
int priority; |
||||
size_t insertion_order; |
||||
} stage_slot; |
||||
|
||||
typedef struct stage_slots { |
||||
stage_slot *slots; |
||||
size_t num_slots; |
||||
size_t cap_slots; |
||||
} stage_slots; |
||||
|
||||
static stage_slots g_slots[GRPC_NUM_CHANNEL_STACK_TYPES]; |
||||
static bool g_finalized; |
||||
|
||||
void grpc_channel_init_init(void) { |
||||
for (int i = 0; i < GRPC_NUM_CHANNEL_STACK_TYPES; i++) { |
||||
g_slots[i].slots = NULL; |
||||
g_slots[i].num_slots = 0; |
||||
g_slots[i].cap_slots = 0; |
||||
} |
||||
g_finalized = false; |
||||
} |
||||
|
||||
void grpc_channel_init_register_stage(grpc_channel_stack_type type, |
||||
int priority, |
||||
grpc_channel_init_stage stage, |
||||
void *stage_arg) { |
||||
GPR_ASSERT(!g_finalized); |
||||
if (g_slots[type].cap_slots == g_slots[type].num_slots) { |
||||
g_slots[type].cap_slots = GPR_MAX(8, 3 * g_slots[type].cap_slots / 2); |
||||
g_slots[type].slots = |
||||
gpr_realloc(g_slots[type].slots, |
||||
g_slots[type].cap_slots * sizeof(*g_slots[type].slots)); |
||||
} |
||||
stage_slot *s = &g_slots[type].slots[g_slots[type].num_slots++]; |
||||
s->insertion_order = g_slots[type].num_slots; |
||||
s->priority = priority; |
||||
s->fn = stage; |
||||
s->arg = stage_arg; |
||||
} |
||||
|
||||
static int compare_slots(const void *a, const void *b) { |
||||
const stage_slot *sa = a; |
||||
const stage_slot *sb = b; |
||||
|
||||
int c = GPR_ICMP(sa->priority, sb->priority); |
||||
if (c != 0) return c; |
||||
return GPR_ICMP(sa->insertion_order, sb->insertion_order); |
||||
} |
||||
|
||||
void grpc_channel_init_finalize(void) { |
||||
GPR_ASSERT(!g_finalized); |
||||
for (int i = 0; i < GRPC_NUM_CHANNEL_STACK_TYPES; i++) { |
||||
qsort(g_slots[i].slots, g_slots[i].num_slots, sizeof(*g_slots[i].slots), |
||||
compare_slots); |
||||
} |
||||
g_finalized = true; |
||||
} |
||||
|
||||
void grpc_channel_init_shutdown(void) { |
||||
for (int i = 0; i < GRPC_NUM_CHANNEL_STACK_TYPES; i++) { |
||||
gpr_free(g_slots[i].slots); |
||||
g_slots[i].slots = (void *)(uintptr_t)0xdeadbeef; |
||||
} |
||||
} |
||||
|
||||
static const char *name_for_type(grpc_channel_stack_type type) { |
||||
switch (type) { |
||||
case GRPC_CLIENT_CHANNEL: |
||||
return "CLIENT_CHANNEL"; |
||||
case GRPC_CLIENT_SUBCHANNEL: |
||||
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: |
||||
return "CLIENT_DIRECT_CHANNEL"; |
||||
case GRPC_NUM_CHANNEL_STACK_TYPES: |
||||
break; |
||||
} |
||||
GPR_UNREACHABLE_CODE(return "UNKNOWN"); |
||||
} |
||||
|
||||
void *grpc_channel_init_create_stack( |
||||
grpc_exec_ctx *exec_ctx, grpc_channel_stack_type type, size_t prefix_bytes, |
||||
const grpc_channel_args *args, int initial_refs, grpc_iomgr_cb_func destroy, |
||||
void *destroy_arg, grpc_transport *transport) { |
||||
GPR_ASSERT(g_finalized); |
||||
|
||||
grpc_channel_stack_builder *builder = grpc_channel_stack_builder_create(); |
||||
grpc_channel_stack_builder_set_name(builder, name_for_type(type)); |
||||
grpc_channel_stack_builder_set_channel_arguments(builder, args); |
||||
grpc_channel_stack_builder_set_transport(builder, transport); |
||||
|
||||
for (size_t i = 0; i < g_slots[type].num_slots; i++) { |
||||
const stage_slot *slot = &g_slots[type].slots[i]; |
||||
if (!slot->fn(builder, slot->arg)) { |
||||
grpc_channel_stack_builder_destroy(builder); |
||||
return NULL; |
||||
} |
||||
} |
||||
|
||||
return grpc_channel_stack_builder_finish(exec_ctx, builder, prefix_bytes, |
||||
initial_refs, destroy, destroy_arg); |
||||
} |
@ -0,0 +1,86 @@ |
||||
/*
|
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef GRPC_CORE_SURFACE_CHANNEL_INIT_H |
||||
#define GRPC_CORE_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" |
||||
|
||||
/// This module provides a way for plugins (and the grpc core library itself)
|
||||
/// to register mutators for channel stacks.
|
||||
/// It also provides a universal entry path to run those mutators to build
|
||||
/// a channel stack for various subsystems.
|
||||
|
||||
/// One stage of mutation: call functions against \a builder to influence the
|
||||
/// finally constructed channel stack
|
||||
typedef bool (*grpc_channel_init_stage)(grpc_channel_stack_builder *builder, |
||||
void *arg); |
||||
|
||||
/// Global initialization of the system
|
||||
void grpc_channel_init_init(void); |
||||
|
||||
/// Register one stage of mutators.
|
||||
/// Stages are run in priority order (lowest to highest), and then in
|
||||
/// registration order (in the case of a tie).
|
||||
/// Stages are registered against one of the pre-determined channel stack
|
||||
/// types.
|
||||
void grpc_channel_init_register_stage(grpc_channel_stack_type type, |
||||
int priority, |
||||
grpc_channel_init_stage stage_fn, |
||||
void *stage_arg); |
||||
|
||||
/// Finalize registration. No more calls to grpc_channel_init_register_stage are
|
||||
/// allowed.
|
||||
void grpc_channel_init_finalize(void); |
||||
/// Shutdown the channel init system
|
||||
void grpc_channel_init_shutdown(void); |
||||
|
||||
/// Construct a channel stack of some sort: see channel_stack.h for details
|
||||
/// \a type is the type of channel stack to create
|
||||
/// \a prefix_bytes is the number of bytes before the channel stack to allocate
|
||||
/// \a args are configuration arguments for the channel stack
|
||||
/// \a initial_refs is the initial refcount to give the channel stack
|
||||
/// \a destroy and \a destroy_arg specify how to destroy the channel stack
|
||||
/// if destroy_arg is NULL, the returned value from this function will be
|
||||
/// substituted
|
||||
/// \a optional_transport is either NULL or a constructed transport object
|
||||
/// Returns a pointer to the base of the memory allocated (the actual channel
|
||||
/// stack object will be prefix_bytes past that pointer)
|
||||
void *grpc_channel_init_create_stack( |
||||
grpc_exec_ctx *exec_ctx, grpc_channel_stack_type type, size_t prefix_bytes, |
||||
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 */ |
@ -0,0 +1,56 @@ |
||||
/*
|
||||
* |
||||
* 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 <grpc/support/port_platform.h> |
||||
#include "src/core/surface/channel_stack_type.h" |
||||
#include <grpc/support/log.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: |
||||
return true; |
||||
case GRPC_CLIENT_DIRECT_CHANNEL: |
||||
return true; |
||||
case GRPC_SERVER_CHANNEL: |
||||
return false; |
||||
case GRPC_NUM_CHANNEL_STACK_TYPES: |
||||
break; |
||||
} |
||||
GPR_UNREACHABLE_CODE(return true;); |
||||
} |
@ -0,0 +1,61 @@ |
||||
/*
|
||||
* |
||||
* 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_SURFACE_CHANNEL_STACK_TYPE_H |
||||
#define GRPC_CORE_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, |
||||
// a permanently broken client channel
|
||||
GRPC_CLIENT_LAME_CHANNEL, |
||||
// a directly connected client channel (without load-balancing, directly talks
|
||||
// to a transport)
|
||||
GRPC_CLIENT_DIRECT_CHANNEL, |
||||
// server side channel
|
||||
GRPC_SERVER_CHANNEL, |
||||
// must be last
|
||||
GRPC_NUM_CHANNEL_STACK_TYPES |
||||
} grpc_channel_stack_type; |
||||
|
||||
bool grpc_channel_stack_type_is_client(grpc_channel_stack_type type); |
||||
|
||||
#endif /* GRPC_CORE_SURFACE_CHANNEL_STACK_TYPE_H */ |
@ -0,0 +1,41 @@ |
||||
/*
|
||||
* |
||||
* 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. |
||||
* |
||||
*/ |
||||
|
||||
#ifndef GRPC_CORE_SURFACE_LAME_CLIENT_H |
||||
#define GRPC_CORE_SURFACE_LAME_CLIENT_H |
||||
|
||||
#include "src/core/channel/channel_stack.h" |
||||
|
||||
extern const grpc_channel_filter grpc_lame_filter; |
||||
|
||||
#endif /* GRPC_CORE_SURFACE_LAME_CLIENT_H */ |
@ -0,0 +1,132 @@ |
||||
/*
|
||||
* |
||||
* 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 "test/core/end2end/end2end_tests.h" |
||||
|
||||
#include <string.h> |
||||
|
||||
#include "src/core/channel/client_channel.h" |
||||
#include "src/core/channel/connected_channel.h" |
||||
#include "src/core/channel/http_server_filter.h" |
||||
#include "src/core/surface/channel.h" |
||||
#include "src/core/surface/server.h" |
||||
#include "src/core/transport/chttp2_transport.h" |
||||
#include <grpc/support/alloc.h> |
||||
#include <grpc/support/host_port.h> |
||||
#include <grpc/support/log.h> |
||||
#include <grpc/support/sync.h> |
||||
#include <grpc/support/thd.h> |
||||
#include <grpc/support/useful.h> |
||||
#include "test/core/util/port.h" |
||||
#include "test/core/util/test_config.h" |
||||
#include "src/core/support/env.h" |
||||
|
||||
typedef struct fullstack_fixture_data { |
||||
char *localaddr; |
||||
} fullstack_fixture_data; |
||||
|
||||
static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( |
||||
grpc_channel_args *client_args, grpc_channel_args *server_args) { |
||||
grpc_end2end_test_fixture f; |
||||
int port = grpc_pick_unused_port_or_die(); |
||||
fullstack_fixture_data *ffd = gpr_malloc(sizeof(fullstack_fixture_data)); |
||||
memset(&f, 0, sizeof(f)); |
||||
|
||||
gpr_join_host_port(&ffd->localaddr, "localhost", port); |
||||
|
||||
f.fixture_data = ffd; |
||||
f.cq = grpc_completion_queue_create(NULL); |
||||
|
||||
return f; |
||||
} |
||||
|
||||
void chttp2_init_client_fullstack(grpc_end2end_test_fixture *f, |
||||
grpc_channel_args *client_args) { |
||||
fullstack_fixture_data *ffd = f->fixture_data; |
||||
f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); |
||||
GPR_ASSERT(f->client); |
||||
} |
||||
|
||||
void chttp2_init_server_fullstack(grpc_end2end_test_fixture *f, |
||||
grpc_channel_args *server_args) { |
||||
fullstack_fixture_data *ffd = f->fixture_data; |
||||
if (f->server) { |
||||
grpc_server_destroy(f->server); |
||||
} |
||||
f->server = grpc_server_create(server_args, NULL); |
||||
grpc_server_register_completion_queue(f->server, f->cq, NULL); |
||||
GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); |
||||
grpc_server_start(f->server); |
||||
} |
||||
|
||||
void chttp2_tear_down_fullstack(grpc_end2end_test_fixture *f) { |
||||
fullstack_fixture_data *ffd = f->fixture_data; |
||||
gpr_free(ffd->localaddr); |
||||
gpr_free(ffd); |
||||
} |
||||
|
||||
/* All test configurations */ |
||||
static grpc_end2end_test_config configs[] = { |
||||
{"chttp2/fullstack", FEATURE_MASK_SUPPORTS_DELAYED_CONNECTION, |
||||
chttp2_create_fixture_fullstack, chttp2_init_client_fullstack, |
||||
chttp2_init_server_fullstack, chttp2_tear_down_fullstack}, |
||||
}; |
||||
|
||||
int main(int argc, char **argv) { |
||||
size_t i; |
||||
|
||||
/* force tracing on, with a value to force many
|
||||
code paths in trace.c to be taken */ |
||||
gpr_setenv("GRPC_TRACE", "doesnt-exist,http,all"); |
||||
|
||||
#ifdef GPR_POSIX_SOCKET |
||||
g_fixture_slowdown_factor = isatty(STDOUT_FILENO) ? 10.0 : 1.0; |
||||
#else |
||||
g_fixture_slowdown_factor = 10.0; |
||||
#endif |
||||
|
||||
grpc_test_init(argc, argv); |
||||
grpc_init(); |
||||
|
||||
for (i = 0; i < sizeof(configs) / sizeof(*configs); i++) { |
||||
grpc_end2end_tests(argc, argv, configs[i]); |
||||
} |
||||
|
||||
GPR_ASSERT(0 == grpc_tracer_set_enabled("also-doesnt-exist", 0)); |
||||
GPR_ASSERT(1 == grpc_tracer_set_enabled("http", 1)); |
||||
GPR_ASSERT(1 == grpc_tracer_set_enabled("all", 1)); |
||||
|
||||
grpc_shutdown(); |
||||
|
||||
return 0; |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,202 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\1.0.204.1.props')" /> |
||||
<ItemGroup Label="ProjectConfigurations"> |
||||
<ProjectConfiguration Include="Debug|Win32"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Debug|x64"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|Win32"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|x64"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
</ItemGroup> |
||||
<PropertyGroup Label="Globals"> |
||||
<ProjectGuid>{DFD51943-4906-8051-7D66-6A7D50E0D87E}</ProjectGuid> |
||||
<IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected> |
||||
<IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration"> |
||||
<PlatformToolset>v100</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'" Label="Configuration"> |
||||
<PlatformToolset>v110</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '12.0'" Label="Configuration"> |
||||
<PlatformToolset>v120</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '14.0'" Label="Configuration"> |
||||
<PlatformToolset>v140</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||
<ImportGroup Label="ExtensionSettings"> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\global.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\openssl.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\winsock.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\zlib.props" /> |
||||
</ImportGroup> |
||||
<PropertyGroup Label="UserMacros" /> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> |
||||
<TargetName>h2_full+trace_nosec_test</TargetName> |
||||
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib> |
||||
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'"> |
||||
<TargetName>h2_full+trace_nosec_test</TargetName> |
||||
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||
<Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib> |
||||
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||
<Configuration-grpc_dependencies_openssl>Release</Configuration-grpc_dependencies_openssl> |
||||
</PropertyGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemGroup> |
||||
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\fixtures\h2_full+trace.c"> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\test/end2end/tests\end2end_nosec_tests\end2end_nosec_tests.vcxproj"> |
||||
<Project>{47C2CB41-4E9F-58B6-F606-F6FAED5D00ED}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_test_util_unsecure\grpc_test_util_unsecure.vcxproj"> |
||||
<Project>{0A7E7F92-FDEA-40F1-A9EC-3BA484F98BBF}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_unsecure\grpc_unsecure.vcxproj"> |
||||
<Project>{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr_test_util\gpr_test_util.vcxproj"> |
||||
<Project>{EAB0A629-17A9-44DB-B5FF-E91A721FE037}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr\gpr.vcxproj"> |
||||
<Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<None Include="packages.config" /> |
||||
</ItemGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||
<ImportGroup Label="ExtensionTargets"> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||
</ImportGroup> |
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
||||
<PropertyGroup> |
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> |
||||
</PropertyGroup> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" /> |
||||
</Target> |
||||
</Project> |
||||
|
@ -0,0 +1,24 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup> |
||||
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\fixtures\h2_full+trace.c"> |
||||
<Filter>test\core\end2end\fixtures</Filter> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup> |
||||
<Filter Include="test"> |
||||
<UniqueIdentifier>{2828a8fc-bcc1-7b1c-4953-0c8eaf9fe643}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\core"> |
||||
<UniqueIdentifier>{d8e78fb2-4316-018b-704a-0944fd0c6fd9}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\core\end2end"> |
||||
<UniqueIdentifier>{1981c949-24c5-413c-ab03-24eff55e803a}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\core\end2end\fixtures"> |
||||
<UniqueIdentifier>{bfc11ba4-7401-55f0-8513-598aa93e7e1a}</UniqueIdentifier> |
||||
</Filter> |
||||
</ItemGroup> |
||||
</Project> |
||||
|
@ -0,0 +1,202 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\1.0.204.1.props')" /> |
||||
<ItemGroup Label="ProjectConfigurations"> |
||||
<ProjectConfiguration Include="Debug|Win32"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Debug|x64"> |
||||
<Configuration>Debug</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|Win32"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>Win32</Platform> |
||||
</ProjectConfiguration> |
||||
<ProjectConfiguration Include="Release|x64"> |
||||
<Configuration>Release</Configuration> |
||||
<Platform>x64</Platform> |
||||
</ProjectConfiguration> |
||||
</ItemGroup> |
||||
<PropertyGroup Label="Globals"> |
||||
<ProjectGuid>{16C713C6-062E-F71F-A44C-52DC35494B27}</ProjectGuid> |
||||
<IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected> |
||||
<IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration"> |
||||
<PlatformToolset>v100</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'" Label="Configuration"> |
||||
<PlatformToolset>v110</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '12.0'" Label="Configuration"> |
||||
<PlatformToolset>v120</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '14.0'" Label="Configuration"> |
||||
<PlatformToolset>v140</PlatformToolset> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>true</UseDebugLibraries> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> |
||||
<ConfigurationType>Application</ConfigurationType> |
||||
<UseDebugLibraries>false</UseDebugLibraries> |
||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
||||
<CharacterSet>Unicode</CharacterSet> |
||||
</PropertyGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
||||
<ImportGroup Label="ExtensionSettings"> |
||||
</ImportGroup> |
||||
<ImportGroup Label="PropertySheets"> |
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\global.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\openssl.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\winsock.props" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\zlib.props" /> |
||||
</ImportGroup> |
||||
<PropertyGroup Label="UserMacros" /> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'"> |
||||
<TargetName>h2_full+trace_test</TargetName> |
||||
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib> |
||||
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'"> |
||||
<TargetName>h2_full+trace_test</TargetName> |
||||
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib> |
||||
<Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib> |
||||
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl> |
||||
<Configuration-grpc_dependencies_openssl>Release</Configuration-grpc_dependencies_openssl> |
||||
</PropertyGroup> |
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>Disabled</Optimization> |
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
||||
<ClCompile> |
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader> |
||||
<WarningLevel>Level3</WarningLevel> |
||||
<Optimization>MaxSpeed</Optimization> |
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
||||
<SDLCheck>true</SDLCheck> |
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
||||
<TreatWarningAsError>true</TreatWarningAsError> |
||||
<DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat> |
||||
<MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild> |
||||
</ClCompile> |
||||
<Link> |
||||
<SubSystem>Console</SubSystem> |
||||
<GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation> |
||||
<GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation> |
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
||||
<OptimizeReferences>true</OptimizeReferences> |
||||
</Link> |
||||
</ItemDefinitionGroup> |
||||
|
||||
<ItemGroup> |
||||
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\fixtures\h2_full+trace.c"> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\test/end2end/tests\end2end_tests\end2end_tests.vcxproj"> |
||||
<Project>{1F1F9084-2A93-B80E-364F-5754894AFAB4}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_test_util\grpc_test_util.vcxproj"> |
||||
<Project>{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj"> |
||||
<Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr_test_util\gpr_test_util.vcxproj"> |
||||
<Project>{EAB0A629-17A9-44DB-B5FF-E91A721FE037}</Project> |
||||
</ProjectReference> |
||||
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr\gpr.vcxproj"> |
||||
<Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<None Include="packages.config" /> |
||||
</ItemGroup> |
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
||||
<ImportGroup Label="ExtensionTargets"> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||
<Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" /> |
||||
</ImportGroup> |
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
||||
<PropertyGroup> |
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> |
||||
</PropertyGroup> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" /> |
||||
<Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" /> |
||||
</Target> |
||||
</Project> |
||||
|
@ -0,0 +1,24 @@ |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<ItemGroup> |
||||
<ClCompile Include="$(SolutionDir)\..\test\core\end2end\fixtures\h2_full+trace.c"> |
||||
<Filter>test\core\end2end\fixtures</Filter> |
||||
</ClCompile> |
||||
</ItemGroup> |
||||
|
||||
<ItemGroup> |
||||
<Filter Include="test"> |
||||
<UniqueIdentifier>{00848213-d356-89b0-1d05-8131961dc959}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\core"> |
||||
<UniqueIdentifier>{863a91b6-f5f9-5326-129a-10003d7af98f}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\core\end2end"> |
||||
<UniqueIdentifier>{2733ff09-adc7-fd49-696f-5f72df2f44e2}</UniqueIdentifier> |
||||
</Filter> |
||||
<Filter Include="test\core\end2end\fixtures"> |
||||
<UniqueIdentifier>{62aa4eaf-c183-f2af-9ef9-a88ee802702c}</UniqueIdentifier> |
||||
</Filter> |
||||
</ItemGroup> |
||||
</Project> |
||||
|
Loading…
Reference in new issue