grpc 1.23.0 → 1.24.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grpc might be problematic. Click here for more details.

Files changed (245) hide show
  1. checksums.yaml +4 -4
  2. data/Makefile +765 -485
  3. data/include/grpc/grpc.h +3 -1
  4. data/include/grpc/grpc_security.h +20 -4
  5. data/include/grpc/impl/codegen/grpc_types.h +6 -5
  6. data/include/grpc/impl/codegen/port_platform.h +25 -0
  7. data/src/core/ext/filters/client_channel/backend_metric.cc +78 -0
  8. data/src/core/ext/filters/client_channel/backend_metric.h +36 -0
  9. data/src/core/ext/filters/client_channel/channel_connectivity.cc +16 -2
  10. data/src/core/ext/filters/client_channel/client_channel.cc +325 -267
  11. data/src/core/ext/filters/client_channel/client_channel_factory.h +0 -4
  12. data/src/core/ext/filters/client_channel/health/health_check_client.cc +23 -32
  13. data/src/core/ext/filters/client_channel/http_proxy.cc +7 -3
  14. data/src/core/ext/filters/client_channel/lb_policy.cc +1 -1
  15. data/src/core/ext/filters/client_channel/lb_policy.h +58 -34
  16. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +46 -50
  17. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +9 -2
  18. data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +35 -17
  19. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc +130 -215
  20. data/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h +34 -21
  21. data/src/core/ext/filters/client_channel/lb_policy/xds/xds.cc +1120 -802
  22. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h +8 -2
  23. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc +33 -12
  24. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc +151 -40
  25. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h +184 -26
  26. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc +389 -245
  27. data/src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h +98 -60
  28. data/src/core/ext/filters/client_channel/lb_policy_registry.cc +6 -1
  29. data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +89 -0
  30. data/src/core/ext/filters/client_channel/resolving_lb_policy.cc +3 -8
  31. data/src/core/ext/filters/client_channel/server_address.cc +1 -3
  32. data/src/core/ext/filters/client_channel/server_address.h +1 -1
  33. data/src/core/ext/filters/client_channel/subchannel.h +2 -1
  34. data/src/core/ext/filters/client_idle/client_idle_filter.cc +207 -29
  35. data/src/core/ext/filters/http/client/http_client_filter.cc +10 -8
  36. data/src/core/ext/filters/http/client_authority_filter.cc +1 -1
  37. data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +10 -7
  38. data/src/core/ext/filters/http/server/http_server_filter.cc +52 -26
  39. data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +23 -20
  40. data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +24 -21
  41. data/src/core/ext/transport/chttp2/server/chttp2_server.cc +1 -1
  42. data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +37 -24
  43. data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +1 -0
  44. data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +237 -191
  45. data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +29 -27
  46. data/src/core/ext/transport/chttp2/transport/hpack_parser.h +1 -1
  47. data/src/core/ext/transport/chttp2/transport/hpack_table.cc +19 -4
  48. data/src/core/ext/transport/chttp2/transport/hpack_table.h +13 -4
  49. data/src/core/ext/transport/chttp2/transport/incoming_metadata.cc +2 -1
  50. data/src/core/ext/transport/chttp2/transport/internal.h +0 -2
  51. data/src/core/ext/transport/chttp2/transport/parsing.cc +99 -71
  52. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.c +222 -0
  53. data/src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h +818 -0
  54. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.c +314 -0
  55. data/src/core/ext/upb-generated/envoy/api/v2/cds.upb.h +1142 -0
  56. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.c +53 -0
  57. data/src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h +158 -0
  58. data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.c +34 -0
  59. data/src/core/ext/upb-generated/envoy/api/v2/cluster/filter.upb.h +69 -0
  60. data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.c +49 -0
  61. data/src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h +240 -0
  62. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.c +110 -0
  63. data/src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h +324 -0
  64. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.c +235 -0
  65. data/src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h +661 -0
  66. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.c +84 -0
  67. data/src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h +274 -0
  68. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.c +175 -0
  69. data/src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h +572 -0
  70. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.c +150 -0
  71. data/src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h +596 -0
  72. data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.c +35 -0
  73. data/src/core/ext/upb-generated/envoy/api/v2/core/http_uri.upb.h +80 -0
  74. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.c +95 -0
  75. data/src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h +308 -0
  76. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.c +128 -0
  77. data/src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h +392 -0
  78. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.c +91 -0
  79. data/src/core/ext/upb-generated/envoy/api/v2/eds.upb.h +236 -0
  80. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.c +88 -0
  81. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h +258 -0
  82. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.c +111 -0
  83. data/src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h +324 -0
  84. data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.c +23 -0
  85. data/src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h +50 -0
  86. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.c +52 -0
  87. data/src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h +130 -0
  88. data/src/core/ext/upb-generated/envoy/type/percent.upb.c +39 -0
  89. data/src/core/ext/upb-generated/envoy/type/percent.upb.h +87 -0
  90. data/src/core/ext/upb-generated/envoy/type/range.upb.c +39 -0
  91. data/src/core/ext/upb-generated/envoy/type/range.upb.h +85 -0
  92. data/src/core/ext/upb-generated/gogoproto/gogo.upb.c +17 -0
  93. data/src/core/ext/upb-generated/gogoproto/gogo.upb.h +30 -0
  94. data/src/core/ext/upb-generated/google/api/annotations.upb.c +18 -0
  95. data/src/core/ext/upb-generated/google/api/annotations.upb.h +30 -0
  96. data/src/core/ext/upb-generated/google/api/http.upb.c +66 -0
  97. data/src/core/ext/upb-generated/google/api/http.upb.h +190 -0
  98. data/src/core/ext/upb-generated/google/protobuf/any.upb.c +27 -0
  99. data/src/core/ext/upb-generated/google/protobuf/any.upb.h +58 -0
  100. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.c +485 -0
  101. data/src/core/ext/upb-generated/google/protobuf/descriptor.upb.h +1690 -0
  102. data/src/core/ext/upb-generated/google/protobuf/duration.upb.c +27 -0
  103. data/src/core/ext/upb-generated/google/protobuf/duration.upb.h +58 -0
  104. data/src/core/ext/upb-generated/google/protobuf/empty.upb.c +22 -0
  105. data/src/core/ext/upb-generated/google/protobuf/empty.upb.h +50 -0
  106. data/src/core/ext/upb-generated/google/protobuf/struct.upb.c +79 -0
  107. data/src/core/ext/upb-generated/google/protobuf/struct.upb.h +215 -0
  108. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.c +27 -0
  109. data/src/core/ext/upb-generated/google/protobuf/timestamp.upb.h +58 -0
  110. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.c +106 -0
  111. data/src/core/ext/upb-generated/google/protobuf/wrappers.upb.h +238 -0
  112. data/src/core/ext/upb-generated/google/rpc/status.upb.c +33 -0
  113. data/src/core/ext/upb-generated/google/rpc/status.upb.h +74 -0
  114. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.c +49 -0
  115. data/src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h +126 -0
  116. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.c +209 -0
  117. data/src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h +681 -0
  118. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.c +42 -0
  119. data/src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h +109 -0
  120. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.c +36 -0
  121. data/src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h +84 -0
  122. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.c +133 -0
  123. data/src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h +359 -0
  124. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.c +58 -0
  125. data/src/core/ext/upb-generated/udpa/data/orca/v1/orca_load_report.upb.h +144 -0
  126. data/src/core/ext/upb-generated/validate/validate.upb.c +443 -0
  127. data/src/core/ext/upb-generated/validate/validate.upb.h +2037 -0
  128. data/src/core/lib/channel/channel_args.cc +21 -0
  129. data/src/core/lib/channel/channel_args.h +16 -2
  130. data/src/core/lib/channel/channel_stack.h +2 -1
  131. data/src/core/lib/channel/channelz.cc +54 -56
  132. data/src/core/lib/channel/channelz.h +29 -12
  133. data/src/core/lib/compression/compression.cc +2 -1
  134. data/src/core/lib/compression/compression_internal.h +8 -0
  135. data/src/core/lib/gpr/log_linux.cc +2 -2
  136. data/src/core/lib/gpr/log_posix.cc +2 -2
  137. data/src/core/lib/gpr/time_precise.cc +123 -36
  138. data/src/core/lib/gpr/time_precise.h +37 -0
  139. data/src/core/lib/gprpp/abstract.h +10 -0
  140. data/src/core/lib/gprpp/atomic.h +4 -0
  141. data/src/core/lib/gprpp/inlined_vector.h +20 -4
  142. data/src/core/lib/gprpp/map.h +109 -6
  143. data/src/core/lib/gprpp/memory.h +6 -0
  144. data/src/core/lib/gprpp/ref_counted_ptr.h +2 -0
  145. data/src/core/lib/iomgr/ev_epollex_linux.cc +29 -54
  146. data/src/core/lib/iomgr/exec_ctx.cc +27 -17
  147. data/src/core/lib/iomgr/exec_ctx.h +3 -0
  148. data/src/core/lib/iomgr/sockaddr_utils.cc +1 -3
  149. data/src/core/lib/iomgr/tcp_posix.cc +16 -25
  150. data/src/core/lib/iomgr/tcp_server_custom.cc +1 -1
  151. data/src/core/lib/iomgr/timer_manager.cc +8 -1
  152. data/src/core/lib/iomgr/timer_manager.h +2 -0
  153. data/src/core/lib/security/credentials/credentials.h +8 -2
  154. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.cc +23 -0
  155. data/src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h +3 -0
  156. data/src/core/lib/security/credentials/tls/spiffe_credentials.cc +3 -3
  157. data/src/core/lib/security/security_connector/ssl_utils.cc +1 -12
  158. data/src/core/lib/security/security_connector/ssl_utils.h +10 -6
  159. data/src/core/lib/security/security_connector/ssl_utils_config.cc +32 -0
  160. data/src/core/lib/security/security_connector/ssl_utils_config.h +30 -0
  161. data/src/core/lib/security/security_connector/tls/spiffe_security_connector.cc +161 -49
  162. data/src/core/lib/security/security_connector/tls/spiffe_security_connector.h +34 -1
  163. data/src/core/lib/slice/slice_intern.cc +17 -9
  164. data/src/core/lib/slice/slice_internal.h +34 -7
  165. data/src/core/lib/slice/slice_utils.h +7 -3
  166. data/src/core/lib/surface/call.cc +97 -57
  167. data/src/core/lib/surface/channel.cc +2 -2
  168. data/src/core/lib/surface/completion_queue.cc +10 -16
  169. data/src/core/lib/surface/init.cc +3 -0
  170. data/src/core/lib/surface/server.cc +11 -14
  171. data/src/core/lib/surface/validate_metadata.cc +4 -0
  172. data/src/core/lib/surface/version.cc +2 -2
  173. data/src/core/lib/transport/metadata.cc +4 -4
  174. data/src/core/lib/transport/metadata_batch.cc +72 -16
  175. data/src/core/lib/transport/metadata_batch.h +38 -0
  176. data/src/core/lib/transport/static_metadata.cc +814 -1023
  177. data/src/core/lib/transport/static_metadata.h +271 -213
  178. data/src/core/lib/transport/transport.h +12 -0
  179. data/src/core/plugin_registry/grpc_plugin_registry.cc +4 -0
  180. data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +104 -76
  181. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +34 -16
  182. data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +2 -2
  183. data/src/core/tsi/alts/handshaker/alts_tsi_utils.cc +10 -6
  184. data/src/core/tsi/alts/handshaker/alts_tsi_utils.h +4 -3
  185. data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +74 -48
  186. data/src/core/tsi/alts/handshaker/transport_security_common_api.h +34 -26
  187. data/src/core/tsi/ssl_transport_security.cc +14 -6
  188. data/src/core/tsi/ssl_transport_security.h +4 -0
  189. data/src/ruby/ext/grpc/ext-export.clang +1 -0
  190. data/src/ruby/ext/grpc/ext-export.gcc +6 -0
  191. data/src/ruby/ext/grpc/extconf.rb +5 -0
  192. data/src/ruby/ext/grpc/rb_enable_cpp.cc +22 -0
  193. data/src/ruby/ext/grpc/rb_grpc.c +1 -42
  194. data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +4 -0
  195. data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +6 -0
  196. data/src/ruby/lib/grpc.rb +2 -0
  197. data/src/ruby/lib/grpc/core/status_codes.rb +135 -0
  198. data/src/ruby/lib/grpc/errors.rb +4 -7
  199. data/src/ruby/lib/grpc/google_rpc_status_utils.rb +9 -4
  200. data/src/ruby/lib/grpc/structs.rb +15 -0
  201. data/src/ruby/lib/grpc/version.rb +1 -1
  202. data/src/ruby/spec/errors_spec.rb +1 -0
  203. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_import.proto +22 -0
  204. data/src/ruby/spec/pb/codegen/grpc/testing/package_options_ruby_style.proto +34 -0
  205. data/src/ruby/spec/pb/codegen/package_option_spec.rb +53 -29
  206. data/third_party/upb/upb/decode.c +604 -0
  207. data/third_party/upb/upb/decode.h +21 -0
  208. data/third_party/upb/upb/encode.c +378 -0
  209. data/third_party/upb/upb/encode.h +21 -0
  210. data/third_party/upb/upb/generated_util.h +105 -0
  211. data/third_party/upb/upb/msg.c +111 -0
  212. data/third_party/upb/upb/msg.h +69 -0
  213. data/third_party/upb/upb/port.c +27 -0
  214. data/third_party/upb/upb/port_def.inc +152 -0
  215. data/third_party/upb/upb/port_undef.inc +21 -0
  216. data/third_party/upb/upb/table.c +911 -0
  217. data/third_party/upb/upb/table.int.h +507 -0
  218. data/third_party/upb/upb/upb.c +261 -0
  219. data/third_party/upb/upb/upb.h +364 -0
  220. metadata +129 -50
  221. data/src/core/ext/filters/client_channel/health/health.pb.c +0 -23
  222. data/src/core/ext/filters/client_channel/health/health.pb.h +0 -73
  223. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.c +0 -19
  224. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/duration.pb.h +0 -54
  225. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.c +0 -19
  226. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/google/protobuf/timestamp.pb.h +0 -54
  227. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.c +0 -89
  228. data/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h +0 -164
  229. data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.cc +0 -520
  230. data/src/core/tsi/alts/handshaker/alts_handshaker_service_api.h +0 -323
  231. data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.cc +0 -145
  232. data/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h +0 -149
  233. data/src/core/tsi/alts/handshaker/altscontext.pb.c +0 -47
  234. data/src/core/tsi/alts/handshaker/altscontext.pb.h +0 -63
  235. data/src/core/tsi/alts/handshaker/handshaker.pb.c +0 -122
  236. data/src/core/tsi/alts/handshaker/handshaker.pb.h +0 -254
  237. data/src/core/tsi/alts/handshaker/transport_security_common.pb.c +0 -49
  238. data/src/core/tsi/alts/handshaker/transport_security_common.pb.h +0 -78
  239. data/third_party/nanopb/pb.h +0 -579
  240. data/third_party/nanopb/pb_common.c +0 -97
  241. data/third_party/nanopb/pb_common.h +0 -42
  242. data/third_party/nanopb/pb_decode.c +0 -1347
  243. data/third_party/nanopb/pb_decode.h +0 -149
  244. data/third_party/nanopb/pb_encode.c +0 -696
  245. data/third_party/nanopb/pb_encode.h +0 -154
@@ -1,49 +0,0 @@
1
- /* Automatically generated nanopb constant definitions */
2
- /* Generated by nanopb-0.3.7-dev */
3
-
4
- #include "src/core/tsi/alts/handshaker/transport_security_common.pb.h"
5
- /* @@protoc_insertion_point(includes) */
6
- #if PB_PROTO_HEADER_VERSION != 30
7
- #error Regenerate this file with the current version of nanopb generator.
8
- #endif
9
-
10
-
11
-
12
- const pb_field_t grpc_gcp_RpcProtocolVersions_fields[3] = {
13
- PB_FIELD( 1, MESSAGE , OPTIONAL, STATIC , FIRST, grpc_gcp_RpcProtocolVersions, max_rpc_version, max_rpc_version, &grpc_gcp_RpcProtocolVersions_Version_fields),
14
- PB_FIELD( 2, MESSAGE , OPTIONAL, STATIC , OTHER, grpc_gcp_RpcProtocolVersions, min_rpc_version, max_rpc_version, &grpc_gcp_RpcProtocolVersions_Version_fields),
15
- PB_LAST_FIELD
16
- };
17
-
18
- const pb_field_t grpc_gcp_RpcProtocolVersions_Version_fields[3] = {
19
- PB_FIELD( 1, UINT32 , OPTIONAL, STATIC , FIRST, grpc_gcp_RpcProtocolVersions_Version, major, major, 0),
20
- PB_FIELD( 2, UINT32 , OPTIONAL, STATIC , OTHER, grpc_gcp_RpcProtocolVersions_Version, minor, major, 0),
21
- PB_LAST_FIELD
22
- };
23
-
24
-
25
- /* Check that field information fits in pb_field_t */
26
- #if !defined(PB_FIELD_32BIT)
27
- /* If you get an error here, it means that you need to define PB_FIELD_32BIT
28
- * compile-time option. You can do that in pb.h or on compiler command line.
29
- *
30
- * The reason you need to do this is that some of your messages contain tag
31
- * numbers or field sizes that are larger than what can fit in 8 or 16 bit
32
- * field descriptors.
33
- */
34
- PB_STATIC_ASSERT((pb_membersize(grpc_gcp_RpcProtocolVersions, max_rpc_version) < 65536 && pb_membersize(grpc_gcp_RpcProtocolVersions, min_rpc_version) < 65536), YOU_MUST_DEFINE_PB_FIELD_32BIT_FOR_MESSAGES_grpc_gcp_RpcProtocolVersions_grpc_gcp_RpcProtocolVersions_Version)
35
- #endif
36
-
37
- #if !defined(PB_FIELD_16BIT) && !defined(PB_FIELD_32BIT)
38
- /* If you get an error here, it means that you need to define PB_FIELD_16BIT
39
- * compile-time option. You can do that in pb.h or on compiler command line.
40
- *
41
- * The reason you need to do this is that some of your messages contain tag
42
- * numbers or field sizes that are larger than what can fit in the default
43
- * 8 bit descriptors.
44
- */
45
- PB_STATIC_ASSERT((pb_membersize(grpc_gcp_RpcProtocolVersions, max_rpc_version) < 256 && pb_membersize(grpc_gcp_RpcProtocolVersions, min_rpc_version) < 256), YOU_MUST_DEFINE_PB_FIELD_16BIT_FOR_MESSAGES_grpc_gcp_RpcProtocolVersions_grpc_gcp_RpcProtocolVersions_Version)
46
- #endif
47
-
48
-
49
- /* @@protoc_insertion_point(eof) */
@@ -1,78 +0,0 @@
1
- /* Automatically generated nanopb header */
2
- /* Generated by nanopb-0.3.7-dev */
3
-
4
- #ifndef PB_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PB_H_INCLUDED
5
- #define PB_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PB_H_INCLUDED
6
- #include "pb.h"
7
- /* @@protoc_insertion_point(includes) */
8
- #if PB_PROTO_HEADER_VERSION != 30
9
- #error Regenerate this file with the current version of nanopb generator.
10
- #endif
11
-
12
- #ifdef __cplusplus
13
- extern "C" {
14
- #endif
15
-
16
- /* Enum definitions */
17
- typedef enum _grpc_gcp_SecurityLevel {
18
- grpc_gcp_SecurityLevel_SECURITY_NONE = 0,
19
- grpc_gcp_SecurityLevel_INTEGRITY_ONLY = 1,
20
- grpc_gcp_SecurityLevel_INTEGRITY_AND_PRIVACY = 2
21
- } grpc_gcp_SecurityLevel;
22
- #define _grpc_gcp_SecurityLevel_MIN grpc_gcp_SecurityLevel_SECURITY_NONE
23
- #define _grpc_gcp_SecurityLevel_MAX grpc_gcp_SecurityLevel_INTEGRITY_AND_PRIVACY
24
- #define _grpc_gcp_SecurityLevel_ARRAYSIZE ((grpc_gcp_SecurityLevel)(grpc_gcp_SecurityLevel_INTEGRITY_AND_PRIVACY+1))
25
-
26
- /* Struct definitions */
27
- typedef struct _grpc_gcp_RpcProtocolVersions_Version {
28
- bool has_major;
29
- uint32_t major;
30
- bool has_minor;
31
- uint32_t minor;
32
- /* @@protoc_insertion_point(struct:grpc_gcp_RpcProtocolVersions_Version) */
33
- } grpc_gcp_RpcProtocolVersions_Version;
34
-
35
- typedef struct _grpc_gcp_RpcProtocolVersions {
36
- bool has_max_rpc_version;
37
- grpc_gcp_RpcProtocolVersions_Version max_rpc_version;
38
- bool has_min_rpc_version;
39
- grpc_gcp_RpcProtocolVersions_Version min_rpc_version;
40
- /* @@protoc_insertion_point(struct:grpc_gcp_RpcProtocolVersions) */
41
- } grpc_gcp_RpcProtocolVersions;
42
-
43
- /* Default values for struct fields */
44
-
45
- /* Initializer values for message structs */
46
- #define grpc_gcp_RpcProtocolVersions_init_default {false, grpc_gcp_RpcProtocolVersions_Version_init_default, false, grpc_gcp_RpcProtocolVersions_Version_init_default}
47
- #define grpc_gcp_RpcProtocolVersions_Version_init_default {false, 0, false, 0}
48
- #define grpc_gcp_RpcProtocolVersions_init_zero {false, grpc_gcp_RpcProtocolVersions_Version_init_zero, false, grpc_gcp_RpcProtocolVersions_Version_init_zero}
49
- #define grpc_gcp_RpcProtocolVersions_Version_init_zero {false, 0, false, 0}
50
-
51
- /* Field tags (for use in manual encoding/decoding) */
52
- #define grpc_gcp_RpcProtocolVersions_Version_major_tag 1
53
- #define grpc_gcp_RpcProtocolVersions_Version_minor_tag 2
54
- #define grpc_gcp_RpcProtocolVersions_max_rpc_version_tag 1
55
- #define grpc_gcp_RpcProtocolVersions_min_rpc_version_tag 2
56
-
57
- /* Struct field encoding specification for nanopb */
58
- extern const pb_field_t grpc_gcp_RpcProtocolVersions_fields[3];
59
- extern const pb_field_t grpc_gcp_RpcProtocolVersions_Version_fields[3];
60
-
61
- /* Maximum encoded size of messages (where known) */
62
- #define grpc_gcp_RpcProtocolVersions_size 28
63
- #define grpc_gcp_RpcProtocolVersions_Version_size 12
64
-
65
- /* Message IDs (where set with "msgid" option) */
66
- #ifdef PB_MSGID
67
-
68
- #define TRANSPORT_SECURITY_COMMON_MESSAGES \
69
-
70
-
71
- #endif
72
-
73
- #ifdef __cplusplus
74
- } /* extern "C" */
75
- #endif
76
- /* @@protoc_insertion_point(eof) */
77
-
78
- #endif
@@ -1,579 +0,0 @@
1
- /* Common parts of the nanopb library. Most of these are quite low-level
2
- * stuff. For the high-level interface, see pb_encode.h and pb_decode.h.
3
- */
4
-
5
- #ifndef PB_H_INCLUDED
6
- #define PB_H_INCLUDED
7
-
8
- /*****************************************************************
9
- * Nanopb compilation time options. You can change these here by *
10
- * uncommenting the lines, or on the compiler command line. *
11
- *****************************************************************/
12
-
13
- /* Enable support for dynamically allocated fields */
14
- /* #define PB_ENABLE_MALLOC 1 */
15
-
16
- /* Define this if your CPU / compiler combination does not support
17
- * unaligned memory access to packed structures. */
18
- /* #define PB_NO_PACKED_STRUCTS 1 */
19
-
20
- /* Increase the number of required fields that are tracked.
21
- * A compiler warning will tell if you need this. */
22
- /* #define PB_MAX_REQUIRED_FIELDS 256 */
23
-
24
- /* Add support for tag numbers > 255 and fields larger than 255 bytes. */
25
- /* #define PB_FIELD_16BIT 1 */
26
-
27
- /* Add support for tag numbers > 65536 and fields larger than 65536 bytes. */
28
- /* #define PB_FIELD_32BIT 1 */
29
-
30
- /* Disable support for error messages in order to save some code space. */
31
- /* #define PB_NO_ERRMSG 1 */
32
-
33
- /* Disable support for custom streams (support only memory buffers). */
34
- /* #define PB_BUFFER_ONLY 1 */
35
-
36
- /* Switch back to the old-style callback function signature.
37
- * This was the default until nanopb-0.2.1. */
38
- /* #define PB_OLD_CALLBACK_STYLE */
39
-
40
-
41
- /******************************************************************
42
- * You usually don't need to change anything below this line. *
43
- * Feel free to look around and use the defined macros, though. *
44
- ******************************************************************/
45
-
46
-
47
- /* Version of the nanopb library. Just in case you want to check it in
48
- * your own program. */
49
- #define NANOPB_VERSION nanopb-0.3.7-dev
50
-
51
- /* Include all the system headers needed by nanopb. You will need the
52
- * definitions of the following:
53
- * - strlen, memcpy, memset functions
54
- * - [u]int_least8_t, uint_fast8_t, [u]int_least16_t, [u]int32_t, [u]int64_t
55
- * - size_t
56
- * - bool
57
- *
58
- * If you don't have the standard header files, you can instead provide
59
- * a custom header that defines or includes all this. In that case,
60
- * define PB_SYSTEM_HEADER to the path of this file.
61
- */
62
- #ifdef PB_SYSTEM_HEADER
63
- #include PB_SYSTEM_HEADER
64
- #else
65
- #include <stdint.h>
66
- #include <stddef.h>
67
- #include <stdbool.h>
68
- #include <string.h>
69
-
70
- #ifdef PB_ENABLE_MALLOC
71
- #include <stdlib.h>
72
- #endif
73
- #endif
74
-
75
- /* Macro for defining packed structures (compiler dependent).
76
- * This just reduces memory requirements, but is not required.
77
- */
78
- #if defined(PB_NO_PACKED_STRUCTS)
79
- /* Disable struct packing */
80
- # define PB_PACKED_STRUCT_START
81
- # define PB_PACKED_STRUCT_END
82
- # define pb_packed
83
- #elif defined(__GNUC__) || defined(__clang__)
84
- /* For GCC and clang */
85
- # define PB_PACKED_STRUCT_START
86
- # define PB_PACKED_STRUCT_END
87
- # define pb_packed __attribute__((packed))
88
- #elif defined(__ICCARM__) || defined(__CC_ARM)
89
- /* For IAR ARM and Keil MDK-ARM compilers */
90
- # define PB_PACKED_STRUCT_START _Pragma("pack(push, 1)")
91
- # define PB_PACKED_STRUCT_END _Pragma("pack(pop)")
92
- # define pb_packed
93
- #elif defined(_MSC_VER) && (_MSC_VER >= 1500)
94
- /* For Microsoft Visual C++ */
95
- # define PB_PACKED_STRUCT_START __pragma(pack(push, 1))
96
- # define PB_PACKED_STRUCT_END __pragma(pack(pop))
97
- # define pb_packed
98
- #else
99
- /* Unknown compiler */
100
- # define PB_PACKED_STRUCT_START
101
- # define PB_PACKED_STRUCT_END
102
- # define pb_packed
103
- #endif
104
-
105
- /* Handly macro for suppressing unreferenced-parameter compiler warnings. */
106
- #ifndef PB_UNUSED
107
- #define PB_UNUSED(x) (void)(x)
108
- #endif
109
-
110
- /* Compile-time assertion, used for checking compatible compilation options.
111
- * If this does not work properly on your compiler, use
112
- * #define PB_NO_STATIC_ASSERT to disable it.
113
- *
114
- * But before doing that, check carefully the error message / place where it
115
- * comes from to see if the error has a real cause. Unfortunately the error
116
- * message is not always very clear to read, but you can see the reason better
117
- * in the place where the PB_STATIC_ASSERT macro was called.
118
- */
119
- #ifndef PB_NO_STATIC_ASSERT
120
- #ifndef PB_STATIC_ASSERT
121
- #define PB_STATIC_ASSERT(COND,MSG) typedef char PB_STATIC_ASSERT_MSG(MSG, __LINE__, __COUNTER__)[(COND)?1:-1];
122
- #define PB_STATIC_ASSERT_MSG(MSG, LINE, COUNTER) PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER)
123
- #define PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) pb_static_assertion_##MSG##LINE##COUNTER
124
- #endif
125
- #else
126
- #define PB_STATIC_ASSERT(COND,MSG)
127
- #endif
128
-
129
- /* Number of required fields to keep track of. */
130
- #ifndef PB_MAX_REQUIRED_FIELDS
131
- #define PB_MAX_REQUIRED_FIELDS 64
132
- #endif
133
-
134
- #if PB_MAX_REQUIRED_FIELDS < 64
135
- #error You should not lower PB_MAX_REQUIRED_FIELDS from the default value (64).
136
- #endif
137
-
138
- /* List of possible field types. These are used in the autogenerated code.
139
- * Least-significant 4 bits tell the scalar type
140
- * Most-significant 4 bits specify repeated/required/packed etc.
141
- */
142
-
143
- typedef uint_least8_t pb_type_t;
144
-
145
- /**** Field data types ****/
146
-
147
- /* Numeric types */
148
- #define PB_LTYPE_VARINT 0x00 /* int32, int64, enum, bool */
149
- #define PB_LTYPE_UVARINT 0x01 /* uint32, uint64 */
150
- #define PB_LTYPE_SVARINT 0x02 /* sint32, sint64 */
151
- #define PB_LTYPE_FIXED32 0x03 /* fixed32, sfixed32, float */
152
- #define PB_LTYPE_FIXED64 0x04 /* fixed64, sfixed64, double */
153
-
154
- /* Marker for last packable field type. */
155
- #define PB_LTYPE_LAST_PACKABLE 0x04
156
-
157
- /* Byte array with pre-allocated buffer.
158
- * data_size is the length of the allocated PB_BYTES_ARRAY structure. */
159
- #define PB_LTYPE_BYTES 0x05
160
-
161
- /* String with pre-allocated buffer.
162
- * data_size is the maximum length. */
163
- #define PB_LTYPE_STRING 0x06
164
-
165
- /* Submessage
166
- * submsg_fields is pointer to field descriptions */
167
- #define PB_LTYPE_SUBMESSAGE 0x07
168
-
169
- /* Extension pseudo-field
170
- * The field contains a pointer to pb_extension_t */
171
- #define PB_LTYPE_EXTENSION 0x08
172
-
173
- /* Byte array with inline, pre-allocated byffer.
174
- * data_size is the length of the inline, allocated buffer.
175
- * This differs from PB_LTYPE_BYTES by defining the element as
176
- * pb_byte_t[data_size] rather than pb_bytes_array_t. */
177
- #define PB_LTYPE_FIXED_LENGTH_BYTES 0x09
178
-
179
- /* Number of declared LTYPES */
180
- #define PB_LTYPES_COUNT 0x0A
181
- #define PB_LTYPE_MASK 0x0F
182
-
183
- /**** Field repetition rules ****/
184
-
185
- #define PB_HTYPE_REQUIRED 0x00
186
- #define PB_HTYPE_OPTIONAL 0x10
187
- #define PB_HTYPE_REPEATED 0x20
188
- #define PB_HTYPE_ONEOF 0x30
189
- #define PB_HTYPE_MASK 0x30
190
-
191
- /**** Field allocation types ****/
192
-
193
- #define PB_ATYPE_STATIC 0x00
194
- #define PB_ATYPE_POINTER 0x80
195
- #define PB_ATYPE_CALLBACK 0x40
196
- #define PB_ATYPE_MASK 0xC0
197
-
198
- #define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
199
- #define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
200
- #define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
201
-
202
- /* Data type used for storing sizes of struct fields
203
- * and array counts.
204
- */
205
- #if defined(PB_FIELD_32BIT)
206
- typedef uint32_t pb_size_t;
207
- typedef int32_t pb_ssize_t;
208
- #elif defined(PB_FIELD_16BIT)
209
- typedef uint_least16_t pb_size_t;
210
- typedef int_least16_t pb_ssize_t;
211
- #else
212
- typedef uint_least8_t pb_size_t;
213
- typedef int_least8_t pb_ssize_t;
214
- #endif
215
- #define PB_SIZE_MAX ((pb_size_t)-1)
216
-
217
- /* Data type for storing encoded data and other byte streams.
218
- * This typedef exists to support platforms where uint8_t does not exist.
219
- * You can regard it as equivalent on uint8_t on other platforms.
220
- */
221
- typedef uint_least8_t pb_byte_t;
222
-
223
- /* This structure is used in auto-generated constants
224
- * to specify struct fields.
225
- * You can change field sizes if you need structures
226
- * larger than 256 bytes or field tags larger than 256.
227
- * The compiler should complain if your .proto has such
228
- * structures. Fix that by defining PB_FIELD_16BIT or
229
- * PB_FIELD_32BIT.
230
- */
231
- PB_PACKED_STRUCT_START
232
- typedef struct pb_field_s pb_field_t;
233
- struct pb_field_s {
234
- pb_size_t tag;
235
- pb_type_t type;
236
- pb_size_t data_offset; /* Offset of field data, relative to previous field. */
237
- pb_ssize_t size_offset; /* Offset of array size or has-boolean, relative to data */
238
- pb_size_t data_size; /* Data size in bytes for a single item */
239
- pb_size_t array_size; /* Maximum number of entries in array */
240
-
241
- /* Field definitions for submessage
242
- * OR default value for all other non-array, non-callback types
243
- * If null, then field will zeroed. */
244
- const void *ptr;
245
- } pb_packed;
246
- PB_PACKED_STRUCT_END
247
-
248
- /* Make sure that the standard integer types are of the expected sizes.
249
- * Otherwise fixed32/fixed64 fields can break.
250
- *
251
- * If you get errors here, it probably means that your stdint.h is not
252
- * correct for your platform.
253
- */
254
- PB_STATIC_ASSERT(sizeof(int64_t) == 2 * sizeof(int32_t), INT64_T_WRONG_SIZE)
255
- PB_STATIC_ASSERT(sizeof(uint64_t) == 2 * sizeof(uint32_t), UINT64_T_WRONG_SIZE)
256
-
257
- /* This structure is used for 'bytes' arrays.
258
- * It has the number of bytes in the beginning, and after that an array.
259
- * Note that actual structs used will have a different length of bytes array.
260
- */
261
- #define PB_BYTES_ARRAY_T(n) struct { pb_size_t size; pb_byte_t bytes[n]; }
262
- #define PB_BYTES_ARRAY_T_ALLOCSIZE(n) ((size_t)n + offsetof(pb_bytes_array_t, bytes))
263
-
264
- struct pb_bytes_array_s {
265
- pb_size_t size;
266
- pb_byte_t bytes[1];
267
- };
268
- typedef struct pb_bytes_array_s pb_bytes_array_t;
269
-
270
- /* This structure is used for giving the callback function.
271
- * It is stored in the message structure and filled in by the method that
272
- * calls pb_decode.
273
- *
274
- * The decoding callback will be given a limited-length stream
275
- * If the wire type was string, the length is the length of the string.
276
- * If the wire type was a varint/fixed32/fixed64, the length is the length
277
- * of the actual value.
278
- * The function may be called multiple times (especially for repeated types,
279
- * but also otherwise if the message happens to contain the field multiple
280
- * times.)
281
- *
282
- * The encoding callback will receive the actual output stream.
283
- * It should write all the data in one call, including the field tag and
284
- * wire type. It can write multiple fields.
285
- *
286
- * The callback can be null if you want to skip a field.
287
- */
288
- typedef struct pb_istream_s pb_istream_t;
289
- typedef struct pb_ostream_s pb_ostream_t;
290
- typedef struct pb_callback_s pb_callback_t;
291
- struct pb_callback_s {
292
- #ifdef PB_OLD_CALLBACK_STYLE
293
- /* Deprecated since nanopb-0.2.1 */
294
- union {
295
- bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void *arg);
296
- bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, const void *arg);
297
- } funcs;
298
- #else
299
- /* New function signature, which allows modifying arg contents in callback. */
300
- union {
301
- bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void **arg);
302
- bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, void * const *arg);
303
- } funcs;
304
- #endif
305
-
306
- /* Free arg for use by callback */
307
- void *arg;
308
- };
309
-
310
- /* Wire types. Library user needs these only in encoder callbacks. */
311
- typedef enum {
312
- PB_WT_VARINT = 0,
313
- PB_WT_64BIT = 1,
314
- PB_WT_STRING = 2,
315
- PB_WT_32BIT = 5
316
- } pb_wire_type_t;
317
-
318
- /* Structure for defining the handling of unknown/extension fields.
319
- * Usually the pb_extension_type_t structure is automatically generated,
320
- * while the pb_extension_t structure is created by the user. However,
321
- * if you want to catch all unknown fields, you can also create a custom
322
- * pb_extension_type_t with your own callback.
323
- */
324
- typedef struct pb_extension_type_s pb_extension_type_t;
325
- typedef struct pb_extension_s pb_extension_t;
326
- struct pb_extension_type_s {
327
- /* Called for each unknown field in the message.
328
- * If you handle the field, read off all of its data and return true.
329
- * If you do not handle the field, do not read anything and return true.
330
- * If you run into an error, return false.
331
- * Set to NULL for default handler.
332
- */
333
- bool (*decode)(pb_istream_t *stream, pb_extension_t *extension,
334
- uint32_t tag, pb_wire_type_t wire_type);
335
-
336
- /* Called once after all regular fields have been encoded.
337
- * If you have something to write, do so and return true.
338
- * If you do not have anything to write, just return true.
339
- * If you run into an error, return false.
340
- * Set to NULL for default handler.
341
- */
342
- bool (*encode)(pb_ostream_t *stream, const pb_extension_t *extension);
343
-
344
- /* Free field for use by the callback. */
345
- const void *arg;
346
- };
347
-
348
- struct pb_extension_s {
349
- /* Type describing the extension field. Usually you'll initialize
350
- * this to a pointer to the automatically generated structure. */
351
- const pb_extension_type_t *type;
352
-
353
- /* Destination for the decoded data. This must match the datatype
354
- * of the extension field. */
355
- void *dest;
356
-
357
- /* Pointer to the next extension handler, or NULL.
358
- * If this extension does not match a field, the next handler is
359
- * automatically called. */
360
- pb_extension_t *next;
361
-
362
- /* The decoder sets this to true if the extension was found.
363
- * Ignored for encoding. */
364
- bool found;
365
- };
366
-
367
- /* Memory allocation functions to use. You can define pb_realloc and
368
- * pb_free to custom functions if you want. */
369
- #ifdef PB_ENABLE_MALLOC
370
- # ifndef pb_realloc
371
- # define pb_realloc(ptr, size) realloc(ptr, size)
372
- # endif
373
- # ifndef pb_free
374
- # define pb_free(ptr) free(ptr)
375
- # endif
376
- #endif
377
-
378
- /* This is used to inform about need to regenerate .pb.h/.pb.c files. */
379
- #define PB_PROTO_HEADER_VERSION 30
380
-
381
- /* These macros are used to declare pb_field_t's in the constant array. */
382
- /* Size of a structure member, in bytes. */
383
- #define pb_membersize(st, m) (sizeof ((st*)0)->m)
384
- /* Number of entries in an array. */
385
- #define pb_arraysize(st, m) (pb_membersize(st, m) / pb_membersize(st, m[0]))
386
- /* Delta from start of one member to the start of another member. */
387
- #define pb_delta(st, m1, m2) ((int)offsetof(st, m1) - (int)offsetof(st, m2))
388
- /* Marks the end of the field list */
389
- #define PB_LAST_FIELD {0,(pb_type_t) 0,0,0,0,0,0}
390
-
391
- /* Macros for filling in the data_offset field */
392
- /* data_offset for first field in a message */
393
- #define PB_DATAOFFSET_FIRST(st, m1, m2) (offsetof(st, m1))
394
- /* data_offset for subsequent fields */
395
- #define PB_DATAOFFSET_OTHER(st, m1, m2) (offsetof(st, m1) - offsetof(st, m2) - pb_membersize(st, m2))
396
- /* Choose first/other based on m1 == m2 (deprecated, remains for backwards compatibility) */
397
- #define PB_DATAOFFSET_CHOOSE(st, m1, m2) (int)(offsetof(st, m1) == offsetof(st, m2) \
398
- ? PB_DATAOFFSET_FIRST(st, m1, m2) \
399
- : PB_DATAOFFSET_OTHER(st, m1, m2))
400
-
401
- /* Required fields are the simplest. They just have delta (padding) from
402
- * previous field end, and the size of the field. Pointer is used for
403
- * submessages and default values.
404
- */
405
- #define PB_REQUIRED_STATIC(tag, st, m, fd, ltype, ptr) \
406
- {tag, PB_ATYPE_STATIC | PB_HTYPE_REQUIRED | ltype, \
407
- fd, 0, pb_membersize(st, m), 0, ptr}
408
-
409
- /* Optional fields add the delta to the has_ variable. */
410
- #define PB_OPTIONAL_STATIC(tag, st, m, fd, ltype, ptr) \
411
- {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | ltype, \
412
- fd, \
413
- pb_delta(st, has_ ## m, m), \
414
- pb_membersize(st, m), 0, ptr}
415
-
416
- /* Repeated fields have a _count field and also the maximum number of entries. */
417
- #define PB_REPEATED_STATIC(tag, st, m, fd, ltype, ptr) \
418
- {tag, PB_ATYPE_STATIC | PB_HTYPE_REPEATED | ltype, \
419
- fd, \
420
- pb_delta(st, m ## _count, m), \
421
- pb_membersize(st, m[0]), \
422
- pb_arraysize(st, m), ptr}
423
-
424
- #define PB_REQUIRED_INLINE(tag, st, m, fd, ltype, ptr) \
425
- {tag, PB_ATYPE_STATIC | PB_HTYPE_REQUIRED | PB_LTYPE_FIXED_LENGTH_BYTES, \
426
- fd, 0, pb_membersize(st, m), 0, ptr}
427
-
428
- /* Optional fields add the delta to the has_ variable. */
429
- #define PB_OPTIONAL_INLINE(tag, st, m, fd, ltype, ptr) \
430
- {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | PB_LTYPE_FIXED_LENGTH_BYTES, \
431
- fd, \
432
- pb_delta(st, has_ ## m, m), \
433
- pb_membersize(st, m), 0, ptr}
434
-
435
- /* INLINE does not support REPEATED fields. */
436
-
437
- /* Allocated fields carry the size of the actual data, not the pointer */
438
- #define PB_REQUIRED_POINTER(tag, st, m, fd, ltype, ptr) \
439
- {tag, PB_ATYPE_POINTER | PB_HTYPE_REQUIRED | ltype, \
440
- fd, 0, pb_membersize(st, m[0]), 0, ptr}
441
-
442
- /* Optional fields don't need a has_ variable, as information would be redundant */
443
- #define PB_OPTIONAL_POINTER(tag, st, m, fd, ltype, ptr) \
444
- {tag, PB_ATYPE_POINTER | PB_HTYPE_OPTIONAL | ltype, \
445
- fd, 0, pb_membersize(st, m[0]), 0, ptr}
446
-
447
- /* Repeated fields have a _count field and a pointer to array of pointers */
448
- #define PB_REPEATED_POINTER(tag, st, m, fd, ltype, ptr) \
449
- {tag, PB_ATYPE_POINTER | PB_HTYPE_REPEATED | ltype, \
450
- fd, pb_delta(st, m ## _count, m), \
451
- pb_membersize(st, m[0]), 0, ptr}
452
-
453
- /* Callbacks are much like required fields except with special datatype. */
454
- #define PB_REQUIRED_CALLBACK(tag, st, m, fd, ltype, ptr) \
455
- {tag, PB_ATYPE_CALLBACK | PB_HTYPE_REQUIRED | ltype, \
456
- fd, 0, pb_membersize(st, m), 0, ptr}
457
-
458
- #define PB_OPTIONAL_CALLBACK(tag, st, m, fd, ltype, ptr) \
459
- {tag, PB_ATYPE_CALLBACK | PB_HTYPE_OPTIONAL | ltype, \
460
- fd, 0, pb_membersize(st, m), 0, ptr}
461
-
462
- #define PB_REPEATED_CALLBACK(tag, st, m, fd, ltype, ptr) \
463
- {tag, PB_ATYPE_CALLBACK | PB_HTYPE_REPEATED | ltype, \
464
- fd, 0, pb_membersize(st, m), 0, ptr}
465
-
466
- /* Optional extensions don't have the has_ field, as that would be redundant. */
467
- #define PB_OPTEXT_STATIC(tag, st, m, fd, ltype, ptr) \
468
- {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | ltype, \
469
- 0, \
470
- 0, \
471
- pb_membersize(st, m), 0, ptr}
472
-
473
- #define PB_OPTEXT_POINTER(tag, st, m, fd, ltype, ptr) \
474
- PB_OPTIONAL_POINTER(tag, st, m, fd, ltype, ptr)
475
-
476
- /* INLINE does not support OPTEXT. */
477
-
478
- #define PB_OPTEXT_CALLBACK(tag, st, m, fd, ltype, ptr) \
479
- PB_OPTIONAL_CALLBACK(tag, st, m, fd, ltype, ptr)
480
-
481
- /* The mapping from protobuf types to LTYPEs is done using these macros. */
482
- #define PB_LTYPE_MAP_BOOL PB_LTYPE_VARINT
483
- #define PB_LTYPE_MAP_BYTES PB_LTYPE_BYTES
484
- #define PB_LTYPE_MAP_DOUBLE PB_LTYPE_FIXED64
485
- #define PB_LTYPE_MAP_ENUM PB_LTYPE_VARINT
486
- #define PB_LTYPE_MAP_UENUM PB_LTYPE_UVARINT
487
- #define PB_LTYPE_MAP_FIXED32 PB_LTYPE_FIXED32
488
- #define PB_LTYPE_MAP_FIXED64 PB_LTYPE_FIXED64
489
- #define PB_LTYPE_MAP_FLOAT PB_LTYPE_FIXED32
490
- #define PB_LTYPE_MAP_INT32 PB_LTYPE_VARINT
491
- #define PB_LTYPE_MAP_INT64 PB_LTYPE_VARINT
492
- #define PB_LTYPE_MAP_MESSAGE PB_LTYPE_SUBMESSAGE
493
- #define PB_LTYPE_MAP_SFIXED32 PB_LTYPE_FIXED32
494
- #define PB_LTYPE_MAP_SFIXED64 PB_LTYPE_FIXED64
495
- #define PB_LTYPE_MAP_SINT32 PB_LTYPE_SVARINT
496
- #define PB_LTYPE_MAP_SINT64 PB_LTYPE_SVARINT
497
- #define PB_LTYPE_MAP_STRING PB_LTYPE_STRING
498
- #define PB_LTYPE_MAP_UINT32 PB_LTYPE_UVARINT
499
- #define PB_LTYPE_MAP_UINT64 PB_LTYPE_UVARINT
500
- #define PB_LTYPE_MAP_EXTENSION PB_LTYPE_EXTENSION
501
-
502
- /* This is the actual macro used in field descriptions.
503
- * It takes these arguments:
504
- * - Field tag number
505
- * - Field type: BOOL, BYTES, DOUBLE, ENUM, UENUM, FIXED32, FIXED64,
506
- * FLOAT, INT32, INT64, MESSAGE, SFIXED32, SFIXED64
507
- * SINT32, SINT64, STRING, UINT32, UINT64 or EXTENSION
508
- * - Field rules: REQUIRED, OPTIONAL or REPEATED
509
- * - Allocation: STATIC, INLINE, or CALLBACK
510
- * - Placement: FIRST or OTHER, depending on if this is the first field in structure.
511
- * - Message name
512
- * - Field name
513
- * - Previous field name (or field name again for first field)
514
- * - Pointer to default value or submsg fields.
515
- */
516
-
517
- #define PB_FIELD(tag, type, rules, allocation, placement, message, field, prevfield, ptr) \
518
- PB_ ## rules ## _ ## allocation(tag, message, field, \
519
- PB_DATAOFFSET_ ## placement(message, field, prevfield), \
520
- PB_LTYPE_MAP_ ## type, ptr)
521
-
522
- /* Field description for oneof fields. This requires taking into account the
523
- * union name also, that's why a separate set of macros is needed.
524
- */
525
- #define PB_ONEOF_STATIC(u, tag, st, m, fd, ltype, ptr) \
526
- {tag, PB_ATYPE_STATIC | PB_HTYPE_ONEOF | ltype, \
527
- fd, pb_delta(st, which_ ## u, u.m), \
528
- pb_membersize(st, u.m), 0, ptr}
529
-
530
- #define PB_ONEOF_POINTER(u, tag, st, m, fd, ltype, ptr) \
531
- {tag, PB_ATYPE_POINTER | PB_HTYPE_ONEOF | ltype, \
532
- fd, pb_delta(st, which_ ## u, u.m), \
533
- pb_membersize(st, u.m[0]), 0, ptr}
534
-
535
- /* INLINE does not support ONEOF. */
536
-
537
- #define PB_ONEOF_FIELD(union_name, tag, type, rules, allocation, placement, message, field, prevfield, ptr) \
538
- PB_ONEOF_ ## allocation(union_name, tag, message, field, \
539
- PB_DATAOFFSET_ ## placement(message, union_name.field, prevfield), \
540
- PB_LTYPE_MAP_ ## type, ptr)
541
-
542
- #define PB_ANONYMOUS_ONEOF_STATIC(u, tag, st, m, fd, ltype, ptr) \
543
- {tag, PB_ATYPE_STATIC | PB_HTYPE_ONEOF | ltype, \
544
- fd, pb_delta(st, which_ ## u, m), \
545
- pb_membersize(st, m), 0, ptr}
546
-
547
- #define PB_ANONYMOUS_ONEOF_POINTER(u, tag, st, m, fd, ltype, ptr) \
548
- {tag, PB_ATYPE_POINTER | PB_HTYPE_ONEOF | ltype, \
549
- fd, pb_delta(st, which_ ## u, m), \
550
- pb_membersize(st, m[0]), 0, ptr}
551
-
552
- #define PB_ANONYMOUS_ONEOF_FIELD(union_name, tag, type, rules, allocation, placement, message, field, prevfield, ptr) \
553
- PB_ANONYMOUS_ONEOF_ ## allocation(union_name, tag, message, field, \
554
- PB_DATAOFFSET_ ## placement(message, field, prevfield), \
555
- PB_LTYPE_MAP_ ## type, ptr)
556
-
557
- /* These macros are used for giving out error messages.
558
- * They are mostly a debugging aid; the main error information
559
- * is the true/false return value from functions.
560
- * Some code space can be saved by disabling the error
561
- * messages if not used.
562
- *
563
- * PB_SET_ERROR() sets the error message if none has been set yet.
564
- * msg must be a constant string literal.
565
- * PB_GET_ERROR() always returns a pointer to a string.
566
- * PB_RETURN_ERROR() sets the error and returns false from current
567
- * function.
568
- */
569
- #ifdef PB_NO_ERRMSG
570
- #define PB_SET_ERROR(stream, msg) PB_UNUSED(stream)
571
- #define PB_GET_ERROR(stream) "(errmsg disabled)"
572
- #else
573
- #define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
574
- #define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)")
575
- #endif
576
-
577
- #define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
578
-
579
- #endif