GRPC Core  0.11.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
security_context.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015, Google Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above
13  * copyright notice, this list of conditions and the following disclaimer
14  * in the documentation and/or other materials provided with the
15  * distribution.
16  * * Neither the name of Google Inc. nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
33 
34 #ifndef GRPC_INTERNAL_CORE_SECURITY_SECURITY_CONTEXT_H
35 #define GRPC_INTERNAL_CORE_SECURITY_SECURITY_CONTEXT_H
36 
37 #include "src/core/iomgr/pollset.h"
39 
40 /* --- grpc_auth_context ---
41 
42  High level authentication context object. Can optionally be chained. */
43 
44 /* Property names are always NULL terminated. */
45 
46 typedef struct {
48  size_t count;
49  size_t capacity;
51 
58 };
59 
60 /* Creation. */
62 
63 /* Refcounting. */
64 #ifdef GRPC_AUTH_CONTEXT_REFCOUNT_DEBUG
65 #define GRPC_AUTH_CONTEXT_REF(p, r) \
66  grpc_auth_context_ref((p), __FILE__, __LINE__, (r))
67 #define GRPC_AUTH_CONTEXT_UNREF(p, r) \
68  grpc_auth_context_unref((p), __FILE__, __LINE__, (r))
70  const char *file, int line,
71  const char *reason);
72 void grpc_auth_context_unref(grpc_auth_context *policy, const char *file,
73  int line, const char *reason);
74 #else
75 #define GRPC_AUTH_CONTEXT_REF(p, r) grpc_auth_context_ref((p))
76 #define GRPC_AUTH_CONTEXT_UNREF(p, r) grpc_auth_context_unref((p))
79 #endif
80 
82 
83 /* --- grpc_client_security_context ---
84 
85  Internal client-side security context. */
86 
87 typedef struct {
91 
94 
95 /* --- grpc_server_security_context ---
96 
97  Internal server-side security context. */
98 
99 typedef struct {
102 
105 
106 /* --- Auth metadata processing. --- */
107 #define GRPC_AUTH_METADATA_PROCESSOR_ARG "grpc.auth_metadata_processor"
108 
111  const grpc_arg *arg);
113  const grpc_channel_args *args);
114 
115 #endif /* GRPC_INTERNAL_CORE_SECURITY_SECURITY_CONTEXT_H */
Definition: security_context.h:52
void grpc_server_security_context_destroy(void *ctx)
Definition: security_context.c:113
void grpc_auth_property_reset(grpc_auth_property *property)
Definition: security_context.c:278
Definition: sync_generic.h:47
size_t count
Definition: security_context.h:48
An array of arguments that can be passed around.
Definition: grpc.h:111
grpc_pollset * pollset
Definition: security_context.h:57
grpc_arg grpc_auth_metadata_processor_to_arg(grpc_auth_metadata_processor *p)
Definition: security_context.c:284
Definition: security_context.h:46
gpr_refcount refcount
Definition: security_context.h:55
size_t capacity
Definition: security_context.h:49
grpc_auth_context * grpc_auth_context_ref(grpc_auth_context *policy)
Definition: security_context.c:144
A single argument...
Definition: grpc.h:89
grpc_auth_metadata_processor * grpc_find_auth_metadata_processor_in_args(const grpc_channel_args *args)
Definition: security_context.c:304
Definition: cmdline.c:47
void grpc_client_security_context_destroy(void *ctx)
Definition: security_context.c:97
grpc_auth_context * auth_context
Definition: security_context.h:89
Definition: pollset_posix.h:55
Definition: credentials.h:145
grpc_credentials * creds
Definition: security_context.h:88
struct grpc_auth_context * chained
Definition: security_context.h:53
grpc_auth_property * array
Definition: security_context.h:47
Definition: security_context.h:99
Definition: grpc_security.h:275
Definition: grpc_security.h:200
grpc_auth_context * auth_context
Definition: security_context.h:100
grpc_auth_property_array properties
Definition: security_context.h:54
const char * peer_identity_property_name
Definition: security_context.h:56
grpc_auth_context * grpc_auth_context_create(grpc_auth_context *chained)
Definition: security_context.c:123
grpc_server_security_context * grpc_server_security_context_create(void)
Definition: security_context.c:106
void grpc_auth_context_unref(grpc_auth_context *policy)
Definition: security_context.c:159
Definition: security_context.h:87
grpc_client_security_context * grpc_client_security_context_create(void)
Definition: security_context.c:90
grpc_auth_metadata_processor * grpc_auth_metadata_processor_from_arg(const grpc_arg *arg)
Definition: security_context.c:293