xref: /aosp_15_r20/external/grpc-grpc/third_party/upb/upb/message/compat.h (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2023 Google LLC.  All rights reserved.
3 //
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file or at
6 // https://developers.google.com/open-source/licenses/bsd
7 
8 #ifndef UPB_MESSAGE_COMPAT_H_
9 #define UPB_MESSAGE_COMPAT_H_
10 
11 #include <stdint.h>
12 
13 #include "upb/message/message.h"
14 #include "upb/mini_table/extension.h"
15 
16 // Must be last.
17 #include "upb/port/def.inc"
18 
19 // upb does not support mixing minitables from different sources but these
20 // functions are still used by some existing users so for now we make them
21 // available here. This may or may not change in the future so do not add
22 // them to new code.
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 const upb_MiniTableExtension* upb_Message_ExtensionByIndex(
29     const upb_Message* msg, size_t index);
30 
31 // Returns the extension with the given field number, or NULL on failure.
32 const upb_Extension* upb_Message_FindExtensionByNumber(const upb_Message* msg,
33                                                        uint32_t field_number);
34 
35 #ifdef __cplusplus
36 } /* extern "C" */
37 #endif
38 
39 #include "upb/port/undef.inc"
40 
41 #endif /* UPB_MESSAGE_COMPAT_H_ */
42