1 /* This file was generated by upbc (the upb compiler) from the input
2 * file:
3 *
4 * udpa/core/v1/resource_locator.proto
5 *
6 * Do not edit -- your changes will be discarded when the file is
7 * regenerated. */
8
9 #ifndef UDPA_CORE_V1_RESOURCE_LOCATOR_PROTO_UPB_H_
10 #define UDPA_CORE_V1_RESOURCE_LOCATOR_PROTO_UPB_H_
11
12 #include "upb/msg.h"
13 #include "upb/decode.h"
14 #include "upb/decode_fast.h"
15 #include "upb/encode.h"
16
17 #include "upb/port_def.inc"
18
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 struct udpa_core_v1_ResourceLocator;
24 struct udpa_core_v1_ResourceLocator_Directive;
25 typedef struct udpa_core_v1_ResourceLocator udpa_core_v1_ResourceLocator;
26 typedef struct udpa_core_v1_ResourceLocator_Directive udpa_core_v1_ResourceLocator_Directive;
27 extern const upb_msglayout udpa_core_v1_ResourceLocator_msginit;
28 extern const upb_msglayout udpa_core_v1_ResourceLocator_Directive_msginit;
29 struct udpa_core_v1_ContextParams;
30 extern const upb_msglayout udpa_core_v1_ContextParams_msginit;
31
32 typedef enum {
33 udpa_core_v1_ResourceLocator_UDPA = 0,
34 udpa_core_v1_ResourceLocator_HTTP = 1,
35 udpa_core_v1_ResourceLocator_FILE = 2
36 } udpa_core_v1_ResourceLocator_Scheme;
37
38
39 /* udpa.core.v1.ResourceLocator */
40
udpa_core_v1_ResourceLocator_new(upb_arena * arena)41 UPB_INLINE udpa_core_v1_ResourceLocator *udpa_core_v1_ResourceLocator_new(upb_arena *arena) {
42 return (udpa_core_v1_ResourceLocator *)_upb_msg_new(&udpa_core_v1_ResourceLocator_msginit, arena);
43 }
udpa_core_v1_ResourceLocator_parse(const char * buf,size_t size,upb_arena * arena)44 UPB_INLINE udpa_core_v1_ResourceLocator *udpa_core_v1_ResourceLocator_parse(const char *buf, size_t size,
45 upb_arena *arena) {
46 udpa_core_v1_ResourceLocator *ret = udpa_core_v1_ResourceLocator_new(arena);
47 return (ret && upb_decode(buf, size, ret, &udpa_core_v1_ResourceLocator_msginit, arena)) ? ret : NULL;
48 }
udpa_core_v1_ResourceLocator_parse_ex(const char * buf,size_t size,upb_arena * arena,int options)49 UPB_INLINE udpa_core_v1_ResourceLocator *udpa_core_v1_ResourceLocator_parse_ex(const char *buf, size_t size,
50 upb_arena *arena, int options) {
51 udpa_core_v1_ResourceLocator *ret = udpa_core_v1_ResourceLocator_new(arena);
52 return (ret && _upb_decode(buf, size, ret, &udpa_core_v1_ResourceLocator_msginit, arena, options))
53 ? ret : NULL;
54 }
udpa_core_v1_ResourceLocator_serialize(const udpa_core_v1_ResourceLocator * msg,upb_arena * arena,size_t * len)55 UPB_INLINE char *udpa_core_v1_ResourceLocator_serialize(const udpa_core_v1_ResourceLocator *msg, upb_arena *arena, size_t *len) {
56 return upb_encode(msg, &udpa_core_v1_ResourceLocator_msginit, arena, len);
57 }
58
59 typedef enum {
60 udpa_core_v1_ResourceLocator_context_param_specifier_exact_context = 5,
61 udpa_core_v1_ResourceLocator_context_param_specifier_NOT_SET = 0
62 } udpa_core_v1_ResourceLocator_context_param_specifier_oneofcases;
udpa_core_v1_ResourceLocator_context_param_specifier_case(const udpa_core_v1_ResourceLocator * msg)63 UPB_INLINE udpa_core_v1_ResourceLocator_context_param_specifier_oneofcases udpa_core_v1_ResourceLocator_context_param_specifier_case(const udpa_core_v1_ResourceLocator* msg) { return (udpa_core_v1_ResourceLocator_context_param_specifier_oneofcases)*UPB_PTR_AT(msg, UPB_SIZE(32, 64), int32_t); }
64
udpa_core_v1_ResourceLocator_scheme(const udpa_core_v1_ResourceLocator * msg)65 UPB_INLINE int32_t udpa_core_v1_ResourceLocator_scheme(const udpa_core_v1_ResourceLocator *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(0, 0), int32_t); }
udpa_core_v1_ResourceLocator_id(const udpa_core_v1_ResourceLocator * msg,size_t * len)66 UPB_INLINE upb_strview const* udpa_core_v1_ResourceLocator_id(const udpa_core_v1_ResourceLocator *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(20, 40), len); }
udpa_core_v1_ResourceLocator_authority(const udpa_core_v1_ResourceLocator * msg)67 UPB_INLINE upb_strview udpa_core_v1_ResourceLocator_authority(const udpa_core_v1_ResourceLocator *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview); }
udpa_core_v1_ResourceLocator_resource_type(const udpa_core_v1_ResourceLocator * msg)68 UPB_INLINE upb_strview udpa_core_v1_ResourceLocator_resource_type(const udpa_core_v1_ResourceLocator *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview); }
udpa_core_v1_ResourceLocator_has_exact_context(const udpa_core_v1_ResourceLocator * msg)69 UPB_INLINE bool udpa_core_v1_ResourceLocator_has_exact_context(const udpa_core_v1_ResourceLocator *msg) { return _upb_getoneofcase(msg, UPB_SIZE(32, 64)) == 5; }
udpa_core_v1_ResourceLocator_exact_context(const udpa_core_v1_ResourceLocator * msg)70 UPB_INLINE const struct udpa_core_v1_ContextParams* udpa_core_v1_ResourceLocator_exact_context(const udpa_core_v1_ResourceLocator *msg) { return UPB_READ_ONEOF(msg, const struct udpa_core_v1_ContextParams*, UPB_SIZE(28, 56), UPB_SIZE(32, 64), 5, NULL); }
udpa_core_v1_ResourceLocator_has_directives(const udpa_core_v1_ResourceLocator * msg)71 UPB_INLINE bool udpa_core_v1_ResourceLocator_has_directives(const udpa_core_v1_ResourceLocator *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(24, 48)); }
udpa_core_v1_ResourceLocator_directives(const udpa_core_v1_ResourceLocator * msg,size_t * len)72 UPB_INLINE const udpa_core_v1_ResourceLocator_Directive* const* udpa_core_v1_ResourceLocator_directives(const udpa_core_v1_ResourceLocator *msg, size_t *len) { return (const udpa_core_v1_ResourceLocator_Directive* const*)_upb_array_accessor(msg, UPB_SIZE(24, 48), len); }
73
udpa_core_v1_ResourceLocator_set_scheme(udpa_core_v1_ResourceLocator * msg,int32_t value)74 UPB_INLINE void udpa_core_v1_ResourceLocator_set_scheme(udpa_core_v1_ResourceLocator *msg, int32_t value) {
75 *UPB_PTR_AT(msg, UPB_SIZE(0, 0), int32_t) = value;
76 }
udpa_core_v1_ResourceLocator_mutable_id(udpa_core_v1_ResourceLocator * msg,size_t * len)77 UPB_INLINE upb_strview* udpa_core_v1_ResourceLocator_mutable_id(udpa_core_v1_ResourceLocator *msg, size_t *len) {
78 return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(20, 40), len);
79 }
udpa_core_v1_ResourceLocator_resize_id(udpa_core_v1_ResourceLocator * msg,size_t len,upb_arena * arena)80 UPB_INLINE upb_strview* udpa_core_v1_ResourceLocator_resize_id(udpa_core_v1_ResourceLocator *msg, size_t len, upb_arena *arena) {
81 return (upb_strview*)_upb_array_resize_accessor2(msg, UPB_SIZE(20, 40), len, UPB_SIZE(3, 4), arena);
82 }
udpa_core_v1_ResourceLocator_add_id(udpa_core_v1_ResourceLocator * msg,upb_strview val,upb_arena * arena)83 UPB_INLINE bool udpa_core_v1_ResourceLocator_add_id(udpa_core_v1_ResourceLocator *msg, upb_strview val, upb_arena *arena) {
84 return _upb_array_append_accessor2(msg, UPB_SIZE(20, 40), UPB_SIZE(3, 4), &val,
85 arena);
86 }
udpa_core_v1_ResourceLocator_set_authority(udpa_core_v1_ResourceLocator * msg,upb_strview value)87 UPB_INLINE void udpa_core_v1_ResourceLocator_set_authority(udpa_core_v1_ResourceLocator *msg, upb_strview value) {
88 *UPB_PTR_AT(msg, UPB_SIZE(4, 8), upb_strview) = value;
89 }
udpa_core_v1_ResourceLocator_set_resource_type(udpa_core_v1_ResourceLocator * msg,upb_strview value)90 UPB_INLINE void udpa_core_v1_ResourceLocator_set_resource_type(udpa_core_v1_ResourceLocator *msg, upb_strview value) {
91 *UPB_PTR_AT(msg, UPB_SIZE(12, 24), upb_strview) = value;
92 }
udpa_core_v1_ResourceLocator_set_exact_context(udpa_core_v1_ResourceLocator * msg,struct udpa_core_v1_ContextParams * value)93 UPB_INLINE void udpa_core_v1_ResourceLocator_set_exact_context(udpa_core_v1_ResourceLocator *msg, struct udpa_core_v1_ContextParams* value) {
94 UPB_WRITE_ONEOF(msg, struct udpa_core_v1_ContextParams*, UPB_SIZE(28, 56), value, UPB_SIZE(32, 64), 5);
95 }
udpa_core_v1_ResourceLocator_mutable_exact_context(udpa_core_v1_ResourceLocator * msg,upb_arena * arena)96 UPB_INLINE struct udpa_core_v1_ContextParams* udpa_core_v1_ResourceLocator_mutable_exact_context(udpa_core_v1_ResourceLocator *msg, upb_arena *arena) {
97 struct udpa_core_v1_ContextParams* sub = (struct udpa_core_v1_ContextParams*)udpa_core_v1_ResourceLocator_exact_context(msg);
98 if (sub == NULL) {
99 sub = (struct udpa_core_v1_ContextParams*)_upb_msg_new(&udpa_core_v1_ContextParams_msginit, arena);
100 if (!sub) return NULL;
101 udpa_core_v1_ResourceLocator_set_exact_context(msg, sub);
102 }
103 return sub;
104 }
udpa_core_v1_ResourceLocator_mutable_directives(udpa_core_v1_ResourceLocator * msg,size_t * len)105 UPB_INLINE udpa_core_v1_ResourceLocator_Directive** udpa_core_v1_ResourceLocator_mutable_directives(udpa_core_v1_ResourceLocator *msg, size_t *len) {
106 return (udpa_core_v1_ResourceLocator_Directive**)_upb_array_mutable_accessor(msg, UPB_SIZE(24, 48), len);
107 }
udpa_core_v1_ResourceLocator_resize_directives(udpa_core_v1_ResourceLocator * msg,size_t len,upb_arena * arena)108 UPB_INLINE udpa_core_v1_ResourceLocator_Directive** udpa_core_v1_ResourceLocator_resize_directives(udpa_core_v1_ResourceLocator *msg, size_t len, upb_arena *arena) {
109 return (udpa_core_v1_ResourceLocator_Directive**)_upb_array_resize_accessor2(msg, UPB_SIZE(24, 48), len, UPB_SIZE(2, 3), arena);
110 }
udpa_core_v1_ResourceLocator_add_directives(udpa_core_v1_ResourceLocator * msg,upb_arena * arena)111 UPB_INLINE struct udpa_core_v1_ResourceLocator_Directive* udpa_core_v1_ResourceLocator_add_directives(udpa_core_v1_ResourceLocator *msg, upb_arena *arena) {
112 struct udpa_core_v1_ResourceLocator_Directive* sub = (struct udpa_core_v1_ResourceLocator_Directive*)_upb_msg_new(&udpa_core_v1_ResourceLocator_Directive_msginit, arena);
113 bool ok = _upb_array_append_accessor2(
114 msg, UPB_SIZE(24, 48), UPB_SIZE(2, 3), &sub, arena);
115 if (!ok) return NULL;
116 return sub;
117 }
118
119 /* udpa.core.v1.ResourceLocator.Directive */
120
udpa_core_v1_ResourceLocator_Directive_new(upb_arena * arena)121 UPB_INLINE udpa_core_v1_ResourceLocator_Directive *udpa_core_v1_ResourceLocator_Directive_new(upb_arena *arena) {
122 return (udpa_core_v1_ResourceLocator_Directive *)_upb_msg_new(&udpa_core_v1_ResourceLocator_Directive_msginit, arena);
123 }
udpa_core_v1_ResourceLocator_Directive_parse(const char * buf,size_t size,upb_arena * arena)124 UPB_INLINE udpa_core_v1_ResourceLocator_Directive *udpa_core_v1_ResourceLocator_Directive_parse(const char *buf, size_t size,
125 upb_arena *arena) {
126 udpa_core_v1_ResourceLocator_Directive *ret = udpa_core_v1_ResourceLocator_Directive_new(arena);
127 return (ret && upb_decode(buf, size, ret, &udpa_core_v1_ResourceLocator_Directive_msginit, arena)) ? ret : NULL;
128 }
udpa_core_v1_ResourceLocator_Directive_parse_ex(const char * buf,size_t size,upb_arena * arena,int options)129 UPB_INLINE udpa_core_v1_ResourceLocator_Directive *udpa_core_v1_ResourceLocator_Directive_parse_ex(const char *buf, size_t size,
130 upb_arena *arena, int options) {
131 udpa_core_v1_ResourceLocator_Directive *ret = udpa_core_v1_ResourceLocator_Directive_new(arena);
132 return (ret && _upb_decode(buf, size, ret, &udpa_core_v1_ResourceLocator_Directive_msginit, arena, options))
133 ? ret : NULL;
134 }
udpa_core_v1_ResourceLocator_Directive_serialize(const udpa_core_v1_ResourceLocator_Directive * msg,upb_arena * arena,size_t * len)135 UPB_INLINE char *udpa_core_v1_ResourceLocator_Directive_serialize(const udpa_core_v1_ResourceLocator_Directive *msg, upb_arena *arena, size_t *len) {
136 return upb_encode(msg, &udpa_core_v1_ResourceLocator_Directive_msginit, arena, len);
137 }
138
139 typedef enum {
140 udpa_core_v1_ResourceLocator_Directive_directive_alt = 1,
141 udpa_core_v1_ResourceLocator_Directive_directive_entry = 2,
142 udpa_core_v1_ResourceLocator_Directive_directive_NOT_SET = 0
143 } udpa_core_v1_ResourceLocator_Directive_directive_oneofcases;
udpa_core_v1_ResourceLocator_Directive_directive_case(const udpa_core_v1_ResourceLocator_Directive * msg)144 UPB_INLINE udpa_core_v1_ResourceLocator_Directive_directive_oneofcases udpa_core_v1_ResourceLocator_Directive_directive_case(const udpa_core_v1_ResourceLocator_Directive* msg) { return (udpa_core_v1_ResourceLocator_Directive_directive_oneofcases)*UPB_PTR_AT(msg, UPB_SIZE(8, 16), int32_t); }
145
udpa_core_v1_ResourceLocator_Directive_has_alt(const udpa_core_v1_ResourceLocator_Directive * msg)146 UPB_INLINE bool udpa_core_v1_ResourceLocator_Directive_has_alt(const udpa_core_v1_ResourceLocator_Directive *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 1; }
udpa_core_v1_ResourceLocator_Directive_alt(const udpa_core_v1_ResourceLocator_Directive * msg)147 UPB_INLINE const udpa_core_v1_ResourceLocator* udpa_core_v1_ResourceLocator_Directive_alt(const udpa_core_v1_ResourceLocator_Directive *msg) { return UPB_READ_ONEOF(msg, const udpa_core_v1_ResourceLocator*, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 1, NULL); }
udpa_core_v1_ResourceLocator_Directive_has_entry(const udpa_core_v1_ResourceLocator_Directive * msg)148 UPB_INLINE bool udpa_core_v1_ResourceLocator_Directive_has_entry(const udpa_core_v1_ResourceLocator_Directive *msg) { return _upb_getoneofcase(msg, UPB_SIZE(8, 16)) == 2; }
udpa_core_v1_ResourceLocator_Directive_entry(const udpa_core_v1_ResourceLocator_Directive * msg)149 UPB_INLINE upb_strview udpa_core_v1_ResourceLocator_Directive_entry(const udpa_core_v1_ResourceLocator_Directive *msg) { return UPB_READ_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), UPB_SIZE(8, 16), 2, upb_strview_make("", strlen(""))); }
150
udpa_core_v1_ResourceLocator_Directive_set_alt(udpa_core_v1_ResourceLocator_Directive * msg,udpa_core_v1_ResourceLocator * value)151 UPB_INLINE void udpa_core_v1_ResourceLocator_Directive_set_alt(udpa_core_v1_ResourceLocator_Directive *msg, udpa_core_v1_ResourceLocator* value) {
152 UPB_WRITE_ONEOF(msg, udpa_core_v1_ResourceLocator*, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 1);
153 }
udpa_core_v1_ResourceLocator_Directive_mutable_alt(udpa_core_v1_ResourceLocator_Directive * msg,upb_arena * arena)154 UPB_INLINE struct udpa_core_v1_ResourceLocator* udpa_core_v1_ResourceLocator_Directive_mutable_alt(udpa_core_v1_ResourceLocator_Directive *msg, upb_arena *arena) {
155 struct udpa_core_v1_ResourceLocator* sub = (struct udpa_core_v1_ResourceLocator*)udpa_core_v1_ResourceLocator_Directive_alt(msg);
156 if (sub == NULL) {
157 sub = (struct udpa_core_v1_ResourceLocator*)_upb_msg_new(&udpa_core_v1_ResourceLocator_msginit, arena);
158 if (!sub) return NULL;
159 udpa_core_v1_ResourceLocator_Directive_set_alt(msg, sub);
160 }
161 return sub;
162 }
udpa_core_v1_ResourceLocator_Directive_set_entry(udpa_core_v1_ResourceLocator_Directive * msg,upb_strview value)163 UPB_INLINE void udpa_core_v1_ResourceLocator_Directive_set_entry(udpa_core_v1_ResourceLocator_Directive *msg, upb_strview value) {
164 UPB_WRITE_ONEOF(msg, upb_strview, UPB_SIZE(0, 0), value, UPB_SIZE(8, 16), 2);
165 }
166
167 #ifdef __cplusplus
168 } /* extern "C" */
169 #endif
170
171 #include "upb/port_undef.inc"
172
173 #endif /* UDPA_CORE_V1_RESOURCE_LOCATOR_PROTO_UPB_H_ */
174