Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
z
Classes
Class List
Class Hierarchy
Class Members
All
:
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
[
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Enumerations
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Properties
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Related Functions
:
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
grpc
third_party
upb
upb
msg.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009-2021, Google LLC
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are met:
7
* * Redistributions of source code must retain the above copyright
8
* notice, this list of conditions and the following disclaimer.
9
* * Redistributions in binary form must reproduce the above copyright
10
* notice, this list of conditions and the following disclaimer in the
11
* documentation and/or other materials provided with the distribution.
12
* * Neither the name of Google LLC nor the
13
* names of its contributors may be used to endorse or promote products
14
* derived from this software without specific prior written permission.
15
*
16
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
* ARE DISCLAIMED. IN NO EVENT SHALL Google LLC BE LIABLE FOR ANY DIRECT,
20
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
*/
27
28
/*
29
* Public APIs for message operations that do not require descriptors.
30
* These functions can be used even in build that does not want to depend on
31
* reflection or descriptors.
32
*
33
* Descriptor-based reflection functionality lives in reflection.h.
34
*/
35
36
#ifndef UPB_MSG_H_
37
#define UPB_MSG_H_
38
39
#include <stddef.h>
40
41
#include "
upb/upb.h
"
42
43
#ifdef __cplusplus
44
extern
"C"
{
45
#endif
46
49
typedef
void
upb_Message
;
50
51
/* For users these are opaque. They can be obtained from
52
* upb_MessageDef_MiniTable() but users cannot access any of the members. */
53
struct
upb_MiniTable
;
54
typedef
struct
upb_MiniTable
upb_MiniTable
;
55
56
/* Adds unknown data (serialized protobuf data) to the given message. The data
57
* is copied into the message instance. */
58
void
upb_Message_AddUnknown
(
upb_Message
*
msg
,
const
char
*
data
,
size_t
len
,
59
upb_Arena
*
arena
);
60
61
/* Returns a reference to the message's unknown data. */
62
const
char
*
upb_Message_GetUnknown
(
const
upb_Message
*
msg
,
size_t
*
len
);
63
64
/* Returns the number of extensions present in this message. */
65
size_t
upb_Message_ExtensionCount
(
const
upb_Message
*
msg
);
66
69
/* Extension registry: a dynamic data structure that stores a map of:
70
* (upb_MiniTable, number) -> extension info
71
*
72
* upb_decode() uses upb_ExtensionRegistry to look up extensions while parsing
73
* binary format.
74
*
75
* upb_ExtensionRegistry is part of the mini-table (msglayout) family of
76
* objects. Like all mini-table objects, it is suitable for reflection-less
77
* builds that do not want to expose names into the binary.
78
*
79
* Unlike most mini-table types, upb_ExtensionRegistry requires dynamic memory
80
* allocation and dynamic initialization:
81
* * If reflection is being used, then upb_DefPool will construct an appropriate
82
* upb_ExtensionRegistry automatically.
83
* * For a mini-table only build, the user must manually construct the
84
* upb_ExtensionRegistry and populate it with all of the extensions the user
85
* cares about.
86
* * A third alternative is to manually unpack relevant extensions after the
87
* main parse is complete, similar to how Any works. This is perhaps the
88
* nicest solution from the perspective of reducing dependencies, avoiding
89
* dynamic memory allocation, and avoiding the need to parse uninteresting
90
* extensions. The downsides are:
91
* (1) parse errors are not caught during the main parse
92
* (2) the CPU hit of parsing comes during access, which could cause an
93
* undesirable stutter in application performance.
94
*
95
* Users cannot directly get or put into this map. Users can only add the
96
* extensions from a generated module and pass the extension registry to the
97
* binary decoder.
98
*
99
* A upb_DefPool provides a upb_ExtensionRegistry, so any users who use
100
* reflection do not need to populate a upb_ExtensionRegistry directly.
101
*/
102
103
struct
upb_ExtensionRegistry
;
104
typedef
struct
upb_ExtensionRegistry
upb_ExtensionRegistry
;
105
106
/* Creates a upb_ExtensionRegistry in the given arena. The arena must outlive
107
* any use of the extreg. */
108
upb_ExtensionRegistry
*
upb_ExtensionRegistry_New
(
upb_Arena
*
arena
);
109
110
#ifdef __cplusplus
111
}
/* extern "C" */
112
#endif
113
114
#endif
/* UPB_MSG_INT_H_ */
upb_Message_GetUnknown
const char * upb_Message_GetUnknown(const upb_Message *msg, size_t *len)
Definition:
msg.c:101
upb_MiniTable
Definition:
msg_internal.h:185
upb_Message_AddUnknown
void upb_Message_AddUnknown(upb_Message *msg, const char *data, size_t len, upb_Arena *arena)
upb_Message_ExtensionCount
size_t upb_Message_ExtensionCount(const upb_Message *msg)
Definition:
msg.c:170
arena
grpc_core::ScopedArenaPtr arena
Definition:
binder_transport_test.cc:237
upb.h
data
char data[kBufferLength]
Definition:
abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1006
upb_Message
void upb_Message
Definition:
msg.h:49
msg
std::string msg
Definition:
client_interceptors_end2end_test.cc:372
upb_ExtensionRegistry_New
upb_ExtensionRegistry * upb_ExtensionRegistry_New(upb_Arena *arena)
Definition:
msg.c:384
len
int len
Definition:
abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
upb_Arena
Definition:
upb_internal.h:36
upb_ExtensionRegistry
Definition:
msg.c:372
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:41