Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
ctiller committed Nov 18, 2015
1 parent ab5611d commit b113649
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 35 deletions.
5 changes: 2 additions & 3 deletions include/grpc++/security/credentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,8 @@ std::shared_ptr<CallCredentials> GoogleIAMCredentials(
/// Combines a channel credentials and a call credentials into a composite
/// channel credentials.
std::shared_ptr<ChannelCredentials> CompositeChannelCredentials(
const std::shared_ptr<ChannelCredentials>& channel_creds,
const std::shared_ptr<CallCredentials>& call_creds);

const std::shared_ptr<ChannelCredentials>& channel_creds,
const std::shared_ptr<CallCredentials>& call_creds);

/// Combines two call credentials objects into a composite call credentials.
std::shared_ptr<CallCredentials> CompositeCallCredentials(
Expand Down
48 changes: 31 additions & 17 deletions src/core/security/credentials.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ void grpc_call_credentials_release(grpc_call_credentials *creds) {
grpc_call_credentials_unref(creds);
}

void grpc_call_credentials_get_request_metadata(
grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pollset *pollset,
const char *service_url, grpc_credentials_metadata_cb cb, void *user_data) {
void grpc_call_credentials_get_request_metadata(grpc_exec_ctx *exec_ctx,
grpc_call_credentials *creds,
grpc_pollset *pollset,
const char *service_url,
grpc_credentials_metadata_cb cb,
void *user_data) {
if (creds == NULL || creds->vtable->get_request_metadata == NULL) {
if (cb != NULL) {
cb(exec_ctx, user_data, NULL, 0, GRPC_CREDENTIALS_OK);
Expand Down Expand Up @@ -423,9 +426,12 @@ static void jwt_destruct(grpc_call_credentials *creds) {
gpr_mu_destroy(&c->cache_mu);
}

static void jwt_get_request_metadata(
grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pollset *pollset,
const char *service_url, grpc_credentials_metadata_cb cb, void *user_data) {
static void jwt_get_request_metadata(grpc_exec_ctx *exec_ctx,
grpc_call_credentials *creds,
grpc_pollset *pollset,
const char *service_url,
grpc_credentials_metadata_cb cb,
void *user_data) {
grpc_service_account_jwt_access_credentials *c =
(grpc_service_account_jwt_access_credentials *)creds;
gpr_timespec refresh_threshold = gpr_time_from_seconds(
Expand Down Expand Up @@ -798,9 +804,12 @@ static void on_simulated_token_fetch_done(void *user_data) {
grpc_exec_ctx_finish(&exec_ctx);
}

static void md_only_test_get_request_metadata(
grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pollset *pollset,
const char *service_url, grpc_credentials_metadata_cb cb, void *user_data) {
static void md_only_test_get_request_metadata(grpc_exec_ctx *exec_ctx,
grpc_call_credentials *creds,
grpc_pollset *pollset,
const char *service_url,
grpc_credentials_metadata_cb cb,
void *user_data) {
grpc_md_only_test_credentials *c = (grpc_md_only_test_credentials *)creds;

if (c->is_async) {
Expand Down Expand Up @@ -837,9 +846,12 @@ static void access_token_destruct(grpc_call_credentials *creds) {
grpc_credentials_md_store_unref(c->access_token_md);
}

static void access_token_get_request_metadata(
grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pollset *pollset,
const char *service_url, grpc_credentials_metadata_cb cb, void *user_data) {
static void access_token_get_request_metadata(grpc_exec_ctx *exec_ctx,
grpc_call_credentials *creds,
grpc_pollset *pollset,
const char *service_url,
grpc_credentials_metadata_cb cb,
void *user_data) {
grpc_access_token_credentials *c = (grpc_access_token_credentials *)creds;
cb(exec_ctx, user_data, c->access_token_md->entries, 1, GRPC_CREDENTIALS_OK);
}
Expand Down Expand Up @@ -978,9 +990,12 @@ static void composite_call_metadata_cb(grpc_exec_ctx *exec_ctx, void *user_data,
composite_call_md_context_destroy(ctx);
}

static void composite_call_get_request_metadata(
grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pollset *pollset,
const char *service_url, grpc_credentials_metadata_cb cb, void *user_data) {
static void composite_call_get_request_metadata(grpc_exec_ctx *exec_ctx,
grpc_call_credentials *creds,
grpc_pollset *pollset,
const char *service_url,
grpc_credentials_metadata_cb cb,
void *user_data) {
grpc_composite_call_credentials *c = (grpc_composite_call_credentials *)creds;
grpc_composite_call_credentials_metadata_context *ctx;

Expand Down Expand Up @@ -1097,7 +1112,7 @@ static void iam_get_request_metadata(grpc_exec_ctx *exec_ctx,
}

static grpc_call_credentials_vtable iam_vtable = {iam_destruct,
iam_get_request_metadata};
iam_get_request_metadata};

grpc_call_credentials *grpc_google_iam_credentials_create(
const char *token, const char *authority_selector, void *reserved) {
Expand Down Expand Up @@ -1265,4 +1280,3 @@ grpc_channel_credentials *grpc_composite_channel_credentials_create(
c->call_creds = grpc_call_credentials_ref(call_creds);
return &c->base;
}

3 changes: 2 additions & 1 deletion src/core/security/credentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ typedef struct {
size_t num_creds;
} grpc_call_credentials_array;

const grpc_call_credentials_array *grpc_composite_call_credentials_get_credentials(
const grpc_call_credentials_array *
grpc_composite_call_credentials_get_credentials(
grpc_call_credentials *composite_creds);

/* Returns creds if creds is of the specified type or the inner creds of the
Expand Down
3 changes: 2 additions & 1 deletion src/core/security/google_default_credentials.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ grpc_channel_credentials *grpc_google_default_credentials_create(void) {
end:
if (result == NULL) {
if (call_creds != NULL) {
/* Blend with default ssl credentials and add a global reference so that it
/* Blend with default ssl credentials and add a global reference so that
it
can be cached and re-served. */
grpc_channel_credentials *ssl_creds =
grpc_ssl_credentials_create(NULL, NULL, NULL);
Expand Down
6 changes: 3 additions & 3 deletions src/core/security/security_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,9 @@ size_t grpc_get_default_ssl_roots(const unsigned char **pem_root_certs) {
}

grpc_security_status grpc_ssl_channel_security_connector_create(
grpc_call_credentials *request_metadata_creds, const grpc_ssl_config *config,
const char *target_name, const char *overridden_target_name,
grpc_channel_security_connector **sc) {
grpc_call_credentials *request_metadata_creds,
const grpc_ssl_config *config, const char *target_name,
const char *overridden_target_name, grpc_channel_security_connector **sc) {
size_t num_alpn_protocols = grpc_chttp2_num_alpn_versions();
const unsigned char **alpn_protocol_strings =
gpr_malloc(sizeof(const char *) * num_alpn_protocols);
Expand Down
4 changes: 3 additions & 1 deletion src/cpp/client/insecure_credentials.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ class InsecureChannelCredentialsImpl GRPC_FINAL : public ChannelCredentials {
grpc_insecure_channel_create(target.c_str(), &channel_args, nullptr));
}

SecureChannelCredentials* AsSecureCredentials() GRPC_OVERRIDE { return nullptr; }
SecureChannelCredentials* AsSecureCredentials() GRPC_OVERRIDE {
return nullptr;
}
};
} // namespace

Expand Down
1 change: 0 additions & 1 deletion src/cpp/client/secure_credentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class SecureCallCredentials GRPC_FINAL : public CallCredentials {
grpc_call_credentials* const c_creds_;
};


class MetadataCredentialsPluginWrapper GRPC_FINAL {
public:
static void Destroy(void* wrapper);
Expand Down
4 changes: 2 additions & 2 deletions test/core/client_config/lb_policies_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ int *perform_request(servers_fixture *f, grpc_channel *client,

s_idx = -1;
while ((ev = grpc_completion_queue_next(
f->cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL))
.type != GRPC_QUEUE_TIMEOUT) {
f->cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL)).type !=
GRPC_QUEUE_TIMEOUT) {
GPR_ASSERT(ev.type == GRPC_OP_COMPLETE);
read_tag = ((int)(gpr_intptr)ev.tag);
gpr_log(GPR_DEBUG, "EVENT: success:%d, type:%d, tag:%d iter:%d",
Expand Down
4 changes: 2 additions & 2 deletions test/core/end2end/tests/hpack_size.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ static void test_size(grpc_end2end_test_config config, int encode_size,
}

void grpc_end2end_tests(grpc_end2end_test_config config) {
static const int interesting_sizes[] = {
4096, 0, 100, 1000, 32768, 4 * 1024 * 1024};
static const int interesting_sizes[] = {4096, 0, 100,
1000, 32768, 4 * 1024 * 1024};
size_t i, j;

for (i = 0; i < GPR_ARRAY_SIZE(interesting_sizes); i++) {
Expand Down
10 changes: 6 additions & 4 deletions test/core/security/credentials_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ static void test_google_iam_creds(void) {
test_google_iam_authorization_token, test_google_iam_authority_selector,
NULL);
grpc_call_credentials_get_request_metadata(&exec_ctx, creds, NULL,
test_service_url,
check_google_iam_metadata, creds);
test_service_url,
check_google_iam_metadata, creds);
grpc_exec_ctx_finish(&exec_ctx);
}

Expand Down Expand Up @@ -436,7 +436,8 @@ static void test_oauth2_google_iam_composite_creds(void) {
test_google_iam_authorization_token, test_google_iam_authority_selector,
NULL);
grpc_call_credentials *composite_creds =
grpc_composite_call_credentials_create(oauth2_creds, google_iam_creds, NULL);
grpc_composite_call_credentials_create(oauth2_creds, google_iam_creds,
NULL);
grpc_call_credentials_unref(oauth2_creds);
grpc_call_credentials_unref(google_iam_creds);
GPR_ASSERT(
Expand Down Expand Up @@ -481,7 +482,8 @@ static void test_channel_oauth2_google_iam_composite_creds(void) {
grpc_call_credentials *oauth2_creds =
grpc_access_token_credentials_create("blah", NULL);
grpc_channel_credentials *channel_oauth2_creds =
grpc_composite_channel_credentials_create(channel_creds, oauth2_creds, NULL);
grpc_composite_channel_credentials_create(channel_creds, oauth2_creds,
NULL);
grpc_call_credentials *google_iam_creds = grpc_google_iam_credentials_create(
test_google_iam_authorization_token, test_google_iam_authority_selector,
NULL);
Expand Down

0 comments on commit b113649

Please sign in to comment.