xref: /aosp_15_r20/external/grpc-grpc/third_party/upb/upb/mini_table/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_MINI_TABLE_COMPAT_H_
9 #define UPB_MINI_TABLE_COMPAT_H_
10 
11 #include "upb/mini_table/message.h"
12 
13 // Must be last.
14 #include "upb/port/def.inc"
15 
16 // upb does not support mixing minitables from different sources but these
17 // functions are still used by some existing users so for now we make them
18 // available here. This may or may not change in the future so do not add
19 // them to new code.
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 // Checks if memory layout of src is compatible with dst.
26 bool upb_MiniTable_Compatible(const upb_MiniTable* src,
27                               const upb_MiniTable* dst);
28 
29 typedef enum {
30   kUpb_MiniTableEquals_NotEqual,
31   kUpb_MiniTableEquals_Equal,
32   kUpb_MiniTableEquals_OutOfMemory,
33 } upb_MiniTableEquals_Status;
34 
35 // Checks equality of mini tables originating from different language runtimes.
36 upb_MiniTableEquals_Status upb_MiniTable_Equals(const upb_MiniTable* src,
37                                                 const upb_MiniTable* dst);
38 
39 #ifdef __cplusplus
40 } /* extern "C" */
41 #endif
42 
43 #include "upb/port/undef.inc"
44 
45 #endif /* UPB_MINI_TABLE_COMPAT_H_ */
46