GRPC Core 0.10.0.0

- Main Page
- Data Structures
- Files

- File List
- Globals

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/security/credentials.h"
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 /* --- grpc_auth_context ---
44
45 High level authentication context object. Can optionally be chained. */
46
47 /* Property names are always NULL terminated. */
48
49 struct grpc_auth_context {
50 struct grpc_auth_context *chained;
51 grpc_auth_property *properties;
52 size_t property_count;
53 gpr_refcount refcount;
54 const char *peer_identity_property_name;
55 };
56
57 /* Constructor. */
58 grpc_auth_context *grpc_auth_context_create(grpc_auth_context *chained,
59 size_t property_count);
60
61 /* Refcounting. */
62 #ifdef GRPC_AUTH_CONTEXT_REFCOUNT_DEBUG
63 #define GRPC_AUTH_CONTEXT_REF(p, r) \
64 grpc_auth_context_ref((p), __FILE__, __LINE__, (r))
65 #define GRPC_AUTH_CONTEXT_UNREF(p, r) \
66 grpc_auth_context_unref((p), __FILE__, __LINE__, (r))
67 grpc_auth_context *grpc_auth_context_ref(grpc_auth_context *policy,
68 const char *file, int line,
69 const char *reason);
70 void grpc_auth_context_unref(grpc_auth_context *policy, const char *file,
71 int line, const char *reason);
72 #else
73 #define GRPC_AUTH_CONTEXT_REF(p, r) grpc_auth_context_ref((p))
74 #define GRPC_AUTH_CONTEXT_UNREF(p, r) grpc_auth_context_unref((p))
75 grpc_auth_context *grpc_auth_context_ref(grpc_auth_context *policy);
76 void grpc_auth_context_unref(grpc_auth_context *policy);
77 #endif
78
79 grpc_auth_property grpc_auth_property_init_from_cstring(const char *name,
80 const char *value);
81
82 grpc_auth_property grpc_auth_property_init(const char *name, const char *value,
83 size_t value_length);
84
85 void grpc_auth_property_reset(grpc_auth_property *property);
86
87 /* --- grpc_client_security_context ---
88
89 Internal client-side security context. */
90
91 typedef struct {
92 grpc_credentials *creds;
93 grpc_auth_context *auth_context;
94 } grpc_client_security_context;
95
96 grpc_client_security_context *grpc_client_security_context_create(void);
97 void grpc_client_security_context_destroy(void *ctx);
98
99 /* --- grpc_server_security_context ---
100
101 Internal server-side security context. */
102
103 typedef struct {
104 grpc_auth_context *auth_context;
105 } grpc_server_security_context;
106
107 grpc_server_security_context *grpc_server_security_context_create(void);
108 void grpc_server_security_context_destroy(void *ctx);
109
110 #ifdef __cplusplus
111 }
112 #endif
113
114 #endif /* GRPC_INTERNAL_CORE_SECURITY_SECURITY_CONTEXT_H */
115
grpc_auth_context
Definition: security_context.h:49
value
const char * value
Definition: hpack_table.c:44
grpc_server_security_context_destroy
void grpc_server_security_context_destroy(void *ctx)
Definition: security_context.c:113
grpc_auth_property_reset
void grpc_auth_property_reset(grpc_auth_property *property)
Definition: security_context.c:252
grpc_auth_property_init
grpc_auth_property grpc_auth_property_init(const char *name, const char *value, size_t value_length)
Definition: security_context.c:241
gpr_refcount
Definition: sync_generic.h:49
grpc_auth_context::property_count
size_t property_count
Definition: security_context.h:52
grpc_auth_context::refcount
gpr_refcount refcount
Definition: security_context.h:53
grpc_auth_context_ref
grpc_auth_context * grpc_auth_context_ref(grpc_auth_context *policy)
Definition: security_context.c:144
grpc_client_security_context_destroy
void grpc_client_security_context_destroy(void *ctx)
Definition: security_context.c:97
grpc_client_security_context::auth_context
grpc_auth_context * auth_context
Definition: security_context.h:93
grpc_credentials
Definition: credentials.h:145
grpc_auth_context::properties
grpc_auth_property * properties
Definition: security_context.h:51
grpc_client_security_context::creds
grpc_credentials * creds
Definition: security_context.h:92
grpc_auth_property_init_from_cstring
grpc_auth_property grpc_auth_property_init_from_cstring(const char *name, const char *value)
Definition: security_context.c:232
grpc_auth_context::chained
struct grpc_auth_context * chained
Definition: security_context.h:50
grpc_server_security_context
Definition: security_context.h:103
credentials.h
grpc_auth_context_create
grpc_auth_context * grpc_auth_context_create(grpc_auth_context *chained, size_t property_count)
Definition: security_context.c:123
grpc_auth_property
Definition: grpc_security.h:219
grpc_server_security_context::auth_context
grpc_auth_context * auth_context
Definition: security_context.h:104
grpc_auth_context::peer_identity_property_name
const char * peer_identity_property_name
Definition: security_context.h:54
grpc_server_security_context_create
grpc_server_security_context * grpc_server_security_context_create(void)
Definition: security_context.c:106
grpc_auth_context_unref
void grpc_auth_context_unref(grpc_auth_context *policy)
Definition: security_context.c:159
grpc_client_security_context
Definition: security_context.h:91
grpc_client_security_context_create
grpc_client_security_context * grpc_client_security_context_create(void)
Definition: security_context.c:90