aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/security
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2016-01-13 06:54:27 -0800
committerGravatar Craig Tiller <craig.tiller@gmail.com>2016-01-13 06:54:27 -0800
commitedc2fffb34cdaaa5274432a197205fc8d3c206be (patch)
treea546b3ff30e6aec7a84683e7d07d819da4f72913 /src/core/security
parent0ade2d415ff5dbc9fca7b942809ef7179db08ef7 (diff)
Channel args comparisons
Diffstat (limited to 'src/core/security')
-rw-r--r--src/core/security/credentials.c13
-rw-r--r--src/core/security/security_connector.c13
-rw-r--r--src/core/security/security_context.c13
3 files changed, 33 insertions, 6 deletions
diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c
index 8b56c57645..28f41b2041 100644
--- a/src/core/security/credentials.c
+++ b/src/core/security/credentials.c
@@ -196,14 +196,23 @@ static void *server_credentials_pointer_arg_copy(void *p) {
return grpc_server_credentials_ref(p);
}
+static int server_credentials_pointer_cmp(void *a, void *b) {
+ return GPR_ICMP(a, b);
+}
+
+static const grpc_arg_pointer_vtable cred_ptr_vtable = {
+ server_credentials_pointer_arg_copy,
+ server_credentials_pointer_arg_destroy,
+ server_credentials_pointer_cmp
+};
+
grpc_arg grpc_server_credentials_to_arg(grpc_server_credentials *p) {
grpc_arg arg;
memset(&arg, 0, sizeof(grpc_arg));
arg.type = GRPC_ARG_POINTER;
arg.key = GRPC_SERVER_CREDENTIALS_ARG;
arg.value.pointer.p = p;
- arg.value.pointer.copy = server_credentials_pointer_arg_copy;
- arg.value.pointer.destroy = server_credentials_pointer_arg_destroy;
+ arg.value.pointer.vtable = &cred_ptr_vtable;
return arg;
}
diff --git a/src/core/security/security_connector.c b/src/core/security/security_connector.c
index 61336a1057..40f486128b 100644
--- a/src/core/security/security_connector.c
+++ b/src/core/security/security_connector.c
@@ -194,12 +194,21 @@ static void *connector_pointer_arg_copy(void *p) {
return GRPC_SECURITY_CONNECTOR_REF(p, "connector_pointer_arg");
}
+static int connector_pointer_cmp(void *a, void *b) {
+ return GPR_ICMP(a, b);
+}
+
+static const grpc_arg_pointer_vtable connector_pointer_vtable = {
+ connector_pointer_arg_copy,
+ connector_pointer_arg_destroy,
+ connector_pointer_cmp
+};
+
grpc_arg grpc_security_connector_to_arg(grpc_security_connector *sc) {
grpc_arg result;
result.type = GRPC_ARG_POINTER;
result.key = GRPC_SECURITY_CONNECTOR_ARG;
- result.value.pointer.destroy = connector_pointer_arg_destroy;
- result.value.pointer.copy = connector_pointer_arg_copy;
+ result.value.pointer.vtable = &connector_pointer_vtable;
result.value.pointer.p = sc;
return result;
}
diff --git a/src/core/security/security_context.c b/src/core/security/security_context.c
index 2068c97d78..6e948f61bc 100644
--- a/src/core/security/security_context.c
+++ b/src/core/security/security_context.c
@@ -309,14 +309,23 @@ static void *auth_context_pointer_arg_copy(void *p) {
return GRPC_AUTH_CONTEXT_REF(p, "auth_context_pointer_arg");
}
+static int auth_context_pointer_cmp(void *a, void *b) {
+ return GPR_ICMP(a, b);
+}
+
+static const grpc_arg_pointer_vtable auth_context_pointer_vtable = {
+ auth_context_pointer_arg_copy,
+ auth_context_pointer_arg_destroy,
+ auth_context_pointer_cmp
+};
+
grpc_arg grpc_auth_context_to_arg(grpc_auth_context *p) {
grpc_arg arg;
memset(&arg, 0, sizeof(grpc_arg));
arg.type = GRPC_ARG_POINTER;
arg.key = GRPC_AUTH_CONTEXT_ARG;
arg.value.pointer.p = p;
- arg.value.pointer.copy = auth_context_pointer_arg_copy;
- arg.value.pointer.destroy = auth_context_pointer_arg_destroy;
+ arg.value.pointer.vtable = &auth_context_pointer_vtable;
return arg;
}