From 75c9b6f49519d7c616628905f2e58782206c98d2 Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Fri, 29 May 2015 13:12:12 -0700 Subject: [PATCH 1/3] Removing mdctx from the credentials. --- BUILD | 1 + Makefile | 2 + build.json | 1 + src/core/security/auth.c | 10 +- src/core/security/credentials.c | 216 +++++++---------------- src/core/security/credentials.h | 41 +++-- src/core/security/credentials_metadata.c | 101 +++++++++++ src/core/surface/secure_channel_create.c | 2 +- src/core/transport/metadata.h | 2 + test/core/security/credentials_test.c | 163 +++++++++++------ vsprojects/grpc/grpc.vcxproj | 2 + vsprojects/grpc/grpc.vcxproj.filters | 3 + 12 files changed, 327 insertions(+), 217 deletions(-) create mode 100644 src/core/security/credentials_metadata.c diff --git a/BUILD b/BUILD index bcee870bd3c..9c2a24b835e 100644 --- a/BUILD +++ b/BUILD @@ -237,6 +237,7 @@ cc_library( "src/core/security/auth.c", "src/core/security/base64.c", "src/core/security/credentials.c", + "src/core/security/credentials_metadata.c", "src/core/security/credentials_posix.c", "src/core/security/credentials_win32.c", "src/core/security/google_default_credentials.c", diff --git a/Makefile b/Makefile index f56edec7e68..be08f734335 100644 --- a/Makefile +++ b/Makefile @@ -2681,6 +2681,7 @@ LIBGRPC_SRC = \ src/core/security/auth.c \ src/core/security/base64.c \ src/core/security/credentials.c \ + src/core/security/credentials_metadata.c \ src/core/security/credentials_posix.c \ src/core/security/credentials_win32.c \ src/core/security/google_default_credentials.c \ @@ -13721,6 +13722,7 @@ src/core/httpcli/parser.c: $(OPENSSL_DEP) src/core/security/auth.c: $(OPENSSL_DEP) src/core/security/base64.c: $(OPENSSL_DEP) src/core/security/credentials.c: $(OPENSSL_DEP) +src/core/security/credentials_metadata.c: $(OPENSSL_DEP) src/core/security/credentials_posix.c: $(OPENSSL_DEP) src/core/security/credentials_win32.c: $(OPENSSL_DEP) src/core/security/google_default_credentials.c: $(OPENSSL_DEP) diff --git a/build.json b/build.json index 4fc568810bb..78afe3f411a 100644 --- a/build.json +++ b/build.json @@ -426,6 +426,7 @@ "src/core/security/auth.c", "src/core/security/base64.c", "src/core/security/credentials.c", + "src/core/security/credentials_metadata.c", "src/core/security/credentials_posix.c", "src/core/security/credentials_win32.c", "src/core/security/google_default_credentials.c", diff --git a/src/core/security/auth.c b/src/core/security/auth.c index faf12d8f144..8aa699dfad3 100644 --- a/src/core/security/auth.c +++ b/src/core/security/auth.c @@ -77,11 +77,13 @@ static void bubble_up_error(grpc_call_element *elem, const char *error_msg) { grpc_call_next_op(elem, &calld->op); } -static void on_credentials_metadata(void *user_data, grpc_mdelem **md_elems, +static void on_credentials_metadata(void *user_data, + grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status) { grpc_call_element *elem = (grpc_call_element *)user_data; call_data *calld = elem->call_data; + channel_data *chand = elem->channel_data; grpc_transport_op *op = &calld->op; grpc_metadata_batch *mdb; size_t i; @@ -94,8 +96,10 @@ static void on_credentials_metadata(void *user_data, grpc_mdelem **md_elems, op->send_ops->ops[calld->op_md_idx].type == GRPC_OP_METADATA); mdb = &op->send_ops->ops[calld->op_md_idx].data.metadata; for (i = 0; i < num_md; i++) { - grpc_metadata_batch_add_tail(mdb, &calld->md_links[i], - grpc_mdelem_ref(md_elems[i])); + grpc_metadata_batch_add_tail( + mdb, &calld->md_links[i], + grpc_mdelem_from_slices(chand->md_ctx, gpr_slice_ref(md_elems[i].key), + gpr_slice_ref(md_elems[i].value))); } grpc_call_next_op(elem, op); } diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c index f6366f07505..ae22bf47a0f 100644 --- a/src/core/security/credentials.c +++ b/src/core/security/credentials.c @@ -114,20 +114,6 @@ void grpc_credentials_get_request_metadata(grpc_credentials *creds, creds->vtable->get_request_metadata(creds, service_url, cb, user_data); } -grpc_mdctx *grpc_credentials_get_or_create_metadata_context( - grpc_credentials *creds) { - grpc_mdctx *mdctx = NULL; - if (creds != NULL && creds->vtable->get_metadata_context != NULL) { - mdctx = creds->vtable->get_metadata_context(creds); - } - if (mdctx == NULL) { - return grpc_mdctx_create(); - } else { - grpc_mdctx_ref(mdctx); - return mdctx; - } -} - grpc_security_status grpc_credentials_create_security_connector( grpc_credentials *creds, const char *target, const grpc_channel_args *args, grpc_credentials *request_metadata_creds, @@ -208,10 +194,6 @@ static int ssl_has_request_metadata_only(const grpc_credentials *creds) { return 0; } -static grpc_mdctx *ssl_get_metadata_context(grpc_credentials *creds) { - return NULL; -} - static grpc_security_status ssl_create_security_connector( grpc_credentials *creds, const char *target, const grpc_channel_args *args, grpc_credentials *request_metadata_creds, @@ -249,8 +231,8 @@ static grpc_security_status ssl_server_create_security_connector( } static grpc_credentials_vtable ssl_vtable = { - ssl_destroy, ssl_has_request_metadata, ssl_has_request_metadata_only, - ssl_get_metadata_context, NULL, ssl_create_security_connector}; + ssl_destroy, ssl_has_request_metadata, ssl_has_request_metadata_only, NULL, + ssl_create_security_connector}; static grpc_server_credentials_vtable ssl_server_vtable = { ssl_server_destroy, ssl_server_create_security_connector}; @@ -341,13 +323,12 @@ grpc_server_credentials *grpc_ssl_server_credentials_create( typedef struct { grpc_credentials base; - grpc_mdctx *md_ctx; /* Have a simple cache for now with just 1 entry. We could have a map based on the service_url for a more sophisticated one. */ gpr_mu cache_mu; struct { - grpc_mdelem *jwt_md; + grpc_credentials_md_store *jwt_md; char *service_url; gpr_timespec jwt_expiration; } cached; @@ -358,7 +339,7 @@ typedef struct { static void jwt_reset_cache(grpc_jwt_credentials *c) { if (c->cached.jwt_md != NULL) { - grpc_mdelem_unref(c->cached.jwt_md); + grpc_credentials_md_store_unref(c->cached.jwt_md); c->cached.jwt_md = NULL; } if (c->cached.service_url != NULL) { @@ -373,7 +354,6 @@ static void jwt_destroy(grpc_credentials *creds) { grpc_auth_json_key_destruct(&c->key); jwt_reset_cache(c); gpr_mu_destroy(&c->cache_mu); - grpc_mdctx_unref(c->md_ctx); gpr_free(c); } @@ -393,7 +373,7 @@ static void jwt_get_request_metadata(grpc_credentials *creds, 0}; /* See if we can return a cached jwt. */ - grpc_mdelem *jwt_md = NULL; + grpc_credentials_md_store *jwt_md = NULL; { gpr_mu_lock(&c->cache_mu); if (c->cached.service_url != NULL && @@ -401,7 +381,7 @@ static void jwt_get_request_metadata(grpc_credentials *creds, c->cached.jwt_md != NULL && (gpr_time_cmp(gpr_time_sub(c->cached.jwt_expiration, gpr_now()), refresh_threshold) > 0)) { - jwt_md = grpc_mdelem_ref(c->cached.jwt_md); + jwt_md = grpc_credentials_md_store_ref(c->cached.jwt_md); } gpr_mu_unlock(&c->cache_mu); } @@ -418,30 +398,26 @@ static void jwt_get_request_metadata(grpc_credentials *creds, gpr_free(jwt); c->cached.jwt_expiration = gpr_time_add(gpr_now(), c->jwt_lifetime); c->cached.service_url = gpr_strdup(service_url); - c->cached.jwt_md = grpc_mdelem_from_strings( - c->md_ctx, GRPC_AUTHORIZATION_METADATA_KEY, md_value); + c->cached.jwt_md = grpc_credentials_md_store_create(1); + grpc_credentials_md_store_add_cstrings( + c->cached.jwt_md, GRPC_AUTHORIZATION_METADATA_KEY, md_value); gpr_free(md_value); - jwt_md = grpc_mdelem_ref(c->cached.jwt_md); + jwt_md = grpc_credentials_md_store_ref(c->cached.jwt_md); } gpr_mu_unlock(&c->cache_mu); } if (jwt_md != NULL) { - cb(user_data, &jwt_md, 1, GRPC_CREDENTIALS_OK); - grpc_mdelem_unref(jwt_md); + cb(user_data, jwt_md->entries, jwt_md->num_entries, GRPC_CREDENTIALS_OK); + grpc_credentials_md_store_unref(jwt_md); } else { cb(user_data, NULL, 0, GRPC_CREDENTIALS_ERROR); } } -static grpc_mdctx *jwt_get_metadata_context(grpc_credentials *creds) { - grpc_jwt_credentials *c = (grpc_jwt_credentials *)creds; - return c->md_ctx; -} - static grpc_credentials_vtable jwt_vtable = { jwt_destroy, jwt_has_request_metadata, jwt_has_request_metadata_only, - jwt_get_metadata_context, jwt_get_request_metadata, NULL}; + jwt_get_request_metadata, NULL}; grpc_credentials *grpc_jwt_credentials_create(const char *json_key, gpr_timespec token_lifetime) { @@ -456,7 +432,6 @@ grpc_credentials *grpc_jwt_credentials_create(const char *json_key, c->base.type = GRPC_CREDENTIALS_TYPE_JWT; gpr_ref_init(&c->base.refcount, 1); c->base.vtable = &jwt_vtable; - c->md_ctx = grpc_mdctx_create(); c->key = key; c->jwt_lifetime = token_lifetime; gpr_mu_init(&c->cache_mu); @@ -476,8 +451,7 @@ typedef void (*grpc_fetch_oauth2_func)(grpc_credentials_metadata_request *req, typedef struct { grpc_credentials base; gpr_mu mu; - grpc_mdctx *md_ctx; - grpc_mdelem *access_token_md; + grpc_credentials_md_store *access_token_md; gpr_timespec token_expiration; grpc_fetch_oauth2_func fetch_func; } grpc_oauth2_token_fetcher_credentials; @@ -485,11 +459,8 @@ typedef struct { static void oauth2_token_fetcher_destroy(grpc_credentials *creds) { grpc_oauth2_token_fetcher_credentials *c = (grpc_oauth2_token_fetcher_credentials *)creds; - if (c->access_token_md != NULL) { - grpc_mdelem_unref(c->access_token_md); - } + grpc_credentials_md_store_unref(c->access_token_md); gpr_mu_destroy(&c->mu); - grpc_mdctx_unref(c->md_ctx); gpr_free(c); } @@ -505,8 +476,8 @@ static int oauth2_token_fetcher_has_request_metadata_only( grpc_credentials_status grpc_oauth2_token_fetcher_credentials_parse_server_response( - const grpc_httpcli_response *response, grpc_mdctx *ctx, - grpc_mdelem **token_elem, gpr_timespec *token_lifetime) { + const grpc_httpcli_response *response, + grpc_credentials_md_store **token_md, gpr_timespec *token_lifetime) { char *null_terminated_body = NULL; char *new_access_token = NULL; grpc_credentials_status status = GRPC_CREDENTIALS_OK; @@ -574,16 +545,17 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response( access_token->value); token_lifetime->tv_sec = strtol(expires_in->value, NULL, 10); token_lifetime->tv_nsec = 0; - if (*token_elem != NULL) grpc_mdelem_unref(*token_elem); - *token_elem = grpc_mdelem_from_strings(ctx, GRPC_AUTHORIZATION_METADATA_KEY, - new_access_token); + if (*token_md != NULL) grpc_credentials_md_store_unref(*token_md); + *token_md = grpc_credentials_md_store_create(1); + grpc_credentials_md_store_add_cstrings( + *token_md, GRPC_AUTHORIZATION_METADATA_KEY, new_access_token); status = GRPC_CREDENTIALS_OK; } end: - if (status != GRPC_CREDENTIALS_OK && (*token_elem != NULL)) { - grpc_mdelem_unref(*token_elem); - *token_elem = NULL; + if (status != GRPC_CREDENTIALS_OK && (*token_md != NULL)) { + grpc_credentials_md_store_unref(*token_md); + *token_md = NULL; } if (null_terminated_body != NULL) gpr_free(null_terminated_body); if (new_access_token != NULL) gpr_free(new_access_token); @@ -602,10 +574,11 @@ static void on_oauth2_token_fetcher_http_response( gpr_mu_lock(&c->mu); status = grpc_oauth2_token_fetcher_credentials_parse_server_response( - response, c->md_ctx, &c->access_token_md, &token_lifetime); + response, &c->access_token_md, &token_lifetime); if (status == GRPC_CREDENTIALS_OK) { c->token_expiration = gpr_time_add(gpr_now(), token_lifetime); - r->cb(r->user_data, &c->access_token_md, 1, status); + r->cb(r->user_data, c->access_token_md->entries, + c->access_token_md->num_entries, status); } else { c->token_expiration = gpr_inf_past; r->cb(r->user_data, NULL, 0, status); @@ -621,19 +594,20 @@ static void oauth2_token_fetcher_get_request_metadata( (grpc_oauth2_token_fetcher_credentials *)creds; gpr_timespec refresh_threshold = {GRPC_SECURE_TOKEN_REFRESH_THRESHOLD_SECS, 0}; - grpc_mdelem *cached_access_token_md = NULL; + grpc_credentials_md_store *cached_access_token_md = NULL; { gpr_mu_lock(&c->mu); if (c->access_token_md != NULL && (gpr_time_cmp(gpr_time_sub(c->token_expiration, gpr_now()), refresh_threshold) > 0)) { - cached_access_token_md = grpc_mdelem_ref(c->access_token_md); + cached_access_token_md = grpc_credentials_md_store_ref(c->access_token_md); } gpr_mu_unlock(&c->mu); } if (cached_access_token_md != NULL) { - cb(user_data, &cached_access_token_md, 1, GRPC_CREDENTIALS_OK); - grpc_mdelem_unref(cached_access_token_md); + cb(user_data, cached_access_token_md->entries, + cached_access_token_md->num_entries, GRPC_CREDENTIALS_OK); + grpc_credentials_md_store_unref(cached_access_token_md); } else { c->fetch_func( grpc_credentials_metadata_request_create(creds, cb, user_data), @@ -648,24 +622,15 @@ static void init_oauth2_token_fetcher(grpc_oauth2_token_fetcher_credentials *c, c->base.type = GRPC_CREDENTIALS_TYPE_OAUTH2; gpr_ref_init(&c->base.refcount, 1); gpr_mu_init(&c->mu); - c->md_ctx = grpc_mdctx_create(); c->token_expiration = gpr_inf_past; c->fetch_func = fetch_func; } -static grpc_mdctx *oauth2_token_fetcher_get_metadata_context( - grpc_credentials *creds) { - grpc_oauth2_token_fetcher_credentials *c = - (grpc_oauth2_token_fetcher_credentials *)creds; - return c->md_ctx; -} - /* -- ComputeEngine credentials. -- */ static grpc_credentials_vtable compute_engine_vtable = { oauth2_token_fetcher_destroy, oauth2_token_fetcher_has_request_metadata, oauth2_token_fetcher_has_request_metadata_only, - oauth2_token_fetcher_get_metadata_context, oauth2_token_fetcher_get_request_metadata, NULL}; static void compute_engine_fetch_oauth2( @@ -709,7 +674,6 @@ static void service_account_destroy(grpc_credentials *creds) { static grpc_credentials_vtable service_account_vtable = { service_account_destroy, oauth2_token_fetcher_has_request_metadata, oauth2_token_fetcher_has_request_metadata_only, - oauth2_token_fetcher_get_metadata_context, oauth2_token_fetcher_get_request_metadata, NULL}; static void service_account_fetch_oauth2( @@ -783,7 +747,6 @@ static void refresh_token_destroy(grpc_credentials *creds) { static grpc_credentials_vtable refresh_token_vtable = { refresh_token_destroy, oauth2_token_fetcher_has_request_metadata, oauth2_token_fetcher_has_request_metadata_only, - oauth2_token_fetcher_get_metadata_context, oauth2_token_fetcher_get_request_metadata, NULL}; static void refresh_token_fetch_oauth2( @@ -832,17 +795,13 @@ grpc_credentials *grpc_refresh_token_credentials_create( typedef struct { grpc_credentials base; - grpc_mdctx *md_ctx; - grpc_mdelem *access_token_md; + grpc_credentials_md_store *access_token_md; int is_async; } grpc_fake_oauth2_credentials; static void fake_oauth2_destroy(grpc_credentials *creds) { grpc_fake_oauth2_credentials *c = (grpc_fake_oauth2_credentials *)creds; - if (c->access_token_md != NULL) { - grpc_mdelem_unref(c->access_token_md); - } - grpc_mdctx_unref(c->md_ctx); + grpc_credentials_md_store_unref(c->access_token_md); gpr_free(c); } @@ -860,7 +819,8 @@ void on_simulated_token_fetch_done(void *user_data, int success) { (grpc_credentials_metadata_request *)user_data; grpc_fake_oauth2_credentials *c = (grpc_fake_oauth2_credentials *)r->creds; GPR_ASSERT(success); - r->cb(r->user_data, &c->access_token_md, 1, GRPC_CREDENTIALS_OK); + r->cb(r->user_data, c->access_token_md->entries, + c->access_token_md->num_entries, GRPC_CREDENTIALS_OK); grpc_credentials_metadata_request_destroy(r); } @@ -875,19 +835,14 @@ static void fake_oauth2_get_request_metadata(grpc_credentials *creds, on_simulated_token_fetch_done, grpc_credentials_metadata_request_create(creds, cb, user_data)); } else { - cb(user_data, &c->access_token_md, 1, GRPC_CREDENTIALS_OK); + cb(user_data, c->access_token_md->entries, 1, GRPC_CREDENTIALS_OK); } } -static grpc_mdctx *fake_oauth2_get_metadata_context(grpc_credentials *creds) { - grpc_fake_oauth2_credentials *c = (grpc_fake_oauth2_credentials *)creds; - return c->md_ctx; -} - static grpc_credentials_vtable fake_oauth2_vtable = { fake_oauth2_destroy, fake_oauth2_has_request_metadata, - fake_oauth2_has_request_metadata_only, fake_oauth2_get_metadata_context, - fake_oauth2_get_request_metadata, NULL}; + fake_oauth2_has_request_metadata_only, fake_oauth2_get_request_metadata, + NULL}; grpc_credentials *grpc_fake_oauth2_credentials_create( const char *token_md_value, int is_async) { @@ -897,9 +852,9 @@ grpc_credentials *grpc_fake_oauth2_credentials_create( c->base.type = GRPC_CREDENTIALS_TYPE_OAUTH2; c->base.vtable = &fake_oauth2_vtable; gpr_ref_init(&c->base.refcount, 1); - c->md_ctx = grpc_mdctx_create(); - c->access_token_md = grpc_mdelem_from_strings( - c->md_ctx, GRPC_AUTHORIZATION_METADATA_KEY, token_md_value); + c->access_token_md = grpc_credentials_md_store_create(1); + grpc_credentials_md_store_add_cstrings( + c->access_token_md, GRPC_AUTHORIZATION_METADATA_KEY, token_md_value); c->is_async = is_async; return &c->base; } @@ -926,11 +881,6 @@ static int fake_transport_security_has_request_metadata_only( return 0; } -static grpc_mdctx *fake_transport_security_get_metadata_context( - grpc_credentials *c) { - return NULL; -} - static grpc_security_status fake_transport_security_create_security_connector( grpc_credentials *c, const char *target, const grpc_channel_args *args, @@ -950,8 +900,7 @@ fake_transport_security_server_create_security_connector( static grpc_credentials_vtable fake_transport_security_credentials_vtable = { fake_transport_security_credentials_destroy, fake_transport_security_has_request_metadata, - fake_transport_security_has_request_metadata_only, - fake_transport_security_get_metadata_context, NULL, + fake_transport_security_has_request_metadata_only, NULL, fake_transport_security_create_security_connector}; static grpc_server_credentials_vtable @@ -988,8 +937,7 @@ typedef struct { typedef struct { grpc_composite_credentials *composite_creds; size_t creds_index; - grpc_mdelem **md_elems; - size_t num_md; + grpc_credentials_md_store *md_elems; char *service_url; void *user_data; grpc_credentials_metadata_cb cb; @@ -1031,21 +979,16 @@ static int composite_has_request_metadata_only(const grpc_credentials *creds) { static void composite_md_context_destroy( grpc_composite_credentials_metadata_context *ctx) { - size_t i; - for (i = 0; i < ctx->num_md; i++) { - grpc_mdelem_unref(ctx->md_elems[i]); - } - gpr_free(ctx->md_elems); + grpc_credentials_md_store_unref(ctx->md_elems); if (ctx->service_url != NULL) gpr_free(ctx->service_url); gpr_free(ctx); } -static void composite_metadata_cb(void *user_data, grpc_mdelem **md_elems, - size_t num_md, +static void composite_metadata_cb(void *user_data, + grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status) { grpc_composite_credentials_metadata_context *ctx = (grpc_composite_credentials_metadata_context *)user_data; - size_t i; if (status != GRPC_CREDENTIALS_OK) { ctx->cb(ctx->user_data, NULL, 0, status); return; @@ -1053,12 +996,11 @@ static void composite_metadata_cb(void *user_data, grpc_mdelem **md_elems, /* Copy the metadata in the context. */ if (num_md > 0) { - ctx->md_elems = gpr_realloc(ctx->md_elems, - (ctx->num_md + num_md) * sizeof(grpc_mdelem *)); + size_t i; for (i = 0; i < num_md; i++) { - ctx->md_elems[i + ctx->num_md] = grpc_mdelem_ref(md_elems[i]); + grpc_credentials_md_store_add(ctx->md_elems, md_elems[i].key, + md_elems[i].value); } - ctx->num_md += num_md; } /* See if we need to get some more metadata. */ @@ -1073,7 +1015,8 @@ static void composite_metadata_cb(void *user_data, grpc_mdelem **md_elems, } /* We're done!. */ - ctx->cb(ctx->user_data, ctx->md_elems, ctx->num_md, GRPC_CREDENTIALS_OK); + ctx->cb(ctx->user_data, ctx->md_elems->entries, ctx->md_elems->num_entries, + GRPC_CREDENTIALS_OK); composite_md_context_destroy(ctx); } @@ -1093,6 +1036,7 @@ static void composite_get_request_metadata(grpc_credentials *creds, ctx->user_data = user_data; ctx->cb = cb; ctx->composite_creds = c; + ctx->md_elems = grpc_credentials_md_store_create(c->inner.num_creds); while (ctx->creds_index < c->inner.num_creds) { grpc_credentials *inner_creds = c->inner.creds_array[ctx->creds_index++]; if (grpc_credentials_has_request_metadata(inner_creds)) { @@ -1104,25 +1048,6 @@ static void composite_get_request_metadata(grpc_credentials *creds, GPR_ASSERT(0); /* Should have exited before. */ } -static grpc_mdctx *composite_get_metadata_context(grpc_credentials *creds) { - grpc_composite_credentials *c = (grpc_composite_credentials *)creds; - grpc_mdctx *ctx = NULL; - size_t i; - for (i = 0; i < c->inner.num_creds; i++) { - grpc_credentials *inner_creds = c->inner.creds_array[i]; - grpc_mdctx *inner_ctx = NULL; - if (inner_creds->vtable->get_metadata_context != NULL) { - inner_ctx = inner_creds->vtable->get_metadata_context(inner_creds); - } - if (inner_ctx) { - GPR_ASSERT(ctx == NULL && - "can only have one metadata context per composite credential"); - ctx = inner_ctx; - } - } - return ctx; -} - static grpc_security_status composite_create_security_connector( grpc_credentials *creds, const char *target, const grpc_channel_args *args, grpc_credentials *request_metadata_creds, @@ -1139,8 +1064,8 @@ static grpc_security_status composite_create_security_connector( static grpc_credentials_vtable composite_credentials_vtable = { composite_destroy, composite_has_request_metadata, - composite_has_request_metadata_only, composite_get_metadata_context, - composite_get_request_metadata, composite_create_security_connector}; + composite_has_request_metadata_only, composite_get_request_metadata, + composite_create_security_connector}; static grpc_credentials_array get_creds_array(grpc_credentials **creds_addr) { grpc_credentials_array result; @@ -1237,16 +1162,12 @@ grpc_credentials *grpc_credentials_contains_type( typedef struct { grpc_credentials base; - grpc_mdctx *md_ctx; - grpc_mdelem *token_md; - grpc_mdelem *authority_selector_md; + grpc_credentials_md_store *iam_md; } grpc_iam_credentials; static void iam_destroy(grpc_credentials *creds) { grpc_iam_credentials *c = (grpc_iam_credentials *)creds; - grpc_mdelem_unref(c->token_md); - grpc_mdelem_unref(c->authority_selector_md); - grpc_mdctx_unref(c->md_ctx); + grpc_credentials_md_store_unref(c->iam_md); gpr_free(c); } @@ -1263,20 +1184,13 @@ static void iam_get_request_metadata(grpc_credentials *creds, grpc_credentials_metadata_cb cb, void *user_data) { grpc_iam_credentials *c = (grpc_iam_credentials *)creds; - grpc_mdelem *md_array[2]; - md_array[0] = c->token_md; - md_array[1] = c->authority_selector_md; - cb(user_data, md_array, 2, GRPC_CREDENTIALS_OK); -} - -static grpc_mdctx *iam_get_metadata_context(grpc_credentials *creds) { - grpc_iam_credentials *c = (grpc_iam_credentials *)creds; - return c->md_ctx; + cb(user_data, c->iam_md->entries, c->iam_md->num_entries, + GRPC_CREDENTIALS_OK); } static grpc_credentials_vtable iam_vtable = { iam_destroy, iam_has_request_metadata, iam_has_request_metadata_only, - iam_get_metadata_context, iam_get_request_metadata, NULL}; + iam_get_request_metadata, NULL}; grpc_credentials *grpc_iam_credentials_create(const char *token, const char *authority_selector) { @@ -1288,10 +1202,10 @@ grpc_credentials *grpc_iam_credentials_create(const char *token, c->base.type = GRPC_CREDENTIALS_TYPE_IAM; c->base.vtable = &iam_vtable; gpr_ref_init(&c->base.refcount, 1); - c->md_ctx = grpc_mdctx_create(); - c->token_md = grpc_mdelem_from_strings( - c->md_ctx, GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, token); - c->authority_selector_md = grpc_mdelem_from_strings( - c->md_ctx, GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY, authority_selector); + c->iam_md = grpc_credentials_md_store_create(2); + grpc_credentials_md_store_add_cstrings( + c->iam_md, GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY, token); + grpc_credentials_md_store_add_cstrings( + c->iam_md, GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY, authority_selector); return &c->base; } diff --git a/src/core/security/credentials.h b/src/core/security/credentials.h index 87c773e49a1..4768ce6990a 100644 --- a/src/core/security/credentials.h +++ b/src/core/security/credentials.h @@ -82,13 +82,40 @@ typedef enum { #define GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING \ "client_id=%s&client_secret=%s&refresh_token=%s&grant_type=refresh_token" +/* --- grpc_credentials_md. --- */ + +typedef struct { + gpr_slice key; + gpr_slice value; +} grpc_credentials_md; + +typedef struct { + grpc_credentials_md *entries; + size_t num_entries; + size_t allocated; + gpr_refcount refcount; +} grpc_credentials_md_store; + +grpc_credentials_md_store *grpc_credentials_md_store_create( + size_t initial_capacity); + +/* Will ref key and value. */ +void grpc_credentials_md_store_add(grpc_credentials_md_store *store, + gpr_slice key, gpr_slice value); +void grpc_credentials_md_store_add_cstrings(grpc_credentials_md_store *store, + const char *key, const char *value); +grpc_credentials_md_store *grpc_credentials_md_store_ref( + grpc_credentials_md_store *store); +void grpc_credentials_md_store_unref(grpc_credentials_md_store *store); + + /* --- grpc_credentials. --- */ /* It is the caller's responsibility to gpr_free the result if not NULL. */ char *grpc_get_well_known_google_credentials_file_path(void); typedef void (*grpc_credentials_metadata_cb)(void *user_data, - grpc_mdelem **md_elems, + grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status); @@ -96,7 +123,6 @@ typedef struct { void (*destroy)(grpc_credentials *c); int (*has_request_metadata)(const grpc_credentials *c); int (*has_request_metadata_only)(const grpc_credentials *c); - grpc_mdctx *(*get_metadata_context)(grpc_credentials *c); void (*get_request_metadata)(grpc_credentials *c, const char *service_url, grpc_credentials_metadata_cb cb, @@ -123,11 +149,6 @@ void grpc_credentials_get_request_metadata(grpc_credentials *creds, grpc_credentials_metadata_cb cb, void *user_data); -/* Gets the mdctx from the credentials and increase the refcount if it exists, - otherwise, create a new one. */ -grpc_mdctx *grpc_credentials_get_or_create_metadata_context( - grpc_credentials *creds); - /* Creates a security connector for the channel. May also create new channel args for the channel to be used in place of the passed in const args if returned non NULL. In that case the caller is responsible for destroying @@ -155,9 +176,9 @@ grpc_credentials *grpc_credentials_contains_type( /* Exposed for testing only. */ grpc_credentials_status - grpc_oauth2_token_fetcher_credentials_parse_server_response( - const struct grpc_httpcli_response *response, grpc_mdctx *ctx, - grpc_mdelem **token_elem, gpr_timespec *token_lifetime); +grpc_oauth2_token_fetcher_credentials_parse_server_response( + const struct grpc_httpcli_response *response, grpc_credentials_md_store **token_md, + gpr_timespec *token_lifetime); /* Simulates an oauth2 token fetch with the specified value for testing. */ grpc_credentials *grpc_fake_oauth2_credentials_create( diff --git a/src/core/security/credentials_metadata.c b/src/core/security/credentials_metadata.c new file mode 100644 index 00000000000..22c786be562 --- /dev/null +++ b/src/core/security/credentials_metadata.c @@ -0,0 +1,101 @@ +/* + * + * 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/security/credentials.h" + +#include + +#include + +static void store_ensure_capacity(grpc_credentials_md_store *store) { + if (store->num_entries == store->allocated) { + store->allocated = (store->allocated == 0) ? 1 : store->allocated * 2; + store->entries = gpr_realloc( + store->entries, store->allocated * sizeof(grpc_credentials_md)); + } +} + +grpc_credentials_md_store *grpc_credentials_md_store_create( + size_t initial_capacity) { + grpc_credentials_md_store *store = gpr_malloc(sizeof(grpc_credentials_md_store)); + memset(store, 0, sizeof(grpc_credentials_md_store)); + if (initial_capacity > 0) { + store->entries = gpr_malloc(initial_capacity * sizeof(grpc_credentials_md)); + store->allocated = initial_capacity; + } + gpr_ref_init(&store->refcount, 1); + return store; +} + +void grpc_credentials_md_store_add(grpc_credentials_md_store *store, + gpr_slice key, gpr_slice value) { + if (store == NULL) return; + store_ensure_capacity(store); + store->entries[store->num_entries].key = gpr_slice_ref(key); + store->entries[store->num_entries].value = gpr_slice_ref(value); + store->num_entries++; +} + +void grpc_credentials_md_store_add_cstrings(grpc_credentials_md_store *store, + const char *key, + const char *value) { + if (store == NULL) return; + store_ensure_capacity(store); + store->entries[store->num_entries].key = gpr_slice_from_copied_string(key); + store->entries[store->num_entries].value = + gpr_slice_from_copied_string(value); + store->num_entries++; +} + +grpc_credentials_md_store *grpc_credentials_md_store_ref( + grpc_credentials_md_store *store) { + if (store == NULL) return NULL; + gpr_ref(&store->refcount); + return store; +} + +void grpc_credentials_md_store_unref(grpc_credentials_md_store *store) { + if (store == NULL) return; + if (gpr_unref(&store->refcount)) { + if (store->entries != NULL) { + size_t i; + for (i = 0; i < store->num_entries; i++) { + gpr_slice_unref(store->entries[i].key); + gpr_slice_unref(store->entries[i].value); + } + gpr_free(store->entries); + } + gpr_free(store); + } +} + diff --git a/src/core/surface/secure_channel_create.c b/src/core/surface/secure_channel_create.c index 3e331293b5d..4bccd3da583 100644 --- a/src/core/surface/secure_channel_create.c +++ b/src/core/surface/secure_channel_create.c @@ -226,7 +226,7 @@ grpc_channel *grpc_secure_channel_create(grpc_credentials *creds, GRPC_SECURITY_OK) { return grpc_lame_client_channel_create(); } - mdctx = grpc_credentials_get_or_create_metadata_context(creds); + mdctx = grpc_mdctx_create(); s = gpr_malloc(sizeof(setup)); connector_arg = grpc_security_connector_to_arg(&connector->base); diff --git a/src/core/transport/metadata.h b/src/core/transport/metadata.h index e7508718f5e..76e3f3c1f8c 100644 --- a/src/core/transport/metadata.h +++ b/src/core/transport/metadata.h @@ -96,6 +96,7 @@ size_t grpc_mdctx_get_mdtab_free_test_only(grpc_mdctx *mdctx); /* Constructors for grpc_mdstr instances; take a variety of data types that clients may have handy */ grpc_mdstr *grpc_mdstr_from_string(grpc_mdctx *ctx, const char *str); +/* Unrefs the slice. */ grpc_mdstr *grpc_mdstr_from_slice(grpc_mdctx *ctx, gpr_slice slice); grpc_mdstr *grpc_mdstr_from_buffer(grpc_mdctx *ctx, const gpr_uint8 *str, size_t length); @@ -110,6 +111,7 @@ grpc_mdelem *grpc_mdelem_from_metadata_strings(grpc_mdctx *ctx, grpc_mdstr *key, grpc_mdstr *value); grpc_mdelem *grpc_mdelem_from_strings(grpc_mdctx *ctx, const char *key, const char *value); +/* Unrefs the slices. */ grpc_mdelem *grpc_mdelem_from_slices(grpc_mdctx *ctx, gpr_slice key, gpr_slice value); grpc_mdelem *grpc_mdelem_from_string_and_buffer(grpc_mdctx *ctx, diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index 1b657e3d89c..9a77f88e738 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -135,51 +135,113 @@ static grpc_httpcli_response http_response(int status, const char *body) { return response; } +static void test_empty_md_store(void) { + grpc_credentials_md_store *store = grpc_credentials_md_store_create(0); + GPR_ASSERT(store->num_entries == 0); + GPR_ASSERT(store->allocated == 0); + grpc_credentials_md_store_unref(store); +} + +static void test_ref_unref_empty_md_store(void) { + grpc_credentials_md_store *store = grpc_credentials_md_store_create(0); + grpc_credentials_md_store_ref(store); + grpc_credentials_md_store_ref(store); + GPR_ASSERT(store->num_entries == 0); + GPR_ASSERT(store->allocated == 0); + grpc_credentials_md_store_unref(store); + grpc_credentials_md_store_unref(store); + grpc_credentials_md_store_unref(store); +} + +static void test_add_to_empty_md_store(void) { + grpc_credentials_md_store *store = grpc_credentials_md_store_create(0); + const char *key_str = "hello"; + const char *value_str = "there blah blah blah blah blah blah blah"; + gpr_slice key = gpr_slice_from_copied_string(key_str); + gpr_slice value = gpr_slice_from_copied_string(value_str); + grpc_credentials_md_store_add(store, key, value); + GPR_ASSERT(store->num_entries == 1); + GPR_ASSERT(gpr_slice_cmp(key, store->entries[0].key) == 0); + GPR_ASSERT(gpr_slice_cmp(value, store->entries[0].value) == 0); + gpr_slice_unref(key); + gpr_slice_unref(value); + grpc_credentials_md_store_unref(store); +} + +static void test_add_cstrings_to_empty_md_store(void) { + grpc_credentials_md_store *store = grpc_credentials_md_store_create(0); + const char *key_str = "hello"; + const char *value_str = "there blah blah blah blah blah blah blah"; + grpc_credentials_md_store_add_cstrings(store, key_str, value_str); + GPR_ASSERT(store->num_entries == 1); + GPR_ASSERT(gpr_slice_str_cmp(store->entries[0].key, key_str) == 0); + GPR_ASSERT(gpr_slice_str_cmp(store->entries[0].value, value_str) == 0); + grpc_credentials_md_store_unref(store); +} + +static void test_empty_preallocated_md_store(void) { + grpc_credentials_md_store *store = grpc_credentials_md_store_create(4); + GPR_ASSERT(store->num_entries == 0); + GPR_ASSERT(store->allocated == 4); + GPR_ASSERT(store->entries != NULL); + grpc_credentials_md_store_unref(store); +} + +static void test_add_abunch_to_md_store(void) { + grpc_credentials_md_store *store = grpc_credentials_md_store_create(4); + size_t num_entries = 1000; + const char *key_str = "hello"; + const char *value_str = "there blah blah blah blah blah blah blah"; + size_t i; + for (i = 0; i < num_entries; i++) { + grpc_credentials_md_store_add_cstrings(store, key_str, value_str); + } + for (i = 0; i < num_entries; i++) { + GPR_ASSERT(gpr_slice_str_cmp(store->entries[i].key, key_str) == 0); + GPR_ASSERT(gpr_slice_str_cmp(store->entries[i].value, value_str) == 0); + } + grpc_credentials_md_store_unref(store); +} + static void test_oauth2_token_fetcher_creds_parsing_ok(void) { - grpc_mdctx *ctx = grpc_mdctx_create(); - grpc_mdelem *token_elem = NULL; + grpc_credentials_md_store *token_md = NULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(200, valid_oauth2_json_response); GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( - &response, ctx, &token_elem, &token_lifetime) == + &response, &token_md, &token_lifetime) == GRPC_CREDENTIALS_OK); GPR_ASSERT(token_lifetime.tv_sec == 3599); GPR_ASSERT(token_lifetime.tv_nsec == 0); - GPR_ASSERT(strcmp(grpc_mdstr_as_c_string(token_elem->key), - "Authorization") == 0); - GPR_ASSERT(strcmp(grpc_mdstr_as_c_string(token_elem->value), - "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") == 0); - grpc_mdelem_unref(token_elem); - grpc_mdctx_unref(ctx); + GPR_ASSERT(token_md->num_entries == 1); + GPR_ASSERT(gpr_slice_str_cmp(token_md->entries[0].key, "Authorization") == 0); + GPR_ASSERT(gpr_slice_str_cmp(token_md->entries[0].value, + "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") == + 0); + grpc_credentials_md_store_unref(token_md); } static void test_oauth2_token_fetcher_creds_parsing_bad_http_status(void) { - grpc_mdctx *ctx = grpc_mdctx_create(); - grpc_mdelem *token_elem = NULL; + grpc_credentials_md_store *token_md = NULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(401, valid_oauth2_json_response); GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( - &response, ctx, &token_elem, &token_lifetime) == + &response, &token_md, &token_lifetime) == GRPC_CREDENTIALS_ERROR); - grpc_mdctx_unref(ctx); } static void test_oauth2_token_fetcher_creds_parsing_empty_http_body(void) { - grpc_mdctx *ctx = grpc_mdctx_create(); - grpc_mdelem *token_elem = NULL; + grpc_credentials_md_store *token_md = NULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(200, ""); GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( - &response, ctx, &token_elem, &token_lifetime) == + &response, &token_md, &token_lifetime) == GRPC_CREDENTIALS_ERROR); - grpc_mdctx_unref(ctx); } static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) { - grpc_mdctx *ctx = grpc_mdctx_create(); - grpc_mdelem *token_elem = NULL; + grpc_credentials_md_store *token_md = NULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(200, @@ -187,28 +249,24 @@ static void test_oauth2_token_fetcher_creds_parsing_invalid_json(void) { " \"expires_in\":3599, " " \"token_type\":\"Bearer\""); GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( - &response, ctx, &token_elem, &token_lifetime) == + &response, &token_md, &token_lifetime) == GRPC_CREDENTIALS_ERROR); - grpc_mdctx_unref(ctx); } static void test_oauth2_token_fetcher_creds_parsing_missing_token(void) { - grpc_mdctx *ctx = grpc_mdctx_create(); - grpc_mdelem *token_elem = NULL; + grpc_credentials_md_store *token_md = NULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(200, "{" " \"expires_in\":3599, " " \"token_type\":\"Bearer\"}"); GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( - &response, ctx, &token_elem, &token_lifetime) == + &response, &token_md, &token_lifetime) == GRPC_CREDENTIALS_ERROR); - grpc_mdctx_unref(ctx); } static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) { - grpc_mdctx *ctx = grpc_mdctx_create(); - grpc_mdelem *token_elem = NULL; + grpc_credentials_md_store *token_md = NULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(200, @@ -216,35 +274,32 @@ static void test_oauth2_token_fetcher_creds_parsing_missing_token_type(void) { " \"expires_in\":3599, " "}"); GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( - &response, ctx, &token_elem, &token_lifetime) == + &response, &token_md, &token_lifetime) == GRPC_CREDENTIALS_ERROR); - grpc_mdctx_unref(ctx); } static void test_oauth2_token_fetcher_creds_parsing_missing_token_lifetime( void) { - grpc_mdctx *ctx = grpc_mdctx_create(); - grpc_mdelem *token_elem = NULL; + grpc_credentials_md_store *token_md = NULL; gpr_timespec token_lifetime; grpc_httpcli_response response = http_response(200, "{\"access_token\":\"ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_\"," " \"token_type\":\"Bearer\"}"); GPR_ASSERT(grpc_oauth2_token_fetcher_credentials_parse_server_response( - &response, ctx, &token_elem, &token_lifetime) == + &response, &token_md, &token_lifetime) == GRPC_CREDENTIALS_ERROR); - grpc_mdctx_unref(ctx); } -static void check_metadata(expected_md *expected, grpc_mdelem **md_elems, +static void check_metadata(expected_md *expected, grpc_credentials_md *md_elems, size_t num_md) { size_t i; for (i = 0; i < num_md; i++) { size_t j; for (j = 0; j < num_md; j++) { - if (0 == gpr_slice_str_cmp(md_elems[j]->key->slice, expected[i].key)) { - GPR_ASSERT(0 == gpr_slice_str_cmp(md_elems[j]->value->slice, - expected[i].value)); + if (0 == gpr_slice_str_cmp(md_elems[j].key, expected[i].key)) { + GPR_ASSERT(gpr_slice_str_cmp(md_elems[j].value, expected[i].value) == + 0); break; } } @@ -255,7 +310,7 @@ static void check_metadata(expected_md *expected, grpc_mdelem **md_elems, } } -static void check_iam_metadata(void *user_data, grpc_mdelem **md_elems, +static void check_iam_metadata(void *user_data, grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status) { grpc_credentials *c = (grpc_credentials *)user_data; expected_md emd[] = { @@ -277,7 +332,7 @@ static void test_iam_creds(void) { } static void check_ssl_oauth2_composite_metadata( - void *user_data, grpc_mdelem **md_elems, size_t num_md, + void *user_data, grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status) { grpc_credentials *c = (grpc_credentials *)user_data; expected_md emd[] = { @@ -327,7 +382,7 @@ void test_ssl_fake_transport_security_composite_creds_failure(void) { } static void check_ssl_oauth2_iam_composite_metadata( - void *user_data, grpc_mdelem **md_elems, size_t num_md, + void *user_data, grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status) { grpc_credentials *c = (grpc_credentials *)user_data; expected_md emd[] = { @@ -374,20 +429,20 @@ static void test_ssl_oauth2_iam_composite_creds(void) { } static void on_oauth2_creds_get_metadata_success( - void *user_data, grpc_mdelem **md_elems, size_t num_md, + void *user_data, grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status) { GPR_ASSERT(status == GRPC_CREDENTIALS_OK); GPR_ASSERT(num_md == 1); - GPR_ASSERT(strcmp(grpc_mdstr_as_c_string(md_elems[0]->key), - "Authorization") == 0); - GPR_ASSERT(strcmp(grpc_mdstr_as_c_string(md_elems[0]->value), - "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") == 0); + GPR_ASSERT(gpr_slice_str_cmp(md_elems[0].key, "Authorization") == 0); + GPR_ASSERT(gpr_slice_str_cmp(md_elems[0].value, + "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") == + 0); GPR_ASSERT(user_data != NULL); GPR_ASSERT(strcmp((const char *)user_data, test_user_data) == 0); } static void on_oauth2_creds_get_metadata_failure( - void *user_data, grpc_mdelem **md_elems, size_t num_md, + void *user_data, grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status) { GPR_ASSERT(status == GRPC_CREDENTIALS_ERROR); GPR_ASSERT(num_md == 0); @@ -719,24 +774,22 @@ static void test_service_account_creds_signing_failure(void) { } static void on_jwt_creds_get_metadata_success(void *user_data, - grpc_mdelem **md_elems, + grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status) { char *expected_md_value; gpr_asprintf(&expected_md_value, "Bearer %s", test_signed_jwt); GPR_ASSERT(status == GRPC_CREDENTIALS_OK); GPR_ASSERT(num_md == 1); - GPR_ASSERT(strcmp(grpc_mdstr_as_c_string(md_elems[0]->key), - "Authorization") == 0); - GPR_ASSERT(strcmp(grpc_mdstr_as_c_string(md_elems[0]->value), - expected_md_value) == 0); + GPR_ASSERT(gpr_slice_str_cmp(md_elems[0].key, "Authorization") == 0); + GPR_ASSERT(gpr_slice_str_cmp(md_elems[0].value, expected_md_value) == 0); GPR_ASSERT(user_data != NULL); GPR_ASSERT(strcmp((const char *)user_data, test_user_data) == 0); gpr_free(expected_md_value); } static void on_jwt_creds_get_metadata_failure(void *user_data, - grpc_mdelem **md_elems, + grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status) { GPR_ASSERT(status == GRPC_CREDENTIALS_ERROR); @@ -796,6 +849,12 @@ static void test_jwt_creds_signing_failure(void) { int main(int argc, char **argv) { grpc_test_init(argc, argv); + test_empty_md_store(); + test_ref_unref_empty_md_store(); + test_add_to_empty_md_store(); + test_add_cstrings_to_empty_md_store(); + test_empty_preallocated_md_store(); + test_add_abunch_to_md_store(); test_oauth2_token_fetcher_creds_parsing_ok(); test_oauth2_token_fetcher_creds_parsing_bad_http_status(); test_oauth2_token_fetcher_creds_parsing_empty_http_body(); diff --git a/vsprojects/grpc/grpc.vcxproj b/vsprojects/grpc/grpc.vcxproj index 1c965388bba..dae96e2294f 100644 --- a/vsprojects/grpc/grpc.vcxproj +++ b/vsprojects/grpc/grpc.vcxproj @@ -273,6 +273,8 @@ + + diff --git a/vsprojects/grpc/grpc.vcxproj.filters b/vsprojects/grpc/grpc.vcxproj.filters index ff6afb2ecaa..7b9d072384a 100644 --- a/vsprojects/grpc/grpc.vcxproj.filters +++ b/vsprojects/grpc/grpc.vcxproj.filters @@ -22,6 +22,9 @@ src\core\security + + src\core\security + src\core\security From 1f030301234b3802d1e47b5173dc744ffca7bcdc Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Fri, 29 May 2015 20:33:54 -0700 Subject: [PATCH 2/3] fixing protobuf (again...) --- third_party/protobuf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/protobuf b/third_party/protobuf index 8908cf16fe8..3e2c8a5dd79 160000 --- a/third_party/protobuf +++ b/third_party/protobuf @@ -1 +1 @@ -Subproject commit 8908cf16fe81f42c766fdf067b1da4554f54ed87 +Subproject commit 3e2c8a5dd79481e1d36572cdf65be93514ba6581 From 8a8c1b2ed2f8cf916ae7e198cef843b9fbc148ab Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Fri, 29 May 2015 20:37:11 -0700 Subject: [PATCH 3/3] fixing doxygen files after merge. --- tools/doxygen/Doxyfile.core.internal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 8ddcb28a583..61ef7c5b4e4 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -760,7 +760,7 @@ WARN_LOGFILE = # spaces. # Note: If this tag is empty the current directory is searched. -INPUT = include/grpc/grpc_security.h include/grpc/byte_buffer.h include/grpc/byte_buffer_reader.h include/grpc/grpc.h include/grpc/status.h src/core/httpcli/format_request.h src/core/httpcli/httpcli.h src/core/httpcli/httpcli_security_connector.h src/core/httpcli/parser.h src/core/security/auth.h src/core/security/base64.h src/core/security/credentials.h src/core/security/json_token.h src/core/security/secure_endpoint.h src/core/security/secure_transport_setup.h src/core/security/security_connector.h src/core/security/security_context.h src/core/tsi/fake_transport_security.h src/core/tsi/ssl_transport_security.h src/core/tsi/transport_security.h src/core/tsi/transport_security_interface.h src/core/channel/census_filter.h src/core/channel/channel_args.h src/core/channel/channel_stack.h src/core/channel/child_channel.h src/core/channel/client_channel.h src/core/channel/client_setup.h src/core/channel/connected_channel.h src/core/channel/http_client_filter.h src/core/channel/http_server_filter.h src/core/channel/noop_filter.h src/core/compression/algorithm.h src/core/compression/message_compress.h src/core/debug/trace.h src/core/iomgr/alarm.h src/core/iomgr/alarm_heap.h src/core/iomgr/alarm_internal.h src/core/iomgr/endpoint.h src/core/iomgr/endpoint_pair.h src/core/iomgr/fd_posix.h src/core/iomgr/iocp_windows.h src/core/iomgr/iomgr.h src/core/iomgr/iomgr_internal.h src/core/iomgr/iomgr_posix.h src/core/iomgr/pollset.h src/core/iomgr/pollset_kick.h src/core/iomgr/pollset_kick_posix.h src/core/iomgr/pollset_kick_windows.h src/core/iomgr/pollset_posix.h src/core/iomgr/pollset_windows.h src/core/iomgr/resolve_address.h src/core/iomgr/sockaddr.h src/core/iomgr/sockaddr_posix.h src/core/iomgr/sockaddr_utils.h src/core/iomgr/sockaddr_win32.h src/core/iomgr/socket_utils_posix.h src/core/iomgr/socket_windows.h src/core/iomgr/tcp_client.h src/core/iomgr/tcp_posix.h src/core/iomgr/tcp_server.h src/core/iomgr/tcp_windows.h src/core/iomgr/time_averaged_stats.h src/core/iomgr/wakeup_fd_pipe.h src/core/iomgr/wakeup_fd_posix.h src/core/json/json.h src/core/json/json_common.h src/core/json/json_reader.h src/core/json/json_writer.h src/core/profiling/timers.h src/core/profiling/timers_preciseclock.h src/core/statistics/census_interface.h src/core/statistics/census_log.h src/core/statistics/census_rpc_stats.h src/core/statistics/census_tracing.h src/core/statistics/hash_table.h src/core/statistics/window_stats.h src/core/surface/byte_buffer_queue.h src/core/surface/call.h src/core/surface/channel.h 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/server.h src/core/surface/surface_trace.h src/core/transport/chttp2/alpn.h src/core/transport/chttp2/bin_encoder.h src/core/transport/chttp2/frame.h src/core/transport/chttp2/frame_data.h src/core/transport/chttp2/frame_goaway.h src/core/transport/chttp2/frame_ping.h src/core/transport/chttp2/frame_rst_stream.h src/core/transport/chttp2/frame_settings.h src/core/transport/chttp2/frame_window_update.h src/core/transport/chttp2/hpack_parser.h src/core/transport/chttp2/hpack_table.h src/core/transport/chttp2/http2_errors.h src/core/transport/chttp2/huffsyms.h src/core/transport/chttp2/status_conversion.h src/core/transport/chttp2/stream_encoder.h src/core/transport/chttp2/stream_map.h src/core/transport/chttp2/timeout_encoding.h src/core/transport/chttp2/varint.h src/core/transport/chttp2_transport.h src/core/transport/metadata.h src/core/transport/stream_op.h src/core/transport/transport.h src/core/transport/transport_impl.h src/core/httpcli/format_request.c src/core/httpcli/httpcli.c src/core/httpcli/httpcli_security_connector.c src/core/httpcli/parser.c src/core/security/auth.c src/core/security/base64.c src/core/security/credentials.c src/core/security/credentials_posix.c src/core/security/credentials_win32.c src/core/security/google_default_credentials.c src/core/security/json_token.c src/core/security/secure_endpoint.c src/core/security/secure_transport_setup.c src/core/security/security_connector.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/tsi/fake_transport_security.c src/core/tsi/ssl_transport_security.c src/core/tsi/transport_security.c src/core/channel/census_filter.c src/core/channel/channel_args.c src/core/channel/channel_stack.c src/core/channel/child_channel.c src/core/channel/client_channel.c src/core/channel/client_setup.c src/core/channel/connected_channel.c src/core/channel/http_client_filter.c src/core/channel/http_server_filter.c src/core/channel/noop_filter.c src/core/compression/algorithm.c src/core/compression/message_compress.c src/core/debug/trace.c src/core/iomgr/alarm.c src/core/iomgr/alarm_heap.c src/core/iomgr/endpoint.c src/core/iomgr/endpoint_pair_posix.c src/core/iomgr/endpoint_pair_windows.c src/core/iomgr/fd_posix.c src/core/iomgr/iocp_windows.c src/core/iomgr/iomgr.c src/core/iomgr/iomgr_posix.c src/core/iomgr/iomgr_windows.c src/core/iomgr/pollset_kick.c src/core/iomgr/pollset_multipoller_with_epoll.c src/core/iomgr/pollset_multipoller_with_poll_posix.c src/core/iomgr/pollset_posix.c src/core/iomgr/pollset_windows.c src/core/iomgr/resolve_address_posix.c src/core/iomgr/resolve_address_windows.c src/core/iomgr/sockaddr_utils.c src/core/iomgr/socket_utils_common_posix.c src/core/iomgr/socket_utils_linux.c src/core/iomgr/socket_utils_posix.c src/core/iomgr/socket_windows.c src/core/iomgr/tcp_client_posix.c src/core/iomgr/tcp_client_windows.c src/core/iomgr/tcp_posix.c src/core/iomgr/tcp_server_posix.c src/core/iomgr/tcp_server_windows.c src/core/iomgr/tcp_windows.c src/core/iomgr/time_averaged_stats.c src/core/iomgr/wakeup_fd_eventfd.c src/core/iomgr/wakeup_fd_nospecial.c src/core/iomgr/wakeup_fd_pipe.c src/core/iomgr/wakeup_fd_posix.c src/core/json/json.c src/core/json/json_reader.c src/core/json/json_string.c src/core/json/json_writer.c src/core/profiling/basic_timers.c src/core/profiling/stap_timers.c src/core/statistics/census_init.c src/core/statistics/census_log.c src/core/statistics/census_rpc_stats.c src/core/statistics/census_tracing.c src/core/statistics/hash_table.c src/core/statistics/window_stats.c src/core/surface/byte_buffer.c src/core/surface/byte_buffer_queue.c src/core/surface/byte_buffer_reader.c src/core/surface/call.c src/core/surface/call_details.c src/core/surface/call_log_batch.c src/core/surface/channel.c src/core/surface/channel_create.c src/core/surface/client.c src/core/surface/completion_queue.c src/core/surface/event_string.c src/core/surface/init.c src/core/surface/lame_client.c src/core/surface/metadata_array.c src/core/surface/server.c src/core/surface/server_chttp2.c src/core/surface/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 src/core/transport/chttp2/frame_goaway.c src/core/transport/chttp2/frame_ping.c src/core/transport/chttp2/frame_rst_stream.c src/core/transport/chttp2/frame_settings.c src/core/transport/chttp2/frame_window_update.c src/core/transport/chttp2/hpack_parser.c src/core/transport/chttp2/hpack_table.c src/core/transport/chttp2/huffsyms.c src/core/transport/chttp2/status_conversion.c src/core/transport/chttp2/stream_encoder.c src/core/transport/chttp2/stream_map.c src/core/transport/chttp2/timeout_encoding.c src/core/transport/chttp2/varint.c src/core/transport/chttp2_transport.c src/core/transport/metadata.c src/core/transport/stream_op.c src/core/transport/transport.c src/core/transport/transport_op_string.c include/grpc/support/alloc.h include/grpc/support/atm.h include/grpc/support/atm_gcc_atomic.h include/grpc/support/atm_gcc_sync.h include/grpc/support/atm_win32.h include/grpc/support/cancellable_platform.h include/grpc/support/cmdline.h include/grpc/support/cpu.h include/grpc/support/histogram.h include/grpc/support/host_port.h include/grpc/support/log.h include/grpc/support/log_win32.h include/grpc/support/port_platform.h include/grpc/support/slice.h include/grpc/support/slice_buffer.h include/grpc/support/subprocess.h include/grpc/support/sync.h include/grpc/support/sync_generic.h include/grpc/support/sync_posix.h include/grpc/support/sync_win32.h include/grpc/support/thd.h include/grpc/support/time.h include/grpc/support/tls.h include/grpc/support/tls_gcc.h include/grpc/support/tls_msvc.h include/grpc/support/tls_pthread.h include/grpc/support/useful.h src/core/support/env.h src/core/support/file.h src/core/support/murmur_hash.h src/core/support/string.h src/core/support/string_win32.h src/core/support/thd_internal.h src/core/support/alloc.c src/core/support/cancellable.c src/core/support/cmdline.c src/core/support/cpu_iphone.c src/core/support/cpu_linux.c src/core/support/cpu_posix.c src/core/support/cpu_windows.c src/core/support/env_linux.c src/core/support/env_posix.c src/core/support/env_win32.c src/core/support/file.c src/core/support/file_posix.c src/core/support/file_win32.c src/core/support/histogram.c src/core/support/host_port.c src/core/support/log.c src/core/support/log_android.c src/core/support/log_linux.c src/core/support/log_posix.c src/core/support/log_win32.c src/core/support/murmur_hash.c src/core/support/slice.c src/core/support/slice_buffer.c src/core/support/string.c src/core/support/string_posix.c src/core/support/string_win32.c src/core/support/subprocess_posix.c src/core/support/sync.c src/core/support/sync_posix.c src/core/support/sync_win32.c src/core/support/thd.c src/core/support/thd_posix.c src/core/support/thd_win32.c src/core/support/time.c src/core/support/time_posix.c src/core/support/time_win32.c src/core/support/tls_pthread.c +INPUT = include/grpc/grpc_security.h include/grpc/byte_buffer.h include/grpc/byte_buffer_reader.h include/grpc/grpc.h include/grpc/status.h src/core/httpcli/format_request.h src/core/httpcli/httpcli.h src/core/httpcli/httpcli_security_connector.h src/core/httpcli/parser.h src/core/security/auth.h src/core/security/base64.h src/core/security/credentials.h src/core/security/json_token.h src/core/security/secure_endpoint.h src/core/security/secure_transport_setup.h src/core/security/security_connector.h src/core/security/security_context.h src/core/tsi/fake_transport_security.h src/core/tsi/ssl_transport_security.h src/core/tsi/transport_security.h src/core/tsi/transport_security_interface.h src/core/channel/census_filter.h src/core/channel/channel_args.h src/core/channel/channel_stack.h src/core/channel/child_channel.h src/core/channel/client_channel.h src/core/channel/client_setup.h src/core/channel/connected_channel.h src/core/channel/http_client_filter.h src/core/channel/http_server_filter.h src/core/channel/noop_filter.h src/core/compression/algorithm.h src/core/compression/message_compress.h src/core/debug/trace.h src/core/iomgr/alarm.h src/core/iomgr/alarm_heap.h src/core/iomgr/alarm_internal.h src/core/iomgr/endpoint.h src/core/iomgr/endpoint_pair.h src/core/iomgr/fd_posix.h src/core/iomgr/iocp_windows.h src/core/iomgr/iomgr.h src/core/iomgr/iomgr_internal.h src/core/iomgr/iomgr_posix.h src/core/iomgr/pollset.h src/core/iomgr/pollset_kick.h src/core/iomgr/pollset_kick_posix.h src/core/iomgr/pollset_kick_windows.h src/core/iomgr/pollset_posix.h src/core/iomgr/pollset_windows.h src/core/iomgr/resolve_address.h src/core/iomgr/sockaddr.h src/core/iomgr/sockaddr_posix.h src/core/iomgr/sockaddr_utils.h src/core/iomgr/sockaddr_win32.h src/core/iomgr/socket_utils_posix.h src/core/iomgr/socket_windows.h src/core/iomgr/tcp_client.h src/core/iomgr/tcp_posix.h src/core/iomgr/tcp_server.h src/core/iomgr/tcp_windows.h src/core/iomgr/time_averaged_stats.h src/core/iomgr/wakeup_fd_pipe.h src/core/iomgr/wakeup_fd_posix.h src/core/json/json.h src/core/json/json_common.h src/core/json/json_reader.h src/core/json/json_writer.h src/core/profiling/timers.h src/core/profiling/timers_preciseclock.h src/core/statistics/census_interface.h src/core/statistics/census_log.h src/core/statistics/census_rpc_stats.h src/core/statistics/census_tracing.h src/core/statistics/hash_table.h src/core/statistics/window_stats.h src/core/surface/byte_buffer_queue.h src/core/surface/call.h src/core/surface/channel.h 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/server.h src/core/surface/surface_trace.h src/core/transport/chttp2/alpn.h src/core/transport/chttp2/bin_encoder.h src/core/transport/chttp2/frame.h src/core/transport/chttp2/frame_data.h src/core/transport/chttp2/frame_goaway.h src/core/transport/chttp2/frame_ping.h src/core/transport/chttp2/frame_rst_stream.h src/core/transport/chttp2/frame_settings.h src/core/transport/chttp2/frame_window_update.h src/core/transport/chttp2/hpack_parser.h src/core/transport/chttp2/hpack_table.h src/core/transport/chttp2/http2_errors.h src/core/transport/chttp2/huffsyms.h src/core/transport/chttp2/status_conversion.h src/core/transport/chttp2/stream_encoder.h src/core/transport/chttp2/stream_map.h src/core/transport/chttp2/timeout_encoding.h src/core/transport/chttp2/varint.h src/core/transport/chttp2_transport.h src/core/transport/metadata.h src/core/transport/stream_op.h src/core/transport/transport.h src/core/transport/transport_impl.h src/core/httpcli/format_request.c src/core/httpcli/httpcli.c src/core/httpcli/httpcli_security_connector.c src/core/httpcli/parser.c src/core/security/auth.c src/core/security/base64.c src/core/security/credentials.c src/core/security/credentials_metadata.c src/core/security/credentials_posix.c src/core/security/credentials_win32.c src/core/security/google_default_credentials.c src/core/security/json_token.c src/core/security/secure_endpoint.c src/core/security/secure_transport_setup.c src/core/security/security_connector.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/tsi/fake_transport_security.c src/core/tsi/ssl_transport_security.c src/core/tsi/transport_security.c src/core/channel/census_filter.c src/core/channel/channel_args.c src/core/channel/channel_stack.c src/core/channel/child_channel.c src/core/channel/client_channel.c src/core/channel/client_setup.c src/core/channel/connected_channel.c src/core/channel/http_client_filter.c src/core/channel/http_server_filter.c src/core/channel/noop_filter.c src/core/compression/algorithm.c src/core/compression/message_compress.c src/core/debug/trace.c src/core/iomgr/alarm.c src/core/iomgr/alarm_heap.c src/core/iomgr/endpoint.c src/core/iomgr/endpoint_pair_posix.c src/core/iomgr/endpoint_pair_windows.c src/core/iomgr/fd_posix.c src/core/iomgr/iocp_windows.c src/core/iomgr/iomgr.c src/core/iomgr/iomgr_posix.c src/core/iomgr/iomgr_windows.c src/core/iomgr/pollset_kick.c src/core/iomgr/pollset_multipoller_with_epoll.c src/core/iomgr/pollset_multipoller_with_poll_posix.c src/core/iomgr/pollset_posix.c src/core/iomgr/pollset_windows.c src/core/iomgr/resolve_address_posix.c src/core/iomgr/resolve_address_windows.c src/core/iomgr/sockaddr_utils.c src/core/iomgr/socket_utils_common_posix.c src/core/iomgr/socket_utils_linux.c src/core/iomgr/socket_utils_posix.c src/core/iomgr/socket_windows.c src/core/iomgr/tcp_client_posix.c src/core/iomgr/tcp_client_windows.c src/core/iomgr/tcp_posix.c src/core/iomgr/tcp_server_posix.c src/core/iomgr/tcp_server_windows.c src/core/iomgr/tcp_windows.c src/core/iomgr/time_averaged_stats.c src/core/iomgr/wakeup_fd_eventfd.c src/core/iomgr/wakeup_fd_nospecial.c src/core/iomgr/wakeup_fd_pipe.c src/core/iomgr/wakeup_fd_posix.c src/core/json/json.c src/core/json/json_reader.c src/core/json/json_string.c src/core/json/json_writer.c src/core/profiling/basic_timers.c src/core/profiling/stap_timers.c src/core/statistics/census_init.c src/core/statistics/census_log.c src/core/statistics/census_rpc_stats.c src/core/statistics/census_tracing.c src/core/statistics/hash_table.c src/core/statistics/window_stats.c src/core/surface/byte_buffer.c src/core/surface/byte_buffer_queue.c src/core/surface/byte_buffer_reader.c src/core/surface/call.c src/core/surface/call_details.c src/core/surface/call_log_batch.c src/core/surface/channel.c src/core/surface/channel_create.c src/core/surface/client.c src/core/surface/completion_queue.c src/core/surface/event_string.c src/core/surface/init.c src/core/surface/lame_client.c src/core/surface/metadata_array.c src/core/surface/server.c src/core/surface/server_chttp2.c src/core/surface/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 src/core/transport/chttp2/frame_goaway.c src/core/transport/chttp2/frame_ping.c src/core/transport/chttp2/frame_rst_stream.c src/core/transport/chttp2/frame_settings.c src/core/transport/chttp2/frame_window_update.c src/core/transport/chttp2/hpack_parser.c src/core/transport/chttp2/hpack_table.c src/core/transport/chttp2/huffsyms.c src/core/transport/chttp2/status_conversion.c src/core/transport/chttp2/stream_encoder.c src/core/transport/chttp2/stream_map.c src/core/transport/chttp2/timeout_encoding.c src/core/transport/chttp2/varint.c src/core/transport/chttp2_transport.c src/core/transport/metadata.c src/core/transport/stream_op.c src/core/transport/transport.c src/core/transport/transport_op_string.c include/grpc/support/alloc.h include/grpc/support/atm.h include/grpc/support/atm_gcc_atomic.h include/grpc/support/atm_gcc_sync.h include/grpc/support/atm_win32.h include/grpc/support/cancellable_platform.h include/grpc/support/cmdline.h include/grpc/support/cpu.h include/grpc/support/histogram.h include/grpc/support/host_port.h include/grpc/support/log.h include/grpc/support/log_win32.h include/grpc/support/port_platform.h include/grpc/support/slice.h include/grpc/support/slice_buffer.h include/grpc/support/subprocess.h include/grpc/support/sync.h include/grpc/support/sync_generic.h include/grpc/support/sync_posix.h include/grpc/support/sync_win32.h include/grpc/support/thd.h include/grpc/support/time.h include/grpc/support/tls.h include/grpc/support/tls_gcc.h include/grpc/support/tls_msvc.h include/grpc/support/tls_pthread.h include/grpc/support/useful.h src/core/support/env.h src/core/support/file.h src/core/support/murmur_hash.h src/core/support/string.h src/core/support/string_win32.h src/core/support/thd_internal.h src/core/support/alloc.c src/core/support/cancellable.c src/core/support/cmdline.c src/core/support/cpu_iphone.c src/core/support/cpu_linux.c src/core/support/cpu_posix.c src/core/support/cpu_windows.c src/core/support/env_linux.c src/core/support/env_posix.c src/core/support/env_win32.c src/core/support/file.c src/core/support/file_posix.c src/core/support/file_win32.c src/core/support/histogram.c src/core/support/host_port.c src/core/support/log.c src/core/support/log_android.c src/core/support/log_linux.c src/core/support/log_posix.c src/core/support/log_win32.c src/core/support/murmur_hash.c src/core/support/slice.c src/core/support/slice_buffer.c src/core/support/string.c src/core/support/string_posix.c src/core/support/string_win32.c src/core/support/subprocess_posix.c src/core/support/sync.c src/core/support/sync_posix.c src/core/support/sync_win32.c src/core/support/thd.c src/core/support/thd_posix.c src/core/support/thd_win32.c src/core/support/time.c src/core/support/time_posix.c src/core/support/time_win32.c src/core/support/tls_pthread.c # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses