diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:19:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-03-09 13:19:22 +0000 |
commit | c21c3b0befeb46a51b6bf3758ffa30813bea0ff0 (patch) | |
tree | 9754ff1ca740f6346cf8483ec915d4054bc5da2d /fluent-bit/lib/fluent-otel-proto | |
parent | Adding upstream version 1.43.2. (diff) | |
download | netdata-c21c3b0befeb46a51b6bf3758ffa30813bea0ff0.tar.xz netdata-c21c3b0befeb46a51b6bf3758ffa30813bea0ff0.zip |
Adding upstream version 1.44.3.upstream/1.44.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/lib/fluent-otel-proto')
32 files changed, 13711 insertions, 0 deletions
diff --git a/fluent-bit/lib/fluent-otel-proto/.gitignore b/fluent-bit/lib/fluent-otel-proto/.gitignore new file mode 100644 index 000000000..4995febf9 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/.gitignore @@ -0,0 +1,6 @@ +include/opentelemetry/* +src/opentelemetry/* +build/* +include/*.in +*sublime* + diff --git a/fluent-bit/lib/fluent-otel-proto/.gitmodules b/fluent-bit/lib/fluent-otel-proto/.gitmodules new file mode 100644 index 000000000..885d0e54f --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/.gitmodules @@ -0,0 +1,3 @@ +[submodule "opentelemetry"] + path = lib/opentelemetry + url = https://github.com/open-telemetry/opentelemetry-proto diff --git a/fluent-bit/lib/fluent-otel-proto/CMakeLists.txt b/fluent-bit/lib/fluent-otel-proto/CMakeLists.txt new file mode 100644 index 000000000..aae43bc00 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/CMakeLists.txt @@ -0,0 +1,133 @@ +cmake_minimum_required(VERSION 3.0) +project(fluent-opentelemetry-proto C) + +# Include helpers +include(cmake/macros.cmake) + +# We only regenerate files if it has been enabled +option(FLUENT_PROTO_REGENERATE "Regenerate .[ch] files only" "No") + +# build options for files generation +option(FLUENT_PROTO_COMMON "Include common.proto" "Yes") +option(FLUENT_PROTO_RESOURCE "Include resource.proto" "Yes") +option(FLUENT_PROTO_TRACE "Include trace.proto" "Yes") +option(FLUENT_PROTO_LOGS "Include logs.proto" "Yes") +option(FLUENT_PROTO_METRICS "Inlcude metrics.proto" "No") +option(FLUENT_PROTO_EXAMPLES "Add example programs" "Yes") + +if(FLUENT_PROTO_REGENERATE AND (NOT PROTOBUF_C_SOURCE_DIR OR NOT OTEL_PROTO_DIR)) + if (NOT PROTOBUF_C_SOURCE_DIR) + message(FATAL_ERROR + "\n" + "The variable PROTOBUF_C_SOURCE_DIR has not been defined. " + "You have to specify which directory contains the source code " + "of the repository https://github.com/fluent/protobuf-c\n" + "Define the path with: -DPROTOBUF_C_SOURCE_DIR=/path/to/protobuf-c") + endif() + + if (NOT OTEL_PROTO_DIR) + message(FATAL_ERROR + "\n" + "The variable OTEL_PROTO_DIR has not been defined. " + "You have to specify which directory contains the source code " + "of the repository https://github.com/open-telemetry/opentelemetry-proto\n" + "Define the path with: -DOTEL_PROTO_DIR=/path/to/opentelemetry-proto") + endif() +else() + if (FLUENT_PROTO_REGENERATE) + message(STATUS "protobuf-c directory: ${PROTOBUF_C_SOURCE_DIR}") + endif() +endif() + +# Paths +set(PROTOC_BIN "/opt/protobuf-c/bin/protoc-c") +set(PROTOC_ARG_OUT "--c_out=${PROJECT_SOURCE_DIR}/proto_c/") +set(PROTOC_ARG_PATH "--proto_path=${OTEL_PROTO_DIR}/") + +if (FLUENT_PROTO_REGENERATE) + # final protoc base command + message(STATUS "base command: ${PROTOC_BIN} ${PROTOC_ARG_OUT} ${PROTOC_ARG_PATH}") + + # Protobuf-c headers (this is not working, I ended up copying protobuf-c headers inside include/) + set(PROTOC_HEADERS "/opt/protobuf-c/include/") + include_directories(PROTOC_HEADERS) + + if (FLUENT_PROTO_COMMON) + message(STATUS "processing common.proto") + set(proto_file ${OTEL_PROTO_DIR}/opentelemetry/proto/common/v1/common.proto) + execute_process(COMMAND ${PROTOC_BIN} ${PROTOC_ARG_OUT} ${PROTOC_ARG_PATH} ${proto_file}) + include_directories(${PROJECT_BINARY_DIR}/opentelemetry/proto/common/v1/) + FLUENT_OTEL_DEFINITION(FLUENT_OTEL_HAVE_COMMON) + endif() + + if (FLUENT_PROTO_RESOURCE) + message(STATUS "processing resource.proto") + set(proto_file "${OTEL_PROTO_DIR}/opentelemetry/proto/resource/v1/resource.proto") + execute_process(COMMAND ${PROTOC_BIN} ${PROTOC_ARG_OUT} ${PROTOC_ARG_PATH} ${proto_file}) + include_directories(${PROJECT_BINARY_DIR}/opentelemetry/proto/resource/v1/) + FLUENT_OTEL_DEFINITION(FLUENT_OTEL_HAVE_RESOURCE) + endif() + + if (FLUENT_PROTO_TRACE) + message(STATUS "processing trace.proto") + set(proto_file "${OTEL_PROTO_DIR}/opentelemetry/proto/trace/v1/trace.proto") + execute_process(COMMAND ${PROTOC_BIN} ${PROTOC_ARG_OUT} ${PROTOC_ARG_PATH} ${proto_file}) + include_directories(${PROJECT_BINARY_DIR}/opentelemetry/proto/trace/v1/) + + message(STATUS "processing trace_service.proto") + set(proto_file "${OTEL_PROTO_DIR}/opentelemetry/proto/collector/trace/v1/trace_service.proto") + execute_process(COMMAND ${PROTOC_BIN} ${PROTOC_ARG_OUT} ${PROTOC_ARG_PATH} ${proto_file}) + include_directories(${PROJECT_BINARY_DIR}/opentelemetry/proto/collector/trace/v1) + FLUENT_OTEL_DEFINITION(FLUENT_OTEL_HAVE_TRACE) + endif() + + if (FLUENT_PROTO_LOGS) + message(STATUS "processing logs.proto") + set(proto_file "${OTEL_PROTO_DIR}/opentelemetry/proto/logs/v1/logs.proto") + execute_process(COMMAND ${PROTOC_BIN} ${PROTOC_ARG_OUT} ${PROTOC_ARG_PATH} ${proto_file}) + include_directories(${PROJECT_BINARY_DIR}/opentelemetry/proto/logs/v1/) + FLUENT_OTEL_DEFINITION(FLUENT_OTEL_HAVE_LOGS) + + message(STATUS "processing logs_service.proto") + set(proto_file "${OTEL_PROTO_DIR}/opentelemetry/proto/collector/logs/v1/logs_service.proto") + execute_process(COMMAND ${PROTOC_BIN} ${PROTOC_ARG_OUT} ${PROTOC_ARG_PATH} ${proto_file}) + include_directories(${PROJECT_BINARY_DIR}/opentelemetry/proto/collector/logs/v1/) + FLUENT_OTEL_DEFINITION(FLUENT_OTEL_HAVE_LOGS) + endif() + + if (FLUENT_PROTO_METRICS) + message(STATUS "processing metrics.proto") + set(proto_file "${OTEL_PROTO_DIR}/opentelemetry/proto/metrics/v1/metrics.proto") + execute_process(COMMAND ${PROTOC_BIN} ${PROTOC_ARG_OUT} ${PROTOC_ARG_PATH} ${proto_file}) + include_directories(${PROJECT_BINARY_DIR}/opentelemetry/proto/metrics/v1/) + + message(STATUS "processing metrics_service.proto") + set(proto_file "${OTEL_PROTO_DIR}/opentelemetry/proto/collector/metrics/v1/metrics_service.proto") + execute_process(COMMAND ${PROTOC_BIN} ${PROTOC_ARG_OUT} ${PROTOC_ARG_PATH} ${proto_file}) + include_directories(${PROJECT_BINARY_DIR}/opentelemetry/proto/collector/logs/v1/) + FLUENT_OTEL_DEFINITION(FLUENT_OTEL_HAVE_METRICS) + endif() + + configure_file( + "${PROJECT_SOURCE_DIR}/include/fluent-otel-proto/fluent-otel-info.h.in" + "${PROJECT_SOURCE_DIR}/include/fluent-otel-proto/fluent-otel-info.h" + ) + + # protobuf-c dependency + configure_file( + "${PROTOBUF_C_SOURCE_DIR}/protobuf-c/protobuf-c.c" + "${PROJECT_SOURCE_DIR}/proto_c/protobuf-c/protobuf-c.c" COPYONLY) + + configure_file( + "${PROTOBUF_C_SOURCE_DIR}/protobuf-c/protobuf-c.h" + "${PROJECT_SOURCE_DIR}/proto_c/protobuf-c/protobuf-c.h" COPYONLY) + +endif() + +# build library +add_subdirectory(src) + +# build example +if (FLUENT_PROTO_EXAMPLES) + add_subdirectory(examples) +endif() diff --git a/fluent-bit/lib/fluent-otel-proto/LICENSE b/fluent-bit/lib/fluent-otel-proto/LICENSE new file mode 100644 index 000000000..f433b1a53 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/LICENSE @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS diff --git a/fluent-bit/lib/fluent-otel-proto/README.md b/fluent-bit/lib/fluent-otel-proto/README.md new file mode 100644 index 000000000..2174cd780 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/README.md @@ -0,0 +1,119 @@ +# Fluent OTel (OpenTelemetry) Proto files + +This projects builds a static library that provides C interfaces for OpenTelemetry proto files data model and also includes some helper utilities. + +In the source, the `.proto` files are already included in their `C` version, so here you will find instructions for: + +- build this as a static library +- regenerate C interfaces from .proto files + +The project exposes the following build options: + +## Build static library + +To get start just clone this repository + +``` +git clone https://github.com/fluent/fluent-otel-proto +``` + +Join the build directory and compile: + +``` +cd fluent-otel-proto/build +cmake ../ +``` + +By default an example test gets available: + +``` +examples/test-api + +- opentelemetry proto 'common' : found +- opentelemetry proto 'resource': found +- opentelemetry proto 'trace' : found +- opentelemetry proto 'logs' : found +- opentelemetry proto 'metrics' : not found (enable it with -DFLUENT_PROTO_METRICS) +``` + +> Yes, Metrics are disabled for now. + +## Regenerate C files + +To regenerate the C files inside this repo, you need to main dependencies or repositories: + +- [fluent/protobuf-c](https://github.com/fluent/protobuf-c) +- [open-telemetry/opentelemetry-proto](https://github.com/open-telemetry/opentelemetry-proto) + +### Download dependencies + +#### 1. Protobuf-c + +The repository [fluent/protobuf-c](https://github.com/fluent/protobuf-c) is a fork of the official protobuf-c that includes a small modification to support `options` feature from proto3. This feature is only required by the OpenTelemetry Metrics data model. + +Download and install `protobuf-c` by running the following commands: + +``` +git clone https://github.com/fluent/protobuf-c +cd protobuf-c +./autogen.sh +./configure --prefix=/opt/protobuf-c +make +sudo make install +``` + +#### 2. OpenTelemetry Proto + +Download the main repository with the following command: + +``` +git clone https://github.com/open-telemetry/opentelemetry-proto +``` + +#### 3. Clone this repository + +```bash +git clone https://github.com/fluent/fluent-otel-proto +``` + +#### 4. Regenerate C Files + +The CMake command will require the following variable definitions to succeed in the C files regeneration: + +| Variable name | Description | +| ----------------------- | ------------------------------------------------------------ | +| FLUENT_PROTO_REGENERATE | Enable the C source file regeneration. Disabled by default. | +| PROTOBUF_C_SOURCE_DIR | Absolute path of the directory containing the sources of `protobuf-c` downloaded in Step 1. __NOTE__: this is the source code path, not where the binaries were installed. | +| OTEL_PROTO_DIR | Absolute path of the directory containing the sources of `opentelemetry-proto` downloaded in Step 2. | + +In addition, the following build options are available if you desire to enable/disable certain feature: + +| Build Option | Description | Default | +| --------------------- | ------------------------------------------------------------ | ------- | +| FLUENT_PROTO_COMMON | Include the regeneration of a C interface for `common.proto` file. | On | +| FLUENT_PROTO_RESOURCE | Include the regeneration of a C interface for `resource.proto` file. | On | +| FLUENT_PROTO_TRACE | Include the regeneration of a C interfaces for `trace.proto` and `trace_service.proto` files. | On | +| FLUENT_PROTO_LOGS | Include the regeneration of a C interfaces for `logs.proto` and `logs_service.proto` files. | On | +| FLUENT_PROTO_METRICS | Include the regeneration of a C interfaces for `metrics.proto` and `metrics_service.proto` files. | Off | + +#### 5. Example + +Get into this project source code directory: + +```bash +cd fluent-otel-proto/build/ +``` + +Run CMake: + +```bash +cmake -DFLUENT_PROTO_REGENERATE=ON \ + -DPROTOBUF_C_SOURCE_DIR=/tmp/protobuf-c \ + -DOTEL_PROTO_DIR=/tmp/opentelemetry-proto \ + ../ +``` + +now build by running `make` command. + + + diff --git a/fluent-bit/lib/fluent-otel-proto/cmake/macros.cmake b/fluent-bit/lib/fluent-otel-proto/cmake/macros.cmake new file mode 100644 index 000000000..8501fcb45 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/cmake/macros.cmake @@ -0,0 +1,6 @@ +# Macro to set definitions +macro(FLUENT_OTEL_DEFINITION var) + add_definitions(-D${var}) + set(FLUENT_OTEL_BUILD_FLAGS "${FLUENT_OTEL_BUILD_FLAGS}#ifndef ${var}\n#define ${var}\n#endif\n") + set(FLUENT_OTEL_INFO_FLAGS "${FLUENT_OTEL_INFO_FLAGS} ${var}") +endmacro() diff --git a/fluent-bit/lib/fluent-otel-proto/examples/CMakeLists.txt b/fluent-bit/lib/fluent-otel-proto/examples/CMakeLists.txt new file mode 100644 index 000000000..bd0ecab44 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/examples/CMakeLists.txt @@ -0,0 +1,7 @@ +set(src test-api.c) + +include_directories(${PROJECT_SOURCE_DIR}/include) +include_directories(${PROJECT_SOURCE_DIR}/proto_c) + +add_executable(test-api ${src}) +target_link_libraries(test-api fluent-otel-proto) diff --git a/fluent-bit/lib/fluent-otel-proto/examples/test-api.c b/fluent-bit/lib/fluent-otel-proto/examples/test-api.c new file mode 100644 index 000000000..883a16d16 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/examples/test-api.c @@ -0,0 +1,29 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* Fluent Bit + * ========== + * Copyright (C) 2022 The Fluent Bit Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <stdio.h> +#include <fluent-otel-proto/fluent-otel.h> + +int main() +{ + int ret; + + fluent_otel_info(); + return 0; +} diff --git a/fluent-bit/lib/fluent-otel-proto/include/fluent-otel-proto/fluent-otel-info.h b/fluent-bit/lib/fluent-otel-proto/include/fluent-otel-proto/fluent-otel-info.h new file mode 100644 index 000000000..e8e158e90 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/include/fluent-otel-proto/fluent-otel-info.h @@ -0,0 +1,46 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* Fluent Bit + * ========== + * Copyright (C) 2022 The Fluent Bit Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FLUENT_OTEL_INFO_H +#define FLUENT_OTEL_INFO_H + +#define FLUENT_OTEL_SOURCE_DIR "/Users/edsiper/coding/fluent-otel-proto" + +/* General flags set by /CMakeLists.txt */ +#ifndef FLUENT_OTEL_HAVE_COMMON +#define FLUENT_OTEL_HAVE_COMMON +#endif +#ifndef FLUENT_OTEL_HAVE_RESOURCE +#define FLUENT_OTEL_HAVE_RESOURCE +#endif +#ifndef FLUENT_OTEL_HAVE_TRACE +#define FLUENT_OTEL_HAVE_TRACE +#endif +#ifndef FLUENT_OTEL_HAVE_LOGS +#define FLUENT_OTEL_HAVE_LOGS +#endif +#ifndef FLUENT_OTEL_HAVE_LOGS +#define FLUENT_OTEL_HAVE_LOGS +#endif +#ifndef FLUENT_OTEL_HAVE_METRICS +#define FLUENT_OTEL_HAVE_METRICS +#endif + + +#endif diff --git a/fluent-bit/lib/fluent-otel-proto/include/fluent-otel-proto/fluent-otel-info.h.in b/fluent-bit/lib/fluent-otel-proto/include/fluent-otel-proto/fluent-otel-info.h.in new file mode 100644 index 000000000..d0fba4c27 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/include/fluent-otel-proto/fluent-otel-info.h.in @@ -0,0 +1,28 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* Fluent Bit + * ========== + * Copyright (C) 2022 The Fluent Bit Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FLUENT_OTEL_INFO_H +#define FLUENT_OTEL_INFO_H + +#define FLUENT_OTEL_SOURCE_DIR "@CMAKE_SOURCE_DIR@" + +/* General flags set by /CMakeLists.txt */ +@FLUENT_OTEL_BUILD_FLAGS@ + +#endif diff --git a/fluent-bit/lib/fluent-otel-proto/include/fluent-otel-proto/fluent-otel.h b/fluent-bit/lib/fluent-otel-proto/include/fluent-otel-proto/fluent-otel.h new file mode 100644 index 000000000..606d76c5a --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/include/fluent-otel-proto/fluent-otel.h @@ -0,0 +1,51 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* Fluent Bit + * ========== + * Copyright (C) 2022 The Fluent Bit Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FLUENT_OTEL_PROTO_H +#define FLUENT_OTEL_PROTO_H + +#include <fluent-otel-proto/fluent-otel-info.h> + +#ifdef FLUENT_OTEL_HAVE_COMMON +#include <opentelemetry/proto/common/v1/common.pb-c.h> +#endif + +#ifdef FLUENT_OTEL_HAVE_RESOURCE +#include <opentelemetry/proto/resource/v1/resource.pb-c.h> +#endif + +#ifdef FLUENT_OTEL_HAVE_TRACE +#include <opentelemetry/proto/trace/v1/trace.pb-c.h> +#include <opentelemetry/proto/collector/trace/v1/trace_service.pb-c.h> +#endif + +#ifdef FLUENT_OTEL_HAVE_LOGS +#include <opentelemetry/proto/logs/v1/logs.pb-c.h> +#include <opentelemetry/proto/collector/logs/v1/logs_service.pb-c.h> +#endif + +#ifdef FLUENT_OTEL_HAVE_METRICS +#include <opentelemetry/proto/metrics/v1/metrics.pb-c.h> +#include <opentelemetry/proto/collector/metrics/v1/metrics_service.pb-c.h> +#endif + +/* just a way to expose some helper functions */ +void fluent_otel_info(); + +#endif
\ No newline at end of file diff --git a/fluent-bit/lib/fluent-otel-proto/include/fluent-otel-proto/fluent-otel_found.h b/fluent-bit/lib/fluent-otel-proto/include/fluent-otel-proto/fluent-otel_found.h new file mode 100644 index 000000000..864ff4f2c --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/include/fluent-otel-proto/fluent-otel_found.h @@ -0,0 +1,43 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* Fluent Bit + * ========== + * Copyright (C) 2022 The Fluent Bit Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * This is a dummy header that can be used by parent projects to check if + * fluent-otel-proto headers are found in their path. + * + * In order to use it, the caller might try to use check_c_source_compiles() CMake function + * and try to include this header and invoke the inline function defined here, e.g: + * + * check_c_source_compiles(" + * include <fluent-otel-proto/fluent-otel_found.h> + * + * int main() { + * return fluent_otel_found(); + * }" CFL_FOUND) + */ + +#ifndef FLUENT_OTEL_FOUND_H +#define FLUENT_OTEL_FOUND_H + +static inline int fluent_otel_found() +{ + return 0; +} + +#endif diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/logs/v1/logs_service.pb-c.c b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/logs/v1/logs_service.pb-c.c new file mode 100644 index 000000000..ca13ec4ea --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/logs/v1/logs_service.pb-c.c @@ -0,0 +1,304 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/collector/logs/v1/logs_service.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "opentelemetry/proto/collector/logs/v1/logs_service.pb-c.h" +void opentelemetry__proto__collector__logs__v1__export_logs_service_request__init + (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *message) +{ + static const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest init_value = OPENTELEMETRY__PROTO__COLLECTOR__LOGS__V1__EXPORT_LOGS_SERVICE_REQUEST__INIT; + *message = init_value; +} +size_t opentelemetry__proto__collector__logs__v1__export_logs_service_request__get_packed_size + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__logs__v1__export_logs_service_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__collector__logs__v1__export_logs_service_request__pack + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__logs__v1__export_logs_service_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__collector__logs__v1__export_logs_service_request__pack_to_buffer + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__logs__v1__export_logs_service_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest * + opentelemetry__proto__collector__logs__v1__export_logs_service_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *) + protobuf_c_message_unpack (&opentelemetry__proto__collector__logs__v1__export_logs_service_request__descriptor, + allocator, len, data); +} +void opentelemetry__proto__collector__logs__v1__export_logs_service_request__free_unpacked + (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__collector__logs__v1__export_logs_service_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__collector__logs__v1__export_logs_service_response__init + (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse *message) +{ + static const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse init_value = OPENTELEMETRY__PROTO__COLLECTOR__LOGS__V1__EXPORT_LOGS_SERVICE_RESPONSE__INIT; + *message = init_value; +} +size_t opentelemetry__proto__collector__logs__v1__export_logs_service_response__get_packed_size + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__logs__v1__export_logs_service_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__collector__logs__v1__export_logs_service_response__pack + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__logs__v1__export_logs_service_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__collector__logs__v1__export_logs_service_response__pack_to_buffer + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__logs__v1__export_logs_service_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse * + opentelemetry__proto__collector__logs__v1__export_logs_service_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse *) + protobuf_c_message_unpack (&opentelemetry__proto__collector__logs__v1__export_logs_service_response__descriptor, + allocator, len, data); +} +void opentelemetry__proto__collector__logs__v1__export_logs_service_response__free_unpacked + (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__collector__logs__v1__export_logs_service_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__collector__logs__v1__export_logs_partial_success__init + (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess *message) +{ + static const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess init_value = OPENTELEMETRY__PROTO__COLLECTOR__LOGS__V1__EXPORT_LOGS_PARTIAL_SUCCESS__INIT; + *message = init_value; +} +size_t opentelemetry__proto__collector__logs__v1__export_logs_partial_success__get_packed_size + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__logs__v1__export_logs_partial_success__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__collector__logs__v1__export_logs_partial_success__pack + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__logs__v1__export_logs_partial_success__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__collector__logs__v1__export_logs_partial_success__pack_to_buffer + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__logs__v1__export_logs_partial_success__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess * + opentelemetry__proto__collector__logs__v1__export_logs_partial_success__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess *) + protobuf_c_message_unpack (&opentelemetry__proto__collector__logs__v1__export_logs_partial_success__descriptor, + allocator, len, data); +} +void opentelemetry__proto__collector__logs__v1__export_logs_partial_success__free_unpacked + (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__collector__logs__v1__export_logs_partial_success__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor opentelemetry__proto__collector__logs__v1__export_logs_service_request__field_descriptors[1] = +{ + { + "resource_logs", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest, n_resource_logs), + offsetof(Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest, resource_logs), + &opentelemetry__proto__logs__v1__resource_logs__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__collector__logs__v1__export_logs_service_request__field_indices_by_name[] = { + 0, /* field[0] = resource_logs */ +}; +static const ProtobufCIntRange opentelemetry__proto__collector__logs__v1__export_logs_service_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__collector__logs__v1__export_logs_service_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.collector.logs.v1.ExportLogsServiceRequest", + "ExportLogsServiceRequest", + "Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest", + "opentelemetry.proto.collector.logs.v1", + sizeof(Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest), + 1, + opentelemetry__proto__collector__logs__v1__export_logs_service_request__field_descriptors, + opentelemetry__proto__collector__logs__v1__export_logs_service_request__field_indices_by_name, + 1, opentelemetry__proto__collector__logs__v1__export_logs_service_request__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__collector__logs__v1__export_logs_service_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__collector__logs__v1__export_logs_service_response__field_descriptors[1] = +{ + { + "partial_success", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse, partial_success), + &opentelemetry__proto__collector__logs__v1__export_logs_partial_success__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__collector__logs__v1__export_logs_service_response__field_indices_by_name[] = { + 0, /* field[0] = partial_success */ +}; +static const ProtobufCIntRange opentelemetry__proto__collector__logs__v1__export_logs_service_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__collector__logs__v1__export_logs_service_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.collector.logs.v1.ExportLogsServiceResponse", + "ExportLogsServiceResponse", + "Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse", + "opentelemetry.proto.collector.logs.v1", + sizeof(Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse), + 1, + opentelemetry__proto__collector__logs__v1__export_logs_service_response__field_descriptors, + opentelemetry__proto__collector__logs__v1__export_logs_service_response__field_indices_by_name, + 1, opentelemetry__proto__collector__logs__v1__export_logs_service_response__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__collector__logs__v1__export_logs_service_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__collector__logs__v1__export_logs_partial_success__field_descriptors[2] = +{ + { + "rejected_log_records", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess, rejected_log_records), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "error_message", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess, error_message), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__collector__logs__v1__export_logs_partial_success__field_indices_by_name[] = { + 1, /* field[1] = error_message */ + 0, /* field[0] = rejected_log_records */ +}; +static const ProtobufCIntRange opentelemetry__proto__collector__logs__v1__export_logs_partial_success__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__collector__logs__v1__export_logs_partial_success__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.collector.logs.v1.ExportLogsPartialSuccess", + "ExportLogsPartialSuccess", + "Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess", + "opentelemetry.proto.collector.logs.v1", + sizeof(Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess), + 2, + opentelemetry__proto__collector__logs__v1__export_logs_partial_success__field_descriptors, + opentelemetry__proto__collector__logs__v1__export_logs_partial_success__field_indices_by_name, + 1, opentelemetry__proto__collector__logs__v1__export_logs_partial_success__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__collector__logs__v1__export_logs_partial_success__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCMethodDescriptor opentelemetry__proto__collector__logs__v1__logs_service__method_descriptors[1] = +{ + { "Export", &opentelemetry__proto__collector__logs__v1__export_logs_service_request__descriptor, &opentelemetry__proto__collector__logs__v1__export_logs_service_response__descriptor }, +}; +const unsigned opentelemetry__proto__collector__logs__v1__logs_service__method_indices_by_name[] = { + 0 /* Export */ +}; +const ProtobufCServiceDescriptor opentelemetry__proto__collector__logs__v1__logs_service__descriptor = +{ + PROTOBUF_C__SERVICE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.collector.logs.v1.LogsService", + "LogsService", + "Opentelemetry__Proto__Collector__Logs__V1__LogsService", + "opentelemetry.proto.collector.logs.v1", + 1, + opentelemetry__proto__collector__logs__v1__logs_service__method_descriptors, + opentelemetry__proto__collector__logs__v1__logs_service__method_indices_by_name +}; +void opentelemetry__proto__collector__logs__v1__logs_service__export(ProtobufCService *service, + const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *input, + Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse_Closure closure, + void *closure_data) +{ + assert(service->descriptor == &opentelemetry__proto__collector__logs__v1__logs_service__descriptor); + service->invoke(service, 0, (const ProtobufCMessage *) input, (ProtobufCClosure) closure, closure_data); +} +void opentelemetry__proto__collector__logs__v1__logs_service__init (Opentelemetry__Proto__Collector__Logs__V1__LogsService_Service *service, + Opentelemetry__Proto__Collector__Logs__V1__LogsService_ServiceDestroy destroy) +{ + protobuf_c_service_generated_init (&service->base, + &opentelemetry__proto__collector__logs__v1__logs_service__descriptor, + (ProtobufCServiceDestroy) destroy); +} diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/logs/v1/logs_service.pb-c.h b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/logs/v1/logs_service.pb-c.h new file mode 100644 index 000000000..cdd346075 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/logs/v1/logs_service.pb-c.h @@ -0,0 +1,198 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/collector/logs/v1/logs_service.proto */ + +#ifndef PROTOBUF_C_opentelemetry_2fproto_2fcollector_2flogs_2fv1_2flogs_5fservice_2eproto__INCLUDED +#define PROTOBUF_C_opentelemetry_2fproto_2fcollector_2flogs_2fv1_2flogs_5fservice_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1004001 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + +#include "opentelemetry/proto/logs/v1/logs.pb-c.h" + +typedef struct Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest; +typedef struct Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse; +typedef struct Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest +{ + ProtobufCMessage base; + /* + * An array of ResourceLogs. + * For data coming from a single resource this array will typically contain one + * element. Intermediary nodes (such as OpenTelemetry Collector) that receive + * data from multiple origins typically batch the data before forwarding further and + * in that case this array will contain multiple elements. + */ + size_t n_resource_logs; + Opentelemetry__Proto__Logs__V1__ResourceLogs **resource_logs; +}; +#define OPENTELEMETRY__PROTO__COLLECTOR__LOGS__V1__EXPORT_LOGS_SERVICE_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__collector__logs__v1__export_logs_service_request__descriptor) \ + , 0,NULL } + + +struct Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse +{ + ProtobufCMessage base; + /* + * The details of a partially successful export request. + * If the request is only partially accepted + * (i.e. when the server accepts only parts of the data and rejects the rest) + * the server MUST initialize the `partial_success` field and MUST + * set the `rejected_<signal>` with the number of items it rejected. + * Servers MAY also make use of the `partial_success` field to convey + * warnings/suggestions to senders even when the request was fully accepted. + * In such cases, the `rejected_<signal>` MUST have a value of `0` and + * the `error_message` MUST be non-empty. + * A `partial_success` message with an empty value (rejected_<signal> = 0 and + * `error_message` = "") is equivalent to it not being set/present. Senders + * SHOULD interpret it the same way as in the full success case. + */ + Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess *partial_success; +}; +#define OPENTELEMETRY__PROTO__COLLECTOR__LOGS__V1__EXPORT_LOGS_SERVICE_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__collector__logs__v1__export_logs_service_response__descriptor) \ + , NULL } + + +struct Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess +{ + ProtobufCMessage base; + /* + * The number of rejected log records. + * A `rejected_<signal>` field holding a `0` value indicates that the + * request was fully accepted. + */ + int64_t rejected_log_records; + /* + * A developer-facing human-readable message in English. It should be used + * either to explain why the server rejected parts of the data during a partial + * success or to convey warnings/suggestions during a full success. The message + * should offer guidance on how users can address such issues. + * error_message is an optional field. An error_message with an empty value + * is equivalent to it not being set. + */ + char *error_message; +}; +#define OPENTELEMETRY__PROTO__COLLECTOR__LOGS__V1__EXPORT_LOGS_PARTIAL_SUCCESS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__collector__logs__v1__export_logs_partial_success__descriptor) \ + , 0, (char *)protobuf_c_empty_string } + + +/* Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest methods */ +void opentelemetry__proto__collector__logs__v1__export_logs_service_request__init + (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *message); +size_t opentelemetry__proto__collector__logs__v1__export_logs_service_request__get_packed_size + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *message); +size_t opentelemetry__proto__collector__logs__v1__export_logs_service_request__pack + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *message, + uint8_t *out); +size_t opentelemetry__proto__collector__logs__v1__export_logs_service_request__pack_to_buffer + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest * + opentelemetry__proto__collector__logs__v1__export_logs_service_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__collector__logs__v1__export_logs_service_request__free_unpacked + (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse methods */ +void opentelemetry__proto__collector__logs__v1__export_logs_service_response__init + (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse *message); +size_t opentelemetry__proto__collector__logs__v1__export_logs_service_response__get_packed_size + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse *message); +size_t opentelemetry__proto__collector__logs__v1__export_logs_service_response__pack + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse *message, + uint8_t *out); +size_t opentelemetry__proto__collector__logs__v1__export_logs_service_response__pack_to_buffer + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse * + opentelemetry__proto__collector__logs__v1__export_logs_service_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__collector__logs__v1__export_logs_service_response__free_unpacked + (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess methods */ +void opentelemetry__proto__collector__logs__v1__export_logs_partial_success__init + (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess *message); +size_t opentelemetry__proto__collector__logs__v1__export_logs_partial_success__get_packed_size + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess *message); +size_t opentelemetry__proto__collector__logs__v1__export_logs_partial_success__pack + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess *message, + uint8_t *out); +size_t opentelemetry__proto__collector__logs__v1__export_logs_partial_success__pack_to_buffer + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess * + opentelemetry__proto__collector__logs__v1__export_logs_partial_success__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__collector__logs__v1__export_logs_partial_success__free_unpacked + (Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest_Closure) + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse_Closure) + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess_Closure) + (const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsPartialSuccess *message, + void *closure_data); + +/* --- services --- */ + +typedef struct Opentelemetry__Proto__Collector__Logs__V1__LogsService_Service Opentelemetry__Proto__Collector__Logs__V1__LogsService_Service; +struct Opentelemetry__Proto__Collector__Logs__V1__LogsService_Service +{ + ProtobufCService base; + void (*export)(Opentelemetry__Proto__Collector__Logs__V1__LogsService_Service *service, + const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *input, + Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse_Closure closure, + void *closure_data); +}; +typedef void (*Opentelemetry__Proto__Collector__Logs__V1__LogsService_ServiceDestroy)(Opentelemetry__Proto__Collector__Logs__V1__LogsService_Service *); +void opentelemetry__proto__collector__logs__v1__logs_service__init (Opentelemetry__Proto__Collector__Logs__V1__LogsService_Service *service, + Opentelemetry__Proto__Collector__Logs__V1__LogsService_ServiceDestroy destroy); +#define OPENTELEMETRY__PROTO__COLLECTOR__LOGS__V1__LOGS_SERVICE__BASE_INIT \ + { &opentelemetry__proto__collector__logs__v1__logs_service__descriptor, protobuf_c_service_invoke_internal, NULL } +#define OPENTELEMETRY__PROTO__COLLECTOR__LOGS__V1__LOGS_SERVICE__INIT(function_prefix__) \ + { OPENTELEMETRY__PROTO__COLLECTOR__LOGS__V1__LOGS_SERVICE__BASE_INIT,\ + function_prefix__ ## export } +void opentelemetry__proto__collector__logs__v1__logs_service__export(ProtobufCService *service, + const Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceRequest *input, + Opentelemetry__Proto__Collector__Logs__V1__ExportLogsServiceResponse_Closure closure, + void *closure_data); + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor opentelemetry__proto__collector__logs__v1__export_logs_service_request__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__collector__logs__v1__export_logs_service_response__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__collector__logs__v1__export_logs_partial_success__descriptor; +extern const ProtobufCServiceDescriptor opentelemetry__proto__collector__logs__v1__logs_service__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_opentelemetry_2fproto_2fcollector_2flogs_2fv1_2flogs_5fservice_2eproto__INCLUDED */ diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/metrics/v1/metrics_service.pb-c.c b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/metrics/v1/metrics_service.pb-c.c new file mode 100644 index 000000000..5ba056645 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/metrics/v1/metrics_service.pb-c.c @@ -0,0 +1,304 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/collector/metrics/v1/metrics_service.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "opentelemetry/proto/collector/metrics/v1/metrics_service.pb-c.h" +void opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__init + (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *message) +{ + static const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest init_value = OPENTELEMETRY__PROTO__COLLECTOR__METRICS__V1__EXPORT_METRICS_SERVICE_REQUEST__INIT; + *message = init_value; +} +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__get_packed_size + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__pack + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__pack_to_buffer + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest * + opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *) + protobuf_c_message_unpack (&opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__descriptor, + allocator, len, data); +} +void opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__free_unpacked + (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__init + (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse *message) +{ + static const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse init_value = OPENTELEMETRY__PROTO__COLLECTOR__METRICS__V1__EXPORT_METRICS_SERVICE_RESPONSE__INIT; + *message = init_value; +} +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__get_packed_size + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__pack + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__pack_to_buffer + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse * + opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse *) + protobuf_c_message_unpack (&opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__descriptor, + allocator, len, data); +} +void opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__free_unpacked + (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__init + (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess *message) +{ + static const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess init_value = OPENTELEMETRY__PROTO__COLLECTOR__METRICS__V1__EXPORT_METRICS_PARTIAL_SUCCESS__INIT; + *message = init_value; +} +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__get_packed_size + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__pack + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__pack_to_buffer + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess * + opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess *) + protobuf_c_message_unpack (&opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__descriptor, + allocator, len, data); +} +void opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__free_unpacked + (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__field_descriptors[1] = +{ + { + "resource_metrics", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest, n_resource_metrics), + offsetof(Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest, resource_metrics), + &opentelemetry__proto__metrics__v1__resource_metrics__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__field_indices_by_name[] = { + 0, /* field[0] = resource_metrics */ +}; +static const ProtobufCIntRange opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceRequest", + "ExportMetricsServiceRequest", + "Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest", + "opentelemetry.proto.collector.metrics.v1", + sizeof(Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest), + 1, + opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__field_descriptors, + opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__field_indices_by_name, + 1, opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__field_descriptors[1] = +{ + { + "partial_success", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse, partial_success), + &opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__field_indices_by_name[] = { + 0, /* field[0] = partial_success */ +}; +static const ProtobufCIntRange opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.collector.metrics.v1.ExportMetricsServiceResponse", + "ExportMetricsServiceResponse", + "Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse", + "opentelemetry.proto.collector.metrics.v1", + sizeof(Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse), + 1, + opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__field_descriptors, + opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__field_indices_by_name, + 1, opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__field_descriptors[2] = +{ + { + "rejected_data_points", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess, rejected_data_points), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "error_message", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess, error_message), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__field_indices_by_name[] = { + 1, /* field[1] = error_message */ + 0, /* field[0] = rejected_data_points */ +}; +static const ProtobufCIntRange opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.collector.metrics.v1.ExportMetricsPartialSuccess", + "ExportMetricsPartialSuccess", + "Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess", + "opentelemetry.proto.collector.metrics.v1", + sizeof(Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess), + 2, + opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__field_descriptors, + opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__field_indices_by_name, + 1, opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCMethodDescriptor opentelemetry__proto__collector__metrics__v1__metrics_service__method_descriptors[1] = +{ + { "Export", &opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__descriptor, &opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__descriptor }, +}; +const unsigned opentelemetry__proto__collector__metrics__v1__metrics_service__method_indices_by_name[] = { + 0 /* Export */ +}; +const ProtobufCServiceDescriptor opentelemetry__proto__collector__metrics__v1__metrics_service__descriptor = +{ + PROTOBUF_C__SERVICE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.collector.metrics.v1.MetricsService", + "MetricsService", + "Opentelemetry__Proto__Collector__Metrics__V1__MetricsService", + "opentelemetry.proto.collector.metrics.v1", + 1, + opentelemetry__proto__collector__metrics__v1__metrics_service__method_descriptors, + opentelemetry__proto__collector__metrics__v1__metrics_service__method_indices_by_name +}; +void opentelemetry__proto__collector__metrics__v1__metrics_service__export(ProtobufCService *service, + const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *input, + Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse_Closure closure, + void *closure_data) +{ + assert(service->descriptor == &opentelemetry__proto__collector__metrics__v1__metrics_service__descriptor); + service->invoke(service, 0, (const ProtobufCMessage *) input, (ProtobufCClosure) closure, closure_data); +} +void opentelemetry__proto__collector__metrics__v1__metrics_service__init (Opentelemetry__Proto__Collector__Metrics__V1__MetricsService_Service *service, + Opentelemetry__Proto__Collector__Metrics__V1__MetricsService_ServiceDestroy destroy) +{ + protobuf_c_service_generated_init (&service->base, + &opentelemetry__proto__collector__metrics__v1__metrics_service__descriptor, + (ProtobufCServiceDestroy) destroy); +} diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/metrics/v1/metrics_service.pb-c.h b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/metrics/v1/metrics_service.pb-c.h new file mode 100644 index 000000000..4b19ffc05 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/metrics/v1/metrics_service.pb-c.h @@ -0,0 +1,198 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/collector/metrics/v1/metrics_service.proto */ + +#ifndef PROTOBUF_C_opentelemetry_2fproto_2fcollector_2fmetrics_2fv1_2fmetrics_5fservice_2eproto__INCLUDED +#define PROTOBUF_C_opentelemetry_2fproto_2fcollector_2fmetrics_2fv1_2fmetrics_5fservice_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1004001 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + +#include "opentelemetry/proto/metrics/v1/metrics.pb-c.h" + +typedef struct Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest; +typedef struct Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse; +typedef struct Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest +{ + ProtobufCMessage base; + /* + * An array of ResourceMetrics. + * For data coming from a single resource this array will typically contain one + * element. Intermediary nodes (such as OpenTelemetry Collector) that receive + * data from multiple origins typically batch the data before forwarding further and + * in that case this array will contain multiple elements. + */ + size_t n_resource_metrics; + Opentelemetry__Proto__Metrics__V1__ResourceMetrics **resource_metrics; +}; +#define OPENTELEMETRY__PROTO__COLLECTOR__METRICS__V1__EXPORT_METRICS_SERVICE_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__descriptor) \ + , 0,NULL } + + +struct Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse +{ + ProtobufCMessage base; + /* + * The details of a partially successful export request. + * If the request is only partially accepted + * (i.e. when the server accepts only parts of the data and rejects the rest) + * the server MUST initialize the `partial_success` field and MUST + * set the `rejected_<signal>` with the number of items it rejected. + * Servers MAY also make use of the `partial_success` field to convey + * warnings/suggestions to senders even when the request was fully accepted. + * In such cases, the `rejected_<signal>` MUST have a value of `0` and + * the `error_message` MUST be non-empty. + * A `partial_success` message with an empty value (rejected_<signal> = 0 and + * `error_message` = "") is equivalent to it not being set/present. Senders + * SHOULD interpret it the same way as in the full success case. + */ + Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess *partial_success; +}; +#define OPENTELEMETRY__PROTO__COLLECTOR__METRICS__V1__EXPORT_METRICS_SERVICE_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__descriptor) \ + , NULL } + + +struct Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess +{ + ProtobufCMessage base; + /* + * The number of rejected data points. + * A `rejected_<signal>` field holding a `0` value indicates that the + * request was fully accepted. + */ + int64_t rejected_data_points; + /* + * A developer-facing human-readable message in English. It should be used + * either to explain why the server rejected parts of the data during a partial + * success or to convey warnings/suggestions during a full success. The message + * should offer guidance on how users can address such issues. + * error_message is an optional field. An error_message with an empty value + * is equivalent to it not being set. + */ + char *error_message; +}; +#define OPENTELEMETRY__PROTO__COLLECTOR__METRICS__V1__EXPORT_METRICS_PARTIAL_SUCCESS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__descriptor) \ + , 0, (char *)protobuf_c_empty_string } + + +/* Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest methods */ +void opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__init + (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *message); +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__get_packed_size + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *message); +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__pack + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *message, + uint8_t *out); +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__pack_to_buffer + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest * + opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__free_unpacked + (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse methods */ +void opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__init + (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse *message); +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__get_packed_size + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse *message); +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__pack + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse *message, + uint8_t *out); +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__pack_to_buffer + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse * + opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__free_unpacked + (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess methods */ +void opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__init + (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess *message); +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__get_packed_size + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess *message); +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__pack + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess *message, + uint8_t *out); +size_t opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__pack_to_buffer + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess * + opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__free_unpacked + (Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest_Closure) + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse_Closure) + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess_Closure) + (const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsPartialSuccess *message, + void *closure_data); + +/* --- services --- */ + +typedef struct Opentelemetry__Proto__Collector__Metrics__V1__MetricsService_Service Opentelemetry__Proto__Collector__Metrics__V1__MetricsService_Service; +struct Opentelemetry__Proto__Collector__Metrics__V1__MetricsService_Service +{ + ProtobufCService base; + void (*export)(Opentelemetry__Proto__Collector__Metrics__V1__MetricsService_Service *service, + const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *input, + Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse_Closure closure, + void *closure_data); +}; +typedef void (*Opentelemetry__Proto__Collector__Metrics__V1__MetricsService_ServiceDestroy)(Opentelemetry__Proto__Collector__Metrics__V1__MetricsService_Service *); +void opentelemetry__proto__collector__metrics__v1__metrics_service__init (Opentelemetry__Proto__Collector__Metrics__V1__MetricsService_Service *service, + Opentelemetry__Proto__Collector__Metrics__V1__MetricsService_ServiceDestroy destroy); +#define OPENTELEMETRY__PROTO__COLLECTOR__METRICS__V1__METRICS_SERVICE__BASE_INIT \ + { &opentelemetry__proto__collector__metrics__v1__metrics_service__descriptor, protobuf_c_service_invoke_internal, NULL } +#define OPENTELEMETRY__PROTO__COLLECTOR__METRICS__V1__METRICS_SERVICE__INIT(function_prefix__) \ + { OPENTELEMETRY__PROTO__COLLECTOR__METRICS__V1__METRICS_SERVICE__BASE_INIT,\ + function_prefix__ ## export } +void opentelemetry__proto__collector__metrics__v1__metrics_service__export(ProtobufCService *service, + const Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceRequest *input, + Opentelemetry__Proto__Collector__Metrics__V1__ExportMetricsServiceResponse_Closure closure, + void *closure_data); + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor opentelemetry__proto__collector__metrics__v1__export_metrics_service_request__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__collector__metrics__v1__export_metrics_service_response__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__collector__metrics__v1__export_metrics_partial_success__descriptor; +extern const ProtobufCServiceDescriptor opentelemetry__proto__collector__metrics__v1__metrics_service__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_opentelemetry_2fproto_2fcollector_2fmetrics_2fv1_2fmetrics_5fservice_2eproto__INCLUDED */ diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/trace/v1/trace_service.pb-c.c b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/trace/v1/trace_service.pb-c.c new file mode 100644 index 000000000..e703b9d25 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/trace/v1/trace_service.pb-c.c @@ -0,0 +1,304 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/collector/trace/v1/trace_service.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "opentelemetry/proto/collector/trace/v1/trace_service.pb-c.h" +void opentelemetry__proto__collector__trace__v1__export_trace_service_request__init + (Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *message) +{ + static const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest init_value = OPENTELEMETRY__PROTO__COLLECTOR__TRACE__V1__EXPORT_TRACE_SERVICE_REQUEST__INIT; + *message = init_value; +} +size_t opentelemetry__proto__collector__trace__v1__export_trace_service_request__get_packed_size + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__trace__v1__export_trace_service_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__collector__trace__v1__export_trace_service_request__pack + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__trace__v1__export_trace_service_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__collector__trace__v1__export_trace_service_request__pack_to_buffer + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__trace__v1__export_trace_service_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest * + opentelemetry__proto__collector__trace__v1__export_trace_service_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *) + protobuf_c_message_unpack (&opentelemetry__proto__collector__trace__v1__export_trace_service_request__descriptor, + allocator, len, data); +} +void opentelemetry__proto__collector__trace__v1__export_trace_service_request__free_unpacked + (Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__collector__trace__v1__export_trace_service_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__collector__trace__v1__export_trace_service_response__init + (Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse *message) +{ + static const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse init_value = OPENTELEMETRY__PROTO__COLLECTOR__TRACE__V1__EXPORT_TRACE_SERVICE_RESPONSE__INIT; + *message = init_value; +} +size_t opentelemetry__proto__collector__trace__v1__export_trace_service_response__get_packed_size + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__trace__v1__export_trace_service_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__collector__trace__v1__export_trace_service_response__pack + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__trace__v1__export_trace_service_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__collector__trace__v1__export_trace_service_response__pack_to_buffer + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__trace__v1__export_trace_service_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse * + opentelemetry__proto__collector__trace__v1__export_trace_service_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse *) + protobuf_c_message_unpack (&opentelemetry__proto__collector__trace__v1__export_trace_service_response__descriptor, + allocator, len, data); +} +void opentelemetry__proto__collector__trace__v1__export_trace_service_response__free_unpacked + (Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__collector__trace__v1__export_trace_service_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__collector__trace__v1__export_trace_partial_success__init + (Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess *message) +{ + static const Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess init_value = OPENTELEMETRY__PROTO__COLLECTOR__TRACE__V1__EXPORT_TRACE_PARTIAL_SUCCESS__INIT; + *message = init_value; +} +size_t opentelemetry__proto__collector__trace__v1__export_trace_partial_success__get_packed_size + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__trace__v1__export_trace_partial_success__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__collector__trace__v1__export_trace_partial_success__pack + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__trace__v1__export_trace_partial_success__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__collector__trace__v1__export_trace_partial_success__pack_to_buffer + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__collector__trace__v1__export_trace_partial_success__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess * + opentelemetry__proto__collector__trace__v1__export_trace_partial_success__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess *) + protobuf_c_message_unpack (&opentelemetry__proto__collector__trace__v1__export_trace_partial_success__descriptor, + allocator, len, data); +} +void opentelemetry__proto__collector__trace__v1__export_trace_partial_success__free_unpacked + (Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__collector__trace__v1__export_trace_partial_success__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor opentelemetry__proto__collector__trace__v1__export_trace_service_request__field_descriptors[1] = +{ + { + "resource_spans", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest, n_resource_spans), + offsetof(Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest, resource_spans), + &opentelemetry__proto__trace__v1__resource_spans__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__collector__trace__v1__export_trace_service_request__field_indices_by_name[] = { + 0, /* field[0] = resource_spans */ +}; +static const ProtobufCIntRange opentelemetry__proto__collector__trace__v1__export_trace_service_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__collector__trace__v1__export_trace_service_request__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest", + "ExportTraceServiceRequest", + "Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest", + "opentelemetry.proto.collector.trace.v1", + sizeof(Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest), + 1, + opentelemetry__proto__collector__trace__v1__export_trace_service_request__field_descriptors, + opentelemetry__proto__collector__trace__v1__export_trace_service_request__field_indices_by_name, + 1, opentelemetry__proto__collector__trace__v1__export_trace_service_request__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__collector__trace__v1__export_trace_service_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__collector__trace__v1__export_trace_service_response__field_descriptors[1] = +{ + { + "partial_success", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse, partial_success), + &opentelemetry__proto__collector__trace__v1__export_trace_partial_success__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__collector__trace__v1__export_trace_service_response__field_indices_by_name[] = { + 0, /* field[0] = partial_success */ +}; +static const ProtobufCIntRange opentelemetry__proto__collector__trace__v1__export_trace_service_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__collector__trace__v1__export_trace_service_response__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse", + "ExportTraceServiceResponse", + "Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse", + "opentelemetry.proto.collector.trace.v1", + sizeof(Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse), + 1, + opentelemetry__proto__collector__trace__v1__export_trace_service_response__field_descriptors, + opentelemetry__proto__collector__trace__v1__export_trace_service_response__field_indices_by_name, + 1, opentelemetry__proto__collector__trace__v1__export_trace_service_response__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__collector__trace__v1__export_trace_service_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__collector__trace__v1__export_trace_partial_success__field_descriptors[2] = +{ + { + "rejected_spans", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess, rejected_spans), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "error_message", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess, error_message), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__collector__trace__v1__export_trace_partial_success__field_indices_by_name[] = { + 1, /* field[1] = error_message */ + 0, /* field[0] = rejected_spans */ +}; +static const ProtobufCIntRange opentelemetry__proto__collector__trace__v1__export_trace_partial_success__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__collector__trace__v1__export_trace_partial_success__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.collector.trace.v1.ExportTracePartialSuccess", + "ExportTracePartialSuccess", + "Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess", + "opentelemetry.proto.collector.trace.v1", + sizeof(Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess), + 2, + opentelemetry__proto__collector__trace__v1__export_trace_partial_success__field_descriptors, + opentelemetry__proto__collector__trace__v1__export_trace_partial_success__field_indices_by_name, + 1, opentelemetry__proto__collector__trace__v1__export_trace_partial_success__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__collector__trace__v1__export_trace_partial_success__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCMethodDescriptor opentelemetry__proto__collector__trace__v1__trace_service__method_descriptors[1] = +{ + { "Export", &opentelemetry__proto__collector__trace__v1__export_trace_service_request__descriptor, &opentelemetry__proto__collector__trace__v1__export_trace_service_response__descriptor }, +}; +const unsigned opentelemetry__proto__collector__trace__v1__trace_service__method_indices_by_name[] = { + 0 /* Export */ +}; +const ProtobufCServiceDescriptor opentelemetry__proto__collector__trace__v1__trace_service__descriptor = +{ + PROTOBUF_C__SERVICE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.collector.trace.v1.TraceService", + "TraceService", + "Opentelemetry__Proto__Collector__Trace__V1__TraceService", + "opentelemetry.proto.collector.trace.v1", + 1, + opentelemetry__proto__collector__trace__v1__trace_service__method_descriptors, + opentelemetry__proto__collector__trace__v1__trace_service__method_indices_by_name +}; +void opentelemetry__proto__collector__trace__v1__trace_service__export(ProtobufCService *service, + const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *input, + Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse_Closure closure, + void *closure_data) +{ + assert(service->descriptor == &opentelemetry__proto__collector__trace__v1__trace_service__descriptor); + service->invoke(service, 0, (const ProtobufCMessage *) input, (ProtobufCClosure) closure, closure_data); +} +void opentelemetry__proto__collector__trace__v1__trace_service__init (Opentelemetry__Proto__Collector__Trace__V1__TraceService_Service *service, + Opentelemetry__Proto__Collector__Trace__V1__TraceService_ServiceDestroy destroy) +{ + protobuf_c_service_generated_init (&service->base, + &opentelemetry__proto__collector__trace__v1__trace_service__descriptor, + (ProtobufCServiceDestroy) destroy); +} diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/trace/v1/trace_service.pb-c.h b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/trace/v1/trace_service.pb-c.h new file mode 100644 index 000000000..35f5fdb18 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/collector/trace/v1/trace_service.pb-c.h @@ -0,0 +1,198 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/collector/trace/v1/trace_service.proto */ + +#ifndef PROTOBUF_C_opentelemetry_2fproto_2fcollector_2ftrace_2fv1_2ftrace_5fservice_2eproto__INCLUDED +#define PROTOBUF_C_opentelemetry_2fproto_2fcollector_2ftrace_2fv1_2ftrace_5fservice_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1004001 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + +#include "opentelemetry/proto/trace/v1/trace.pb-c.h" + +typedef struct Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest; +typedef struct Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse; +typedef struct Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest +{ + ProtobufCMessage base; + /* + * An array of ResourceSpans. + * For data coming from a single resource this array will typically contain one + * element. Intermediary nodes (such as OpenTelemetry Collector) that receive + * data from multiple origins typically batch the data before forwarding further and + * in that case this array will contain multiple elements. + */ + size_t n_resource_spans; + Opentelemetry__Proto__Trace__V1__ResourceSpans **resource_spans; +}; +#define OPENTELEMETRY__PROTO__COLLECTOR__TRACE__V1__EXPORT_TRACE_SERVICE_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__collector__trace__v1__export_trace_service_request__descriptor) \ + , 0,NULL } + + +struct Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse +{ + ProtobufCMessage base; + /* + * The details of a partially successful export request. + * If the request is only partially accepted + * (i.e. when the server accepts only parts of the data and rejects the rest) + * the server MUST initialize the `partial_success` field and MUST + * set the `rejected_<signal>` with the number of items it rejected. + * Servers MAY also make use of the `partial_success` field to convey + * warnings/suggestions to senders even when the request was fully accepted. + * In such cases, the `rejected_<signal>` MUST have a value of `0` and + * the `error_message` MUST be non-empty. + * A `partial_success` message with an empty value (rejected_<signal> = 0 and + * `error_message` = "") is equivalent to it not being set/present. Senders + * SHOULD interpret it the same way as in the full success case. + */ + Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess *partial_success; +}; +#define OPENTELEMETRY__PROTO__COLLECTOR__TRACE__V1__EXPORT_TRACE_SERVICE_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__collector__trace__v1__export_trace_service_response__descriptor) \ + , NULL } + + +struct Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess +{ + ProtobufCMessage base; + /* + * The number of rejected spans. + * A `rejected_<signal>` field holding a `0` value indicates that the + * request was fully accepted. + */ + int64_t rejected_spans; + /* + * A developer-facing human-readable message in English. It should be used + * either to explain why the server rejected parts of the data during a partial + * success or to convey warnings/suggestions during a full success. The message + * should offer guidance on how users can address such issues. + * error_message is an optional field. An error_message with an empty value + * is equivalent to it not being set. + */ + char *error_message; +}; +#define OPENTELEMETRY__PROTO__COLLECTOR__TRACE__V1__EXPORT_TRACE_PARTIAL_SUCCESS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__collector__trace__v1__export_trace_partial_success__descriptor) \ + , 0, (char *)protobuf_c_empty_string } + + +/* Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest methods */ +void opentelemetry__proto__collector__trace__v1__export_trace_service_request__init + (Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *message); +size_t opentelemetry__proto__collector__trace__v1__export_trace_service_request__get_packed_size + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *message); +size_t opentelemetry__proto__collector__trace__v1__export_trace_service_request__pack + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *message, + uint8_t *out); +size_t opentelemetry__proto__collector__trace__v1__export_trace_service_request__pack_to_buffer + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest * + opentelemetry__proto__collector__trace__v1__export_trace_service_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__collector__trace__v1__export_trace_service_request__free_unpacked + (Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse methods */ +void opentelemetry__proto__collector__trace__v1__export_trace_service_response__init + (Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse *message); +size_t opentelemetry__proto__collector__trace__v1__export_trace_service_response__get_packed_size + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse *message); +size_t opentelemetry__proto__collector__trace__v1__export_trace_service_response__pack + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse *message, + uint8_t *out); +size_t opentelemetry__proto__collector__trace__v1__export_trace_service_response__pack_to_buffer + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse * + opentelemetry__proto__collector__trace__v1__export_trace_service_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__collector__trace__v1__export_trace_service_response__free_unpacked + (Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess methods */ +void opentelemetry__proto__collector__trace__v1__export_trace_partial_success__init + (Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess *message); +size_t opentelemetry__proto__collector__trace__v1__export_trace_partial_success__get_packed_size + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess *message); +size_t opentelemetry__proto__collector__trace__v1__export_trace_partial_success__pack + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess *message, + uint8_t *out); +size_t opentelemetry__proto__collector__trace__v1__export_trace_partial_success__pack_to_buffer + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess * + opentelemetry__proto__collector__trace__v1__export_trace_partial_success__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__collector__trace__v1__export_trace_partial_success__free_unpacked + (Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest_Closure) + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse_Closure) + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess_Closure) + (const Opentelemetry__Proto__Collector__Trace__V1__ExportTracePartialSuccess *message, + void *closure_data); + +/* --- services --- */ + +typedef struct Opentelemetry__Proto__Collector__Trace__V1__TraceService_Service Opentelemetry__Proto__Collector__Trace__V1__TraceService_Service; +struct Opentelemetry__Proto__Collector__Trace__V1__TraceService_Service +{ + ProtobufCService base; + void (*export)(Opentelemetry__Proto__Collector__Trace__V1__TraceService_Service *service, + const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *input, + Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse_Closure closure, + void *closure_data); +}; +typedef void (*Opentelemetry__Proto__Collector__Trace__V1__TraceService_ServiceDestroy)(Opentelemetry__Proto__Collector__Trace__V1__TraceService_Service *); +void opentelemetry__proto__collector__trace__v1__trace_service__init (Opentelemetry__Proto__Collector__Trace__V1__TraceService_Service *service, + Opentelemetry__Proto__Collector__Trace__V1__TraceService_ServiceDestroy destroy); +#define OPENTELEMETRY__PROTO__COLLECTOR__TRACE__V1__TRACE_SERVICE__BASE_INIT \ + { &opentelemetry__proto__collector__trace__v1__trace_service__descriptor, protobuf_c_service_invoke_internal, NULL } +#define OPENTELEMETRY__PROTO__COLLECTOR__TRACE__V1__TRACE_SERVICE__INIT(function_prefix__) \ + { OPENTELEMETRY__PROTO__COLLECTOR__TRACE__V1__TRACE_SERVICE__BASE_INIT,\ + function_prefix__ ## export } +void opentelemetry__proto__collector__trace__v1__trace_service__export(ProtobufCService *service, + const Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceRequest *input, + Opentelemetry__Proto__Collector__Trace__V1__ExportTraceServiceResponse_Closure closure, + void *closure_data); + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor opentelemetry__proto__collector__trace__v1__export_trace_service_request__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__collector__trace__v1__export_trace_service_response__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__collector__trace__v1__export_trace_partial_success__descriptor; +extern const ProtobufCServiceDescriptor opentelemetry__proto__collector__trace__v1__trace_service__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_opentelemetry_2fproto_2fcollector_2ftrace_2fv1_2ftrace_5fservice_2eproto__INCLUDED */ diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/common/v1/common.pb-c.c b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/common/v1/common.pb-c.c new file mode 100644 index 000000000..8937ccc2e --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/common/v1/common.pb-c.c @@ -0,0 +1,554 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/common/v1/common.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "opentelemetry/proto/common/v1/common.pb-c.h" +void opentelemetry__proto__common__v1__any_value__init + (Opentelemetry__Proto__Common__V1__AnyValue *message) +{ + static const Opentelemetry__Proto__Common__V1__AnyValue init_value = OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__INIT; + *message = init_value; +} +size_t opentelemetry__proto__common__v1__any_value__get_packed_size + (const Opentelemetry__Proto__Common__V1__AnyValue *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__any_value__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__common__v1__any_value__pack + (const Opentelemetry__Proto__Common__V1__AnyValue *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__any_value__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__common__v1__any_value__pack_to_buffer + (const Opentelemetry__Proto__Common__V1__AnyValue *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__any_value__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Common__V1__AnyValue * + opentelemetry__proto__common__v1__any_value__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Common__V1__AnyValue *) + protobuf_c_message_unpack (&opentelemetry__proto__common__v1__any_value__descriptor, + allocator, len, data); +} +void opentelemetry__proto__common__v1__any_value__free_unpacked + (Opentelemetry__Proto__Common__V1__AnyValue *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__common__v1__any_value__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__common__v1__array_value__init + (Opentelemetry__Proto__Common__V1__ArrayValue *message) +{ + static const Opentelemetry__Proto__Common__V1__ArrayValue init_value = OPENTELEMETRY__PROTO__COMMON__V1__ARRAY_VALUE__INIT; + *message = init_value; +} +size_t opentelemetry__proto__common__v1__array_value__get_packed_size + (const Opentelemetry__Proto__Common__V1__ArrayValue *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__array_value__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__common__v1__array_value__pack + (const Opentelemetry__Proto__Common__V1__ArrayValue *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__array_value__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__common__v1__array_value__pack_to_buffer + (const Opentelemetry__Proto__Common__V1__ArrayValue *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__array_value__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Common__V1__ArrayValue * + opentelemetry__proto__common__v1__array_value__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Common__V1__ArrayValue *) + protobuf_c_message_unpack (&opentelemetry__proto__common__v1__array_value__descriptor, + allocator, len, data); +} +void opentelemetry__proto__common__v1__array_value__free_unpacked + (Opentelemetry__Proto__Common__V1__ArrayValue *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__common__v1__array_value__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__common__v1__key_value_list__init + (Opentelemetry__Proto__Common__V1__KeyValueList *message) +{ + static const Opentelemetry__Proto__Common__V1__KeyValueList init_value = OPENTELEMETRY__PROTO__COMMON__V1__KEY_VALUE_LIST__INIT; + *message = init_value; +} +size_t opentelemetry__proto__common__v1__key_value_list__get_packed_size + (const Opentelemetry__Proto__Common__V1__KeyValueList *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__key_value_list__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__common__v1__key_value_list__pack + (const Opentelemetry__Proto__Common__V1__KeyValueList *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__key_value_list__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__common__v1__key_value_list__pack_to_buffer + (const Opentelemetry__Proto__Common__V1__KeyValueList *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__key_value_list__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Common__V1__KeyValueList * + opentelemetry__proto__common__v1__key_value_list__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Common__V1__KeyValueList *) + protobuf_c_message_unpack (&opentelemetry__proto__common__v1__key_value_list__descriptor, + allocator, len, data); +} +void opentelemetry__proto__common__v1__key_value_list__free_unpacked + (Opentelemetry__Proto__Common__V1__KeyValueList *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__common__v1__key_value_list__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__common__v1__key_value__init + (Opentelemetry__Proto__Common__V1__KeyValue *message) +{ + static const Opentelemetry__Proto__Common__V1__KeyValue init_value = OPENTELEMETRY__PROTO__COMMON__V1__KEY_VALUE__INIT; + *message = init_value; +} +size_t opentelemetry__proto__common__v1__key_value__get_packed_size + (const Opentelemetry__Proto__Common__V1__KeyValue *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__key_value__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__common__v1__key_value__pack + (const Opentelemetry__Proto__Common__V1__KeyValue *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__key_value__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__common__v1__key_value__pack_to_buffer + (const Opentelemetry__Proto__Common__V1__KeyValue *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__key_value__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Common__V1__KeyValue * + opentelemetry__proto__common__v1__key_value__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Common__V1__KeyValue *) + protobuf_c_message_unpack (&opentelemetry__proto__common__v1__key_value__descriptor, + allocator, len, data); +} +void opentelemetry__proto__common__v1__key_value__free_unpacked + (Opentelemetry__Proto__Common__V1__KeyValue *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__common__v1__key_value__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__common__v1__instrumentation_scope__init + (Opentelemetry__Proto__Common__V1__InstrumentationScope *message) +{ + static const Opentelemetry__Proto__Common__V1__InstrumentationScope init_value = OPENTELEMETRY__PROTO__COMMON__V1__INSTRUMENTATION_SCOPE__INIT; + *message = init_value; +} +size_t opentelemetry__proto__common__v1__instrumentation_scope__get_packed_size + (const Opentelemetry__Proto__Common__V1__InstrumentationScope *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__instrumentation_scope__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__common__v1__instrumentation_scope__pack + (const Opentelemetry__Proto__Common__V1__InstrumentationScope *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__instrumentation_scope__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__common__v1__instrumentation_scope__pack_to_buffer + (const Opentelemetry__Proto__Common__V1__InstrumentationScope *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__common__v1__instrumentation_scope__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Common__V1__InstrumentationScope * + opentelemetry__proto__common__v1__instrumentation_scope__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Common__V1__InstrumentationScope *) + protobuf_c_message_unpack (&opentelemetry__proto__common__v1__instrumentation_scope__descriptor, + allocator, len, data); +} +void opentelemetry__proto__common__v1__instrumentation_scope__free_unpacked + (Opentelemetry__Proto__Common__V1__InstrumentationScope *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__common__v1__instrumentation_scope__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor opentelemetry__proto__common__v1__any_value__field_descriptors[7] = +{ + { + "string_value", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, value_case), + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, string_value), + NULL, + &protobuf_c_empty_string, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "bool_value", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, value_case), + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, bool_value), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "int_value", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_INT64, + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, value_case), + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, int_value), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "double_value", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, value_case), + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, double_value), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "array_value", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, value_case), + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, array_value), + &opentelemetry__proto__common__v1__array_value__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "kvlist_value", + 6, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, value_case), + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, kvlist_value), + &opentelemetry__proto__common__v1__key_value_list__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "bytes_value", + 7, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BYTES, + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, value_case), + offsetof(Opentelemetry__Proto__Common__V1__AnyValue, bytes_value), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__common__v1__any_value__field_indices_by_name[] = { + 4, /* field[4] = array_value */ + 1, /* field[1] = bool_value */ + 6, /* field[6] = bytes_value */ + 3, /* field[3] = double_value */ + 2, /* field[2] = int_value */ + 5, /* field[5] = kvlist_value */ + 0, /* field[0] = string_value */ +}; +static const ProtobufCIntRange opentelemetry__proto__common__v1__any_value__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 7 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__common__v1__any_value__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.common.v1.AnyValue", + "AnyValue", + "Opentelemetry__Proto__Common__V1__AnyValue", + "opentelemetry.proto.common.v1", + sizeof(Opentelemetry__Proto__Common__V1__AnyValue), + 7, + opentelemetry__proto__common__v1__any_value__field_descriptors, + opentelemetry__proto__common__v1__any_value__field_indices_by_name, + 1, opentelemetry__proto__common__v1__any_value__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__common__v1__any_value__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__common__v1__array_value__field_descriptors[1] = +{ + { + "values", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Common__V1__ArrayValue, n_values), + offsetof(Opentelemetry__Proto__Common__V1__ArrayValue, values), + &opentelemetry__proto__common__v1__any_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__common__v1__array_value__field_indices_by_name[] = { + 0, /* field[0] = values */ +}; +static const ProtobufCIntRange opentelemetry__proto__common__v1__array_value__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__common__v1__array_value__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.common.v1.ArrayValue", + "ArrayValue", + "Opentelemetry__Proto__Common__V1__ArrayValue", + "opentelemetry.proto.common.v1", + sizeof(Opentelemetry__Proto__Common__V1__ArrayValue), + 1, + opentelemetry__proto__common__v1__array_value__field_descriptors, + opentelemetry__proto__common__v1__array_value__field_indices_by_name, + 1, opentelemetry__proto__common__v1__array_value__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__common__v1__array_value__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__common__v1__key_value_list__field_descriptors[1] = +{ + { + "values", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Common__V1__KeyValueList, n_values), + offsetof(Opentelemetry__Proto__Common__V1__KeyValueList, values), + &opentelemetry__proto__common__v1__key_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__common__v1__key_value_list__field_indices_by_name[] = { + 0, /* field[0] = values */ +}; +static const ProtobufCIntRange opentelemetry__proto__common__v1__key_value_list__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__common__v1__key_value_list__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.common.v1.KeyValueList", + "KeyValueList", + "Opentelemetry__Proto__Common__V1__KeyValueList", + "opentelemetry.proto.common.v1", + sizeof(Opentelemetry__Proto__Common__V1__KeyValueList), + 1, + opentelemetry__proto__common__v1__key_value_list__field_descriptors, + opentelemetry__proto__common__v1__key_value_list__field_indices_by_name, + 1, opentelemetry__proto__common__v1__key_value_list__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__common__v1__key_value_list__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__common__v1__key_value__field_descriptors[2] = +{ + { + "key", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Common__V1__KeyValue, key), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "value", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Common__V1__KeyValue, value), + &opentelemetry__proto__common__v1__any_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__common__v1__key_value__field_indices_by_name[] = { + 0, /* field[0] = key */ + 1, /* field[1] = value */ +}; +static const ProtobufCIntRange opentelemetry__proto__common__v1__key_value__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__common__v1__key_value__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.common.v1.KeyValue", + "KeyValue", + "Opentelemetry__Proto__Common__V1__KeyValue", + "opentelemetry.proto.common.v1", + sizeof(Opentelemetry__Proto__Common__V1__KeyValue), + 2, + opentelemetry__proto__common__v1__key_value__field_descriptors, + opentelemetry__proto__common__v1__key_value__field_indices_by_name, + 1, opentelemetry__proto__common__v1__key_value__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__common__v1__key_value__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__common__v1__instrumentation_scope__field_descriptors[4] = +{ + { + "name", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Common__V1__InstrumentationScope, name), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "version", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Common__V1__InstrumentationScope, version), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "attributes", + 3, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Common__V1__InstrumentationScope, n_attributes), + offsetof(Opentelemetry__Proto__Common__V1__InstrumentationScope, attributes), + &opentelemetry__proto__common__v1__key_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dropped_attributes_count", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Common__V1__InstrumentationScope, dropped_attributes_count), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__common__v1__instrumentation_scope__field_indices_by_name[] = { + 2, /* field[2] = attributes */ + 3, /* field[3] = dropped_attributes_count */ + 0, /* field[0] = name */ + 1, /* field[1] = version */ +}; +static const ProtobufCIntRange opentelemetry__proto__common__v1__instrumentation_scope__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 4 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__common__v1__instrumentation_scope__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.common.v1.InstrumentationScope", + "InstrumentationScope", + "Opentelemetry__Proto__Common__V1__InstrumentationScope", + "opentelemetry.proto.common.v1", + sizeof(Opentelemetry__Proto__Common__V1__InstrumentationScope), + 4, + opentelemetry__proto__common__v1__instrumentation_scope__field_descriptors, + opentelemetry__proto__common__v1__instrumentation_scope__field_indices_by_name, + 1, opentelemetry__proto__common__v1__instrumentation_scope__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__common__v1__instrumentation_scope__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/common/v1/common.pb-c.h b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/common/v1/common.pb-c.h new file mode 100644 index 000000000..d13169c26 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/common/v1/common.pb-c.h @@ -0,0 +1,271 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/common/v1/common.proto */ + +#ifndef PROTOBUF_C_opentelemetry_2fproto_2fcommon_2fv1_2fcommon_2eproto__INCLUDED +#define PROTOBUF_C_opentelemetry_2fproto_2fcommon_2fv1_2fcommon_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1004001 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + + +typedef struct Opentelemetry__Proto__Common__V1__AnyValue Opentelemetry__Proto__Common__V1__AnyValue; +typedef struct Opentelemetry__Proto__Common__V1__ArrayValue Opentelemetry__Proto__Common__V1__ArrayValue; +typedef struct Opentelemetry__Proto__Common__V1__KeyValueList Opentelemetry__Proto__Common__V1__KeyValueList; +typedef struct Opentelemetry__Proto__Common__V1__KeyValue Opentelemetry__Proto__Common__V1__KeyValue; +typedef struct Opentelemetry__Proto__Common__V1__InstrumentationScope Opentelemetry__Proto__Common__V1__InstrumentationScope; + + +/* --- enums --- */ + + +/* --- messages --- */ + +typedef enum { + OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE__NOT_SET = 0, + OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_STRING_VALUE = 1, + OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_BOOL_VALUE = 2, + OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_INT_VALUE = 3, + OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_DOUBLE_VALUE = 4, + OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_ARRAY_VALUE = 5, + OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_KVLIST_VALUE = 6, + OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_BYTES_VALUE = 7 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE__CASE) +} Opentelemetry__Proto__Common__V1__AnyValue__ValueCase; + +/* + * AnyValue is used to represent any type of attribute value. AnyValue may contain a + * primitive value such as a string or integer or it may contain an arbitrary nested + * object containing arrays, key-value lists and primitives. + */ +struct Opentelemetry__Proto__Common__V1__AnyValue +{ + ProtobufCMessage base; + Opentelemetry__Proto__Common__V1__AnyValue__ValueCase value_case; + union { + char *string_value; + protobuf_c_boolean bool_value; + int64_t int_value; + double double_value; + Opentelemetry__Proto__Common__V1__ArrayValue *array_value; + Opentelemetry__Proto__Common__V1__KeyValueList *kvlist_value; + ProtobufCBinaryData bytes_value; + }; +}; +#define OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__common__v1__any_value__descriptor) \ + , OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE__NOT_SET, {0} } + + +/* + * ArrayValue is a list of AnyValue messages. We need ArrayValue as a message + * since oneof in AnyValue does not allow repeated fields. + */ +struct Opentelemetry__Proto__Common__V1__ArrayValue +{ + ProtobufCMessage base; + /* + * Array of values. The array may be empty (contain 0 elements). + */ + size_t n_values; + Opentelemetry__Proto__Common__V1__AnyValue **values; +}; +#define OPENTELEMETRY__PROTO__COMMON__V1__ARRAY_VALUE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__common__v1__array_value__descriptor) \ + , 0,NULL } + + +/* + * KeyValueList is a list of KeyValue messages. We need KeyValueList as a message + * since `oneof` in AnyValue does not allow repeated fields. Everywhere else where we need + * a list of KeyValue messages (e.g. in Span) we use `repeated KeyValue` directly to + * avoid unnecessary extra wrapping (which slows down the protocol). The 2 approaches + * are semantically equivalent. + */ +struct Opentelemetry__Proto__Common__V1__KeyValueList +{ + ProtobufCMessage base; + /* + * A collection of key/value pairs of key-value pairs. The list may be empty (may + * contain 0 elements). + * The keys MUST be unique (it is not allowed to have more than one + * value with the same key). + */ + size_t n_values; + Opentelemetry__Proto__Common__V1__KeyValue **values; +}; +#define OPENTELEMETRY__PROTO__COMMON__V1__KEY_VALUE_LIST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__common__v1__key_value_list__descriptor) \ + , 0,NULL } + + +/* + * KeyValue is a key-value pair that is used to store Span attributes, Link + * attributes, etc. + */ +struct Opentelemetry__Proto__Common__V1__KeyValue +{ + ProtobufCMessage base; + char *key; + Opentelemetry__Proto__Common__V1__AnyValue *value; +}; +#define OPENTELEMETRY__PROTO__COMMON__V1__KEY_VALUE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__common__v1__key_value__descriptor) \ + , (char *)protobuf_c_empty_string, NULL } + + +/* + * InstrumentationScope is a message representing the instrumentation scope information + * such as the fully qualified name and version. + */ +struct Opentelemetry__Proto__Common__V1__InstrumentationScope +{ + ProtobufCMessage base; + /* + * An empty instrumentation scope name means the name is unknown. + */ + char *name; + char *version; + size_t n_attributes; + Opentelemetry__Proto__Common__V1__KeyValue **attributes; + uint32_t dropped_attributes_count; +}; +#define OPENTELEMETRY__PROTO__COMMON__V1__INSTRUMENTATION_SCOPE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__common__v1__instrumentation_scope__descriptor) \ + , (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, 0,NULL, 0 } + + +/* Opentelemetry__Proto__Common__V1__AnyValue methods */ +void opentelemetry__proto__common__v1__any_value__init + (Opentelemetry__Proto__Common__V1__AnyValue *message); +size_t opentelemetry__proto__common__v1__any_value__get_packed_size + (const Opentelemetry__Proto__Common__V1__AnyValue *message); +size_t opentelemetry__proto__common__v1__any_value__pack + (const Opentelemetry__Proto__Common__V1__AnyValue *message, + uint8_t *out); +size_t opentelemetry__proto__common__v1__any_value__pack_to_buffer + (const Opentelemetry__Proto__Common__V1__AnyValue *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Common__V1__AnyValue * + opentelemetry__proto__common__v1__any_value__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__common__v1__any_value__free_unpacked + (Opentelemetry__Proto__Common__V1__AnyValue *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Common__V1__ArrayValue methods */ +void opentelemetry__proto__common__v1__array_value__init + (Opentelemetry__Proto__Common__V1__ArrayValue *message); +size_t opentelemetry__proto__common__v1__array_value__get_packed_size + (const Opentelemetry__Proto__Common__V1__ArrayValue *message); +size_t opentelemetry__proto__common__v1__array_value__pack + (const Opentelemetry__Proto__Common__V1__ArrayValue *message, + uint8_t *out); +size_t opentelemetry__proto__common__v1__array_value__pack_to_buffer + (const Opentelemetry__Proto__Common__V1__ArrayValue *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Common__V1__ArrayValue * + opentelemetry__proto__common__v1__array_value__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__common__v1__array_value__free_unpacked + (Opentelemetry__Proto__Common__V1__ArrayValue *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Common__V1__KeyValueList methods */ +void opentelemetry__proto__common__v1__key_value_list__init + (Opentelemetry__Proto__Common__V1__KeyValueList *message); +size_t opentelemetry__proto__common__v1__key_value_list__get_packed_size + (const Opentelemetry__Proto__Common__V1__KeyValueList *message); +size_t opentelemetry__proto__common__v1__key_value_list__pack + (const Opentelemetry__Proto__Common__V1__KeyValueList *message, + uint8_t *out); +size_t opentelemetry__proto__common__v1__key_value_list__pack_to_buffer + (const Opentelemetry__Proto__Common__V1__KeyValueList *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Common__V1__KeyValueList * + opentelemetry__proto__common__v1__key_value_list__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__common__v1__key_value_list__free_unpacked + (Opentelemetry__Proto__Common__V1__KeyValueList *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Common__V1__KeyValue methods */ +void opentelemetry__proto__common__v1__key_value__init + (Opentelemetry__Proto__Common__V1__KeyValue *message); +size_t opentelemetry__proto__common__v1__key_value__get_packed_size + (const Opentelemetry__Proto__Common__V1__KeyValue *message); +size_t opentelemetry__proto__common__v1__key_value__pack + (const Opentelemetry__Proto__Common__V1__KeyValue *message, + uint8_t *out); +size_t opentelemetry__proto__common__v1__key_value__pack_to_buffer + (const Opentelemetry__Proto__Common__V1__KeyValue *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Common__V1__KeyValue * + opentelemetry__proto__common__v1__key_value__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__common__v1__key_value__free_unpacked + (Opentelemetry__Proto__Common__V1__KeyValue *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Common__V1__InstrumentationScope methods */ +void opentelemetry__proto__common__v1__instrumentation_scope__init + (Opentelemetry__Proto__Common__V1__InstrumentationScope *message); +size_t opentelemetry__proto__common__v1__instrumentation_scope__get_packed_size + (const Opentelemetry__Proto__Common__V1__InstrumentationScope *message); +size_t opentelemetry__proto__common__v1__instrumentation_scope__pack + (const Opentelemetry__Proto__Common__V1__InstrumentationScope *message, + uint8_t *out); +size_t opentelemetry__proto__common__v1__instrumentation_scope__pack_to_buffer + (const Opentelemetry__Proto__Common__V1__InstrumentationScope *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Common__V1__InstrumentationScope * + opentelemetry__proto__common__v1__instrumentation_scope__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__common__v1__instrumentation_scope__free_unpacked + (Opentelemetry__Proto__Common__V1__InstrumentationScope *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*Opentelemetry__Proto__Common__V1__AnyValue_Closure) + (const Opentelemetry__Proto__Common__V1__AnyValue *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Common__V1__ArrayValue_Closure) + (const Opentelemetry__Proto__Common__V1__ArrayValue *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Common__V1__KeyValueList_Closure) + (const Opentelemetry__Proto__Common__V1__KeyValueList *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Common__V1__KeyValue_Closure) + (const Opentelemetry__Proto__Common__V1__KeyValue *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Common__V1__InstrumentationScope_Closure) + (const Opentelemetry__Proto__Common__V1__InstrumentationScope *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor opentelemetry__proto__common__v1__any_value__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__common__v1__array_value__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__common__v1__key_value_list__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__common__v1__key_value__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__common__v1__instrumentation_scope__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_opentelemetry_2fproto_2fcommon_2fv1_2fcommon_2eproto__INCLUDED */ diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/logs/v1/logs.pb-c.c b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/logs/v1/logs.pb-c.c new file mode 100644 index 000000000..124f76628 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/logs/v1/logs.pb-c.c @@ -0,0 +1,613 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/logs/v1/logs.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "opentelemetry/proto/logs/v1/logs.pb-c.h" +void opentelemetry__proto__logs__v1__logs_data__init + (Opentelemetry__Proto__Logs__V1__LogsData *message) +{ + static const Opentelemetry__Proto__Logs__V1__LogsData init_value = OPENTELEMETRY__PROTO__LOGS__V1__LOGS_DATA__INIT; + *message = init_value; +} +size_t opentelemetry__proto__logs__v1__logs_data__get_packed_size + (const Opentelemetry__Proto__Logs__V1__LogsData *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__logs_data__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__logs__v1__logs_data__pack + (const Opentelemetry__Proto__Logs__V1__LogsData *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__logs_data__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__logs__v1__logs_data__pack_to_buffer + (const Opentelemetry__Proto__Logs__V1__LogsData *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__logs_data__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Logs__V1__LogsData * + opentelemetry__proto__logs__v1__logs_data__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Logs__V1__LogsData *) + protobuf_c_message_unpack (&opentelemetry__proto__logs__v1__logs_data__descriptor, + allocator, len, data); +} +void opentelemetry__proto__logs__v1__logs_data__free_unpacked + (Opentelemetry__Proto__Logs__V1__LogsData *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__logs_data__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__logs__v1__resource_logs__init + (Opentelemetry__Proto__Logs__V1__ResourceLogs *message) +{ + static const Opentelemetry__Proto__Logs__V1__ResourceLogs init_value = OPENTELEMETRY__PROTO__LOGS__V1__RESOURCE_LOGS__INIT; + *message = init_value; +} +size_t opentelemetry__proto__logs__v1__resource_logs__get_packed_size + (const Opentelemetry__Proto__Logs__V1__ResourceLogs *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__resource_logs__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__logs__v1__resource_logs__pack + (const Opentelemetry__Proto__Logs__V1__ResourceLogs *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__resource_logs__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__logs__v1__resource_logs__pack_to_buffer + (const Opentelemetry__Proto__Logs__V1__ResourceLogs *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__resource_logs__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Logs__V1__ResourceLogs * + opentelemetry__proto__logs__v1__resource_logs__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Logs__V1__ResourceLogs *) + protobuf_c_message_unpack (&opentelemetry__proto__logs__v1__resource_logs__descriptor, + allocator, len, data); +} +void opentelemetry__proto__logs__v1__resource_logs__free_unpacked + (Opentelemetry__Proto__Logs__V1__ResourceLogs *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__resource_logs__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__logs__v1__scope_logs__init + (Opentelemetry__Proto__Logs__V1__ScopeLogs *message) +{ + static const Opentelemetry__Proto__Logs__V1__ScopeLogs init_value = OPENTELEMETRY__PROTO__LOGS__V1__SCOPE_LOGS__INIT; + *message = init_value; +} +size_t opentelemetry__proto__logs__v1__scope_logs__get_packed_size + (const Opentelemetry__Proto__Logs__V1__ScopeLogs *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__scope_logs__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__logs__v1__scope_logs__pack + (const Opentelemetry__Proto__Logs__V1__ScopeLogs *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__scope_logs__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__logs__v1__scope_logs__pack_to_buffer + (const Opentelemetry__Proto__Logs__V1__ScopeLogs *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__scope_logs__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Logs__V1__ScopeLogs * + opentelemetry__proto__logs__v1__scope_logs__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Logs__V1__ScopeLogs *) + protobuf_c_message_unpack (&opentelemetry__proto__logs__v1__scope_logs__descriptor, + allocator, len, data); +} +void opentelemetry__proto__logs__v1__scope_logs__free_unpacked + (Opentelemetry__Proto__Logs__V1__ScopeLogs *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__scope_logs__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__logs__v1__log_record__init + (Opentelemetry__Proto__Logs__V1__LogRecord *message) +{ + static const Opentelemetry__Proto__Logs__V1__LogRecord init_value = OPENTELEMETRY__PROTO__LOGS__V1__LOG_RECORD__INIT; + *message = init_value; +} +size_t opentelemetry__proto__logs__v1__log_record__get_packed_size + (const Opentelemetry__Proto__Logs__V1__LogRecord *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__log_record__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__logs__v1__log_record__pack + (const Opentelemetry__Proto__Logs__V1__LogRecord *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__log_record__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__logs__v1__log_record__pack_to_buffer + (const Opentelemetry__Proto__Logs__V1__LogRecord *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__log_record__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Logs__V1__LogRecord * + opentelemetry__proto__logs__v1__log_record__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Logs__V1__LogRecord *) + protobuf_c_message_unpack (&opentelemetry__proto__logs__v1__log_record__descriptor, + allocator, len, data); +} +void opentelemetry__proto__logs__v1__log_record__free_unpacked + (Opentelemetry__Proto__Logs__V1__LogRecord *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__logs__v1__log_record__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor opentelemetry__proto__logs__v1__logs_data__field_descriptors[1] = +{ + { + "resource_logs", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Logs__V1__LogsData, n_resource_logs), + offsetof(Opentelemetry__Proto__Logs__V1__LogsData, resource_logs), + &opentelemetry__proto__logs__v1__resource_logs__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__logs__v1__logs_data__field_indices_by_name[] = { + 0, /* field[0] = resource_logs */ +}; +static const ProtobufCIntRange opentelemetry__proto__logs__v1__logs_data__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__logs__v1__logs_data__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.logs.v1.LogsData", + "LogsData", + "Opentelemetry__Proto__Logs__V1__LogsData", + "opentelemetry.proto.logs.v1", + sizeof(Opentelemetry__Proto__Logs__V1__LogsData), + 1, + opentelemetry__proto__logs__v1__logs_data__field_descriptors, + opentelemetry__proto__logs__v1__logs_data__field_indices_by_name, + 1, opentelemetry__proto__logs__v1__logs_data__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__logs__v1__logs_data__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__logs__v1__resource_logs__field_descriptors[3] = +{ + { + "resource", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Logs__V1__ResourceLogs, resource), + &opentelemetry__proto__resource__v1__resource__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "scope_logs", + 2, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Logs__V1__ResourceLogs, n_scope_logs), + offsetof(Opentelemetry__Proto__Logs__V1__ResourceLogs, scope_logs), + &opentelemetry__proto__logs__v1__scope_logs__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "schema_url", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Logs__V1__ResourceLogs, schema_url), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__logs__v1__resource_logs__field_indices_by_name[] = { + 0, /* field[0] = resource */ + 2, /* field[2] = schema_url */ + 1, /* field[1] = scope_logs */ +}; +static const ProtobufCIntRange opentelemetry__proto__logs__v1__resource_logs__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__logs__v1__resource_logs__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.logs.v1.ResourceLogs", + "ResourceLogs", + "Opentelemetry__Proto__Logs__V1__ResourceLogs", + "opentelemetry.proto.logs.v1", + sizeof(Opentelemetry__Proto__Logs__V1__ResourceLogs), + 3, + opentelemetry__proto__logs__v1__resource_logs__field_descriptors, + opentelemetry__proto__logs__v1__resource_logs__field_indices_by_name, + 1, opentelemetry__proto__logs__v1__resource_logs__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__logs__v1__resource_logs__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__logs__v1__scope_logs__field_descriptors[3] = +{ + { + "scope", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Logs__V1__ScopeLogs, scope), + &opentelemetry__proto__common__v1__instrumentation_scope__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "log_records", + 2, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Logs__V1__ScopeLogs, n_log_records), + offsetof(Opentelemetry__Proto__Logs__V1__ScopeLogs, log_records), + &opentelemetry__proto__logs__v1__log_record__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "schema_url", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Logs__V1__ScopeLogs, schema_url), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__logs__v1__scope_logs__field_indices_by_name[] = { + 1, /* field[1] = log_records */ + 2, /* field[2] = schema_url */ + 0, /* field[0] = scope */ +}; +static const ProtobufCIntRange opentelemetry__proto__logs__v1__scope_logs__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__logs__v1__scope_logs__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.logs.v1.ScopeLogs", + "ScopeLogs", + "Opentelemetry__Proto__Logs__V1__ScopeLogs", + "opentelemetry.proto.logs.v1", + sizeof(Opentelemetry__Proto__Logs__V1__ScopeLogs), + 3, + opentelemetry__proto__logs__v1__scope_logs__field_descriptors, + opentelemetry__proto__logs__v1__scope_logs__field_indices_by_name, + 1, opentelemetry__proto__logs__v1__scope_logs__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__logs__v1__scope_logs__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__logs__v1__log_record__field_descriptors[10] = +{ + { + "time_unix_nano", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Logs__V1__LogRecord, time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "severity_number", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Logs__V1__LogRecord, severity_number), + &opentelemetry__proto__logs__v1__severity_number__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "severity_text", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Logs__V1__LogRecord, severity_text), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "body", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Logs__V1__LogRecord, body), + &opentelemetry__proto__common__v1__any_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "attributes", + 6, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Logs__V1__LogRecord, n_attributes), + offsetof(Opentelemetry__Proto__Logs__V1__LogRecord, attributes), + &opentelemetry__proto__common__v1__key_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dropped_attributes_count", + 7, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Logs__V1__LogRecord, dropped_attributes_count), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "flags", + 8, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Logs__V1__LogRecord, flags), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "trace_id", + 9, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BYTES, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Logs__V1__LogRecord, trace_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "span_id", + 10, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BYTES, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Logs__V1__LogRecord, span_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "observed_time_unix_nano", + 11, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Logs__V1__LogRecord, observed_time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__logs__v1__log_record__field_indices_by_name[] = { + 4, /* field[4] = attributes */ + 3, /* field[3] = body */ + 5, /* field[5] = dropped_attributes_count */ + 6, /* field[6] = flags */ + 9, /* field[9] = observed_time_unix_nano */ + 1, /* field[1] = severity_number */ + 2, /* field[2] = severity_text */ + 8, /* field[8] = span_id */ + 0, /* field[0] = time_unix_nano */ + 7, /* field[7] = trace_id */ +}; +static const ProtobufCIntRange opentelemetry__proto__logs__v1__log_record__number_ranges[2 + 1] = +{ + { 1, 0 }, + { 5, 3 }, + { 0, 10 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__logs__v1__log_record__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.logs.v1.LogRecord", + "LogRecord", + "Opentelemetry__Proto__Logs__V1__LogRecord", + "opentelemetry.proto.logs.v1", + sizeof(Opentelemetry__Proto__Logs__V1__LogRecord), + 10, + opentelemetry__proto__logs__v1__log_record__field_descriptors, + opentelemetry__proto__logs__v1__log_record__field_indices_by_name, + 2, opentelemetry__proto__logs__v1__log_record__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__logs__v1__log_record__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCEnumValue opentelemetry__proto__logs__v1__severity_number__enum_values_by_number[25] = +{ + { "SEVERITY_NUMBER_UNSPECIFIED", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_UNSPECIFIED", 0 }, + { "SEVERITY_NUMBER_TRACE", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_TRACE", 1 }, + { "SEVERITY_NUMBER_TRACE2", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_TRACE2", 2 }, + { "SEVERITY_NUMBER_TRACE3", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_TRACE3", 3 }, + { "SEVERITY_NUMBER_TRACE4", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_TRACE4", 4 }, + { "SEVERITY_NUMBER_DEBUG", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_DEBUG", 5 }, + { "SEVERITY_NUMBER_DEBUG2", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_DEBUG2", 6 }, + { "SEVERITY_NUMBER_DEBUG3", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_DEBUG3", 7 }, + { "SEVERITY_NUMBER_DEBUG4", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_DEBUG4", 8 }, + { "SEVERITY_NUMBER_INFO", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_INFO", 9 }, + { "SEVERITY_NUMBER_INFO2", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_INFO2", 10 }, + { "SEVERITY_NUMBER_INFO3", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_INFO3", 11 }, + { "SEVERITY_NUMBER_INFO4", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_INFO4", 12 }, + { "SEVERITY_NUMBER_WARN", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_WARN", 13 }, + { "SEVERITY_NUMBER_WARN2", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_WARN2", 14 }, + { "SEVERITY_NUMBER_WARN3", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_WARN3", 15 }, + { "SEVERITY_NUMBER_WARN4", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_WARN4", 16 }, + { "SEVERITY_NUMBER_ERROR", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_ERROR", 17 }, + { "SEVERITY_NUMBER_ERROR2", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_ERROR2", 18 }, + { "SEVERITY_NUMBER_ERROR3", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_ERROR3", 19 }, + { "SEVERITY_NUMBER_ERROR4", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_ERROR4", 20 }, + { "SEVERITY_NUMBER_FATAL", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_FATAL", 21 }, + { "SEVERITY_NUMBER_FATAL2", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_FATAL2", 22 }, + { "SEVERITY_NUMBER_FATAL3", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_FATAL3", 23 }, + { "SEVERITY_NUMBER_FATAL4", "OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_FATAL4", 24 }, +}; +static const ProtobufCIntRange opentelemetry__proto__logs__v1__severity_number__value_ranges[] = { +{0, 0},{0, 25} +}; +static const ProtobufCEnumValueIndex opentelemetry__proto__logs__v1__severity_number__enum_values_by_name[25] = +{ + { "SEVERITY_NUMBER_DEBUG", 5 }, + { "SEVERITY_NUMBER_DEBUG2", 6 }, + { "SEVERITY_NUMBER_DEBUG3", 7 }, + { "SEVERITY_NUMBER_DEBUG4", 8 }, + { "SEVERITY_NUMBER_ERROR", 17 }, + { "SEVERITY_NUMBER_ERROR2", 18 }, + { "SEVERITY_NUMBER_ERROR3", 19 }, + { "SEVERITY_NUMBER_ERROR4", 20 }, + { "SEVERITY_NUMBER_FATAL", 21 }, + { "SEVERITY_NUMBER_FATAL2", 22 }, + { "SEVERITY_NUMBER_FATAL3", 23 }, + { "SEVERITY_NUMBER_FATAL4", 24 }, + { "SEVERITY_NUMBER_INFO", 9 }, + { "SEVERITY_NUMBER_INFO2", 10 }, + { "SEVERITY_NUMBER_INFO3", 11 }, + { "SEVERITY_NUMBER_INFO4", 12 }, + { "SEVERITY_NUMBER_TRACE", 1 }, + { "SEVERITY_NUMBER_TRACE2", 2 }, + { "SEVERITY_NUMBER_TRACE3", 3 }, + { "SEVERITY_NUMBER_TRACE4", 4 }, + { "SEVERITY_NUMBER_UNSPECIFIED", 0 }, + { "SEVERITY_NUMBER_WARN", 13 }, + { "SEVERITY_NUMBER_WARN2", 14 }, + { "SEVERITY_NUMBER_WARN3", 15 }, + { "SEVERITY_NUMBER_WARN4", 16 }, +}; +const ProtobufCEnumDescriptor opentelemetry__proto__logs__v1__severity_number__descriptor = +{ + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "opentelemetry.proto.logs.v1.SeverityNumber", + "SeverityNumber", + "Opentelemetry__Proto__Logs__V1__SeverityNumber", + "opentelemetry.proto.logs.v1", + 25, + opentelemetry__proto__logs__v1__severity_number__enum_values_by_number, + 25, + opentelemetry__proto__logs__v1__severity_number__enum_values_by_name, + 1, + opentelemetry__proto__logs__v1__severity_number__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCEnumValue opentelemetry__proto__logs__v1__log_record_flags__enum_values_by_number[2] = +{ + { "LOG_RECORD_FLAG_UNSPECIFIED", "OPENTELEMETRY__PROTO__LOGS__V1__LOG_RECORD_FLAGS__LOG_RECORD_FLAG_UNSPECIFIED", 0 }, + { "LOG_RECORD_FLAG_TRACE_FLAGS_MASK", "OPENTELEMETRY__PROTO__LOGS__V1__LOG_RECORD_FLAGS__LOG_RECORD_FLAG_TRACE_FLAGS_MASK", 255 }, +}; +static const ProtobufCIntRange opentelemetry__proto__logs__v1__log_record_flags__value_ranges[] = { +{0, 0},{255, 1},{0, 2} +}; +static const ProtobufCEnumValueIndex opentelemetry__proto__logs__v1__log_record_flags__enum_values_by_name[2] = +{ + { "LOG_RECORD_FLAG_TRACE_FLAGS_MASK", 1 }, + { "LOG_RECORD_FLAG_UNSPECIFIED", 0 }, +}; +const ProtobufCEnumDescriptor opentelemetry__proto__logs__v1__log_record_flags__descriptor = +{ + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "opentelemetry.proto.logs.v1.LogRecordFlags", + "LogRecordFlags", + "Opentelemetry__Proto__Logs__V1__LogRecordFlags", + "opentelemetry.proto.logs.v1", + 2, + opentelemetry__proto__logs__v1__log_record_flags__enum_values_by_number, + 2, + opentelemetry__proto__logs__v1__log_record_flags__enum_values_by_name, + 2, + opentelemetry__proto__logs__v1__log_record_flags__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/logs/v1/logs.pb-c.h b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/logs/v1/logs.pb-c.h new file mode 100644 index 000000000..4dbaa1d3b --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/logs/v1/logs.pb-c.h @@ -0,0 +1,342 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/logs/v1/logs.proto */ + +#ifndef PROTOBUF_C_opentelemetry_2fproto_2flogs_2fv1_2flogs_2eproto__INCLUDED +#define PROTOBUF_C_opentelemetry_2fproto_2flogs_2fv1_2flogs_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1004001 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + +#include "opentelemetry/proto/common/v1/common.pb-c.h" +#include "opentelemetry/proto/resource/v1/resource.pb-c.h" + +typedef struct Opentelemetry__Proto__Logs__V1__LogsData Opentelemetry__Proto__Logs__V1__LogsData; +typedef struct Opentelemetry__Proto__Logs__V1__ResourceLogs Opentelemetry__Proto__Logs__V1__ResourceLogs; +typedef struct Opentelemetry__Proto__Logs__V1__ScopeLogs Opentelemetry__Proto__Logs__V1__ScopeLogs; +typedef struct Opentelemetry__Proto__Logs__V1__LogRecord Opentelemetry__Proto__Logs__V1__LogRecord; + + +/* --- enums --- */ + +/* + * Possible values for LogRecord.SeverityNumber. + */ +typedef enum _Opentelemetry__Proto__Logs__V1__SeverityNumber { + /* + * UNSPECIFIED is the default SeverityNumber, it MUST NOT be used. + */ + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_UNSPECIFIED = 0, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_TRACE = 1, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_TRACE2 = 2, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_TRACE3 = 3, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_TRACE4 = 4, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_DEBUG = 5, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_DEBUG2 = 6, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_DEBUG3 = 7, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_DEBUG4 = 8, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_INFO = 9, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_INFO2 = 10, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_INFO3 = 11, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_INFO4 = 12, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_WARN = 13, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_WARN2 = 14, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_WARN3 = 15, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_WARN4 = 16, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_ERROR = 17, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_ERROR2 = 18, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_ERROR3 = 19, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_ERROR4 = 20, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_FATAL = 21, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_FATAL2 = 22, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_FATAL3 = 23, + OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_FATAL4 = 24 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER) +} Opentelemetry__Proto__Logs__V1__SeverityNumber; +/* + * Masks for LogRecord.flags field. + */ +typedef enum _Opentelemetry__Proto__Logs__V1__LogRecordFlags { + OPENTELEMETRY__PROTO__LOGS__V1__LOG_RECORD_FLAGS__LOG_RECORD_FLAG_UNSPECIFIED = 0, + OPENTELEMETRY__PROTO__LOGS__V1__LOG_RECORD_FLAGS__LOG_RECORD_FLAG_TRACE_FLAGS_MASK = 255 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(OPENTELEMETRY__PROTO__LOGS__V1__LOG_RECORD_FLAGS) +} Opentelemetry__Proto__Logs__V1__LogRecordFlags; + +/* --- messages --- */ + +/* + * LogsData represents the logs data that can be stored in a persistent storage, + * OR can be embedded by other protocols that transfer OTLP logs data but do not + * implement the OTLP protocol. + * The main difference between this message and collector protocol is that + * in this message there will not be any "control" or "metadata" specific to + * OTLP protocol. + * When new fields are added into this message, the OTLP request MUST be updated + * as well. + */ +struct Opentelemetry__Proto__Logs__V1__LogsData +{ + ProtobufCMessage base; + /* + * An array of ResourceLogs. + * For data coming from a single resource this array will typically contain + * one element. Intermediary nodes that receive data from multiple origins + * typically batch the data before forwarding further and in that case this + * array will contain multiple elements. + */ + size_t n_resource_logs; + Opentelemetry__Proto__Logs__V1__ResourceLogs **resource_logs; +}; +#define OPENTELEMETRY__PROTO__LOGS__V1__LOGS_DATA__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__logs__v1__logs_data__descriptor) \ + , 0,NULL } + + +/* + * A collection of ScopeLogs from a Resource. + */ +struct Opentelemetry__Proto__Logs__V1__ResourceLogs +{ + ProtobufCMessage base; + /* + * The resource for the logs in this message. + * If this field is not set then resource info is unknown. + */ + Opentelemetry__Proto__Resource__V1__Resource *resource; + /* + * A list of ScopeLogs that originate from a resource. + */ + size_t n_scope_logs; + Opentelemetry__Proto__Logs__V1__ScopeLogs **scope_logs; + /* + * This schema_url applies to the data in the "resource" field. It does not apply + * to the data in the "scope_logs" field which have their own schema_url field. + */ + char *schema_url; +}; +#define OPENTELEMETRY__PROTO__LOGS__V1__RESOURCE_LOGS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__logs__v1__resource_logs__descriptor) \ + , NULL, 0,NULL, (char *)protobuf_c_empty_string } + + +/* + * A collection of Logs produced by a Scope. + */ +struct Opentelemetry__Proto__Logs__V1__ScopeLogs +{ + ProtobufCMessage base; + /* + * The instrumentation scope information for the logs in this message. + * Semantically when InstrumentationScope isn't set, it is equivalent with + * an empty instrumentation scope name (unknown). + */ + Opentelemetry__Proto__Common__V1__InstrumentationScope *scope; + /* + * A list of log records. + */ + size_t n_log_records; + Opentelemetry__Proto__Logs__V1__LogRecord **log_records; + /* + * This schema_url applies to all logs in the "logs" field. + */ + char *schema_url; +}; +#define OPENTELEMETRY__PROTO__LOGS__V1__SCOPE_LOGS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__logs__v1__scope_logs__descriptor) \ + , NULL, 0,NULL, (char *)protobuf_c_empty_string } + + +/* + * A log record according to OpenTelemetry Log Data Model: + * https://github.com/open-telemetry/oteps/blob/main/text/logs/0097-log-data-model.md + */ +struct Opentelemetry__Proto__Logs__V1__LogRecord +{ + ProtobufCMessage base; + /* + * time_unix_nano is the time when the event occurred. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + * Value of 0 indicates unknown or missing timestamp. + */ + uint64_t time_unix_nano; + /* + * Time when the event was observed by the collection system. + * For events that originate in OpenTelemetry (e.g. using OpenTelemetry Logging SDK) + * this timestamp is typically set at the generation time and is equal to Timestamp. + * For events originating externally and collected by OpenTelemetry (e.g. using + * Collector) this is the time when OpenTelemetry's code observed the event measured + * by the clock of the OpenTelemetry code. This field MUST be set once the event is + * observed by OpenTelemetry. + * For converting OpenTelemetry log data to formats that support only one timestamp or + * when receiving OpenTelemetry log data by recipients that support only one timestamp + * internally the following logic is recommended: + * - Use time_unix_nano if it is present, otherwise use observed_time_unix_nano. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + * Value of 0 indicates unknown or missing timestamp. + */ + uint64_t observed_time_unix_nano; + /* + * Numerical value of the severity, normalized to values described in Log Data Model. + * [Optional]. + */ + Opentelemetry__Proto__Logs__V1__SeverityNumber severity_number; + /* + * The severity text (also known as log level). The original string representation as + * it is known at the source. [Optional]. + */ + char *severity_text; + /* + * A value containing the body of the log record. Can be for example a human-readable + * string message (including multi-line) describing the event in a free form or it can + * be a structured data composed of arrays and maps of other values. [Optional]. + */ + Opentelemetry__Proto__Common__V1__AnyValue *body; + /* + * Additional attributes that describe the specific event occurrence. [Optional]. + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + */ + size_t n_attributes; + Opentelemetry__Proto__Common__V1__KeyValue **attributes; + uint32_t dropped_attributes_count; + /* + * Flags, a bit field. 8 least significant bits are the trace flags as + * defined in W3C Trace Context specification. 24 most significant bits are reserved + * and must be set to 0. Readers must not assume that 24 most significant bits + * will be zero and must correctly mask the bits when reading 8-bit trace flag (use + * flags & TRACE_FLAGS_MASK). [Optional]. + */ + uint32_t flags; + /* + * A unique identifier for a trace. All logs from the same trace share + * the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes + * is considered invalid. Can be set for logs that are part of request processing + * and have an assigned trace id. [Optional]. + */ + ProtobufCBinaryData trace_id; + /* + * A unique identifier for a span within a trace, assigned when the span + * is created. The ID is an 8-byte array. An ID with all zeroes is considered + * invalid. Can be set for logs that are part of a particular processing span. + * If span_id is present trace_id SHOULD be also present. [Optional]. + */ + ProtobufCBinaryData span_id; +}; +#define OPENTELEMETRY__PROTO__LOGS__V1__LOG_RECORD__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__logs__v1__log_record__descriptor) \ + , 0, 0, OPENTELEMETRY__PROTO__LOGS__V1__SEVERITY_NUMBER__SEVERITY_NUMBER_UNSPECIFIED, (char *)protobuf_c_empty_string, NULL, 0,NULL, 0, 0, {0,NULL}, {0,NULL} } + + +/* Opentelemetry__Proto__Logs__V1__LogsData methods */ +void opentelemetry__proto__logs__v1__logs_data__init + (Opentelemetry__Proto__Logs__V1__LogsData *message); +size_t opentelemetry__proto__logs__v1__logs_data__get_packed_size + (const Opentelemetry__Proto__Logs__V1__LogsData *message); +size_t opentelemetry__proto__logs__v1__logs_data__pack + (const Opentelemetry__Proto__Logs__V1__LogsData *message, + uint8_t *out); +size_t opentelemetry__proto__logs__v1__logs_data__pack_to_buffer + (const Opentelemetry__Proto__Logs__V1__LogsData *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Logs__V1__LogsData * + opentelemetry__proto__logs__v1__logs_data__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__logs__v1__logs_data__free_unpacked + (Opentelemetry__Proto__Logs__V1__LogsData *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Logs__V1__ResourceLogs methods */ +void opentelemetry__proto__logs__v1__resource_logs__init + (Opentelemetry__Proto__Logs__V1__ResourceLogs *message); +size_t opentelemetry__proto__logs__v1__resource_logs__get_packed_size + (const Opentelemetry__Proto__Logs__V1__ResourceLogs *message); +size_t opentelemetry__proto__logs__v1__resource_logs__pack + (const Opentelemetry__Proto__Logs__V1__ResourceLogs *message, + uint8_t *out); +size_t opentelemetry__proto__logs__v1__resource_logs__pack_to_buffer + (const Opentelemetry__Proto__Logs__V1__ResourceLogs *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Logs__V1__ResourceLogs * + opentelemetry__proto__logs__v1__resource_logs__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__logs__v1__resource_logs__free_unpacked + (Opentelemetry__Proto__Logs__V1__ResourceLogs *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Logs__V1__ScopeLogs methods */ +void opentelemetry__proto__logs__v1__scope_logs__init + (Opentelemetry__Proto__Logs__V1__ScopeLogs *message); +size_t opentelemetry__proto__logs__v1__scope_logs__get_packed_size + (const Opentelemetry__Proto__Logs__V1__ScopeLogs *message); +size_t opentelemetry__proto__logs__v1__scope_logs__pack + (const Opentelemetry__Proto__Logs__V1__ScopeLogs *message, + uint8_t *out); +size_t opentelemetry__proto__logs__v1__scope_logs__pack_to_buffer + (const Opentelemetry__Proto__Logs__V1__ScopeLogs *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Logs__V1__ScopeLogs * + opentelemetry__proto__logs__v1__scope_logs__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__logs__v1__scope_logs__free_unpacked + (Opentelemetry__Proto__Logs__V1__ScopeLogs *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Logs__V1__LogRecord methods */ +void opentelemetry__proto__logs__v1__log_record__init + (Opentelemetry__Proto__Logs__V1__LogRecord *message); +size_t opentelemetry__proto__logs__v1__log_record__get_packed_size + (const Opentelemetry__Proto__Logs__V1__LogRecord *message); +size_t opentelemetry__proto__logs__v1__log_record__pack + (const Opentelemetry__Proto__Logs__V1__LogRecord *message, + uint8_t *out); +size_t opentelemetry__proto__logs__v1__log_record__pack_to_buffer + (const Opentelemetry__Proto__Logs__V1__LogRecord *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Logs__V1__LogRecord * + opentelemetry__proto__logs__v1__log_record__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__logs__v1__log_record__free_unpacked + (Opentelemetry__Proto__Logs__V1__LogRecord *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*Opentelemetry__Proto__Logs__V1__LogsData_Closure) + (const Opentelemetry__Proto__Logs__V1__LogsData *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Logs__V1__ResourceLogs_Closure) + (const Opentelemetry__Proto__Logs__V1__ResourceLogs *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Logs__V1__ScopeLogs_Closure) + (const Opentelemetry__Proto__Logs__V1__ScopeLogs *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Logs__V1__LogRecord_Closure) + (const Opentelemetry__Proto__Logs__V1__LogRecord *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCEnumDescriptor opentelemetry__proto__logs__v1__severity_number__descriptor; +extern const ProtobufCEnumDescriptor opentelemetry__proto__logs__v1__log_record_flags__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__logs__v1__logs_data__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__logs__v1__resource_logs__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__logs__v1__scope_logs__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__logs__v1__log_record__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_opentelemetry_2fproto_2flogs_2fv1_2flogs_2eproto__INCLUDED */ diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/metrics/v1/metrics.pb-c.c b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/metrics/v1/metrics.pb-c.c new file mode 100644 index 000000000..eb660b78d --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/metrics/v1/metrics.pb-c.c @@ -0,0 +1,2048 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/metrics/v1/metrics.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "opentelemetry/proto/metrics/v1/metrics.pb-c.h" +void opentelemetry__proto__metrics__v1__metrics_data__init + (Opentelemetry__Proto__Metrics__V1__MetricsData *message) +{ + static const Opentelemetry__Proto__Metrics__V1__MetricsData init_value = OPENTELEMETRY__PROTO__METRICS__V1__METRICS_DATA__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__metrics_data__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__MetricsData *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__metrics_data__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__metrics_data__pack + (const Opentelemetry__Proto__Metrics__V1__MetricsData *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__metrics_data__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__metrics_data__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__MetricsData *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__metrics_data__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__MetricsData * + opentelemetry__proto__metrics__v1__metrics_data__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__MetricsData *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__metrics_data__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__metrics_data__free_unpacked + (Opentelemetry__Proto__Metrics__V1__MetricsData *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__metrics_data__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__metrics__v1__resource_metrics__init + (Opentelemetry__Proto__Metrics__V1__ResourceMetrics *message) +{ + static const Opentelemetry__Proto__Metrics__V1__ResourceMetrics init_value = OPENTELEMETRY__PROTO__METRICS__V1__RESOURCE_METRICS__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__resource_metrics__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__ResourceMetrics *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__resource_metrics__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__resource_metrics__pack + (const Opentelemetry__Proto__Metrics__V1__ResourceMetrics *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__resource_metrics__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__resource_metrics__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__ResourceMetrics *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__resource_metrics__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__ResourceMetrics * + opentelemetry__proto__metrics__v1__resource_metrics__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__ResourceMetrics *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__resource_metrics__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__resource_metrics__free_unpacked + (Opentelemetry__Proto__Metrics__V1__ResourceMetrics *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__resource_metrics__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__metrics__v1__scope_metrics__init + (Opentelemetry__Proto__Metrics__V1__ScopeMetrics *message) +{ + static const Opentelemetry__Proto__Metrics__V1__ScopeMetrics init_value = OPENTELEMETRY__PROTO__METRICS__V1__SCOPE_METRICS__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__scope_metrics__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__ScopeMetrics *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__scope_metrics__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__scope_metrics__pack + (const Opentelemetry__Proto__Metrics__V1__ScopeMetrics *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__scope_metrics__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__scope_metrics__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__ScopeMetrics *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__scope_metrics__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__ScopeMetrics * + opentelemetry__proto__metrics__v1__scope_metrics__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__ScopeMetrics *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__scope_metrics__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__scope_metrics__free_unpacked + (Opentelemetry__Proto__Metrics__V1__ScopeMetrics *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__scope_metrics__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__metrics__v1__metric__init + (Opentelemetry__Proto__Metrics__V1__Metric *message) +{ + static const Opentelemetry__Proto__Metrics__V1__Metric init_value = OPENTELEMETRY__PROTO__METRICS__V1__METRIC__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__metric__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__Metric *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__metric__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__metric__pack + (const Opentelemetry__Proto__Metrics__V1__Metric *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__metric__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__metric__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__Metric *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__metric__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__Metric * + opentelemetry__proto__metrics__v1__metric__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__Metric *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__metric__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__metric__free_unpacked + (Opentelemetry__Proto__Metrics__V1__Metric *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__metric__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__metrics__v1__gauge__init + (Opentelemetry__Proto__Metrics__V1__Gauge *message) +{ + static const Opentelemetry__Proto__Metrics__V1__Gauge init_value = OPENTELEMETRY__PROTO__METRICS__V1__GAUGE__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__gauge__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__Gauge *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__gauge__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__gauge__pack + (const Opentelemetry__Proto__Metrics__V1__Gauge *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__gauge__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__gauge__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__Gauge *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__gauge__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__Gauge * + opentelemetry__proto__metrics__v1__gauge__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__Gauge *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__gauge__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__gauge__free_unpacked + (Opentelemetry__Proto__Metrics__V1__Gauge *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__gauge__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__metrics__v1__sum__init + (Opentelemetry__Proto__Metrics__V1__Sum *message) +{ + static const Opentelemetry__Proto__Metrics__V1__Sum init_value = OPENTELEMETRY__PROTO__METRICS__V1__SUM__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__sum__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__Sum *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__sum__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__sum__pack + (const Opentelemetry__Proto__Metrics__V1__Sum *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__sum__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__sum__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__Sum *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__sum__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__Sum * + opentelemetry__proto__metrics__v1__sum__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__Sum *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__sum__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__sum__free_unpacked + (Opentelemetry__Proto__Metrics__V1__Sum *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__sum__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__metrics__v1__histogram__init + (Opentelemetry__Proto__Metrics__V1__Histogram *message) +{ + static const Opentelemetry__Proto__Metrics__V1__Histogram init_value = OPENTELEMETRY__PROTO__METRICS__V1__HISTOGRAM__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__histogram__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__Histogram *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__histogram__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__histogram__pack + (const Opentelemetry__Proto__Metrics__V1__Histogram *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__histogram__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__histogram__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__Histogram *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__histogram__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__Histogram * + opentelemetry__proto__metrics__v1__histogram__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__Histogram *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__histogram__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__histogram__free_unpacked + (Opentelemetry__Proto__Metrics__V1__Histogram *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__histogram__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__metrics__v1__exponential_histogram__init + (Opentelemetry__Proto__Metrics__V1__ExponentialHistogram *message) +{ + static const Opentelemetry__Proto__Metrics__V1__ExponentialHistogram init_value = OPENTELEMETRY__PROTO__METRICS__V1__EXPONENTIAL_HISTOGRAM__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__exponential_histogram__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogram *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__exponential_histogram__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__exponential_histogram__pack + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogram *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__exponential_histogram__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__exponential_histogram__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogram *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__exponential_histogram__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__ExponentialHistogram * + opentelemetry__proto__metrics__v1__exponential_histogram__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__ExponentialHistogram *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__exponential_histogram__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__exponential_histogram__free_unpacked + (Opentelemetry__Proto__Metrics__V1__ExponentialHistogram *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__exponential_histogram__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__metrics__v1__summary__init + (Opentelemetry__Proto__Metrics__V1__Summary *message) +{ + static const Opentelemetry__Proto__Metrics__V1__Summary init_value = OPENTELEMETRY__PROTO__METRICS__V1__SUMMARY__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__summary__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__Summary *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__summary__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__summary__pack + (const Opentelemetry__Proto__Metrics__V1__Summary *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__summary__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__summary__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__Summary *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__summary__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__Summary * + opentelemetry__proto__metrics__v1__summary__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__Summary *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__summary__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__summary__free_unpacked + (Opentelemetry__Proto__Metrics__V1__Summary *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__summary__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__metrics__v1__number_data_point__init + (Opentelemetry__Proto__Metrics__V1__NumberDataPoint *message) +{ + static const Opentelemetry__Proto__Metrics__V1__NumberDataPoint init_value = OPENTELEMETRY__PROTO__METRICS__V1__NUMBER_DATA_POINT__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__number_data_point__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__NumberDataPoint *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__number_data_point__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__number_data_point__pack + (const Opentelemetry__Proto__Metrics__V1__NumberDataPoint *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__number_data_point__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__number_data_point__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__NumberDataPoint *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__number_data_point__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__NumberDataPoint * + opentelemetry__proto__metrics__v1__number_data_point__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__NumberDataPoint *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__number_data_point__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__number_data_point__free_unpacked + (Opentelemetry__Proto__Metrics__V1__NumberDataPoint *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__number_data_point__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__metrics__v1__histogram_data_point__init + (Opentelemetry__Proto__Metrics__V1__HistogramDataPoint *message) +{ + static const Opentelemetry__Proto__Metrics__V1__HistogramDataPoint init_value = OPENTELEMETRY__PROTO__METRICS__V1__HISTOGRAM_DATA_POINT__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__histogram_data_point__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__HistogramDataPoint *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__histogram_data_point__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__histogram_data_point__pack + (const Opentelemetry__Proto__Metrics__V1__HistogramDataPoint *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__histogram_data_point__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__histogram_data_point__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__HistogramDataPoint *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__histogram_data_point__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__HistogramDataPoint * + opentelemetry__proto__metrics__v1__histogram_data_point__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__HistogramDataPoint *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__histogram_data_point__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__histogram_data_point__free_unpacked + (Opentelemetry__Proto__Metrics__V1__HistogramDataPoint *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__histogram_data_point__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__init + (Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets *message) +{ + static const Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets init_value = OPENTELEMETRY__PROTO__METRICS__V1__EXPONENTIAL_HISTOGRAM_DATA_POINT__BUCKETS__INIT; + *message = init_value; +} +void opentelemetry__proto__metrics__v1__exponential_histogram_data_point__init + (Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint *message) +{ + static const Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint init_value = OPENTELEMETRY__PROTO__METRICS__V1__EXPONENTIAL_HISTOGRAM_DATA_POINT__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__exponential_histogram_data_point__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__exponential_histogram_data_point__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__exponential_histogram_data_point__pack + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__exponential_histogram_data_point__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__exponential_histogram_data_point__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__exponential_histogram_data_point__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint * + opentelemetry__proto__metrics__v1__exponential_histogram_data_point__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__exponential_histogram_data_point__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__exponential_histogram_data_point__free_unpacked + (Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__exponential_histogram_data_point__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__metrics__v1__summary_data_point__value_at_quantile__init + (Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile *message) +{ + static const Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile init_value = OPENTELEMETRY__PROTO__METRICS__V1__SUMMARY_DATA_POINT__VALUE_AT_QUANTILE__INIT; + *message = init_value; +} +void opentelemetry__proto__metrics__v1__summary_data_point__init + (Opentelemetry__Proto__Metrics__V1__SummaryDataPoint *message) +{ + static const Opentelemetry__Proto__Metrics__V1__SummaryDataPoint init_value = OPENTELEMETRY__PROTO__METRICS__V1__SUMMARY_DATA_POINT__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__summary_data_point__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__SummaryDataPoint *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__summary_data_point__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__summary_data_point__pack + (const Opentelemetry__Proto__Metrics__V1__SummaryDataPoint *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__summary_data_point__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__summary_data_point__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__SummaryDataPoint *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__summary_data_point__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__SummaryDataPoint * + opentelemetry__proto__metrics__v1__summary_data_point__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__SummaryDataPoint *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__summary_data_point__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__summary_data_point__free_unpacked + (Opentelemetry__Proto__Metrics__V1__SummaryDataPoint *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__summary_data_point__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__metrics__v1__exemplar__init + (Opentelemetry__Proto__Metrics__V1__Exemplar *message) +{ + static const Opentelemetry__Proto__Metrics__V1__Exemplar init_value = OPENTELEMETRY__PROTO__METRICS__V1__EXEMPLAR__INIT; + *message = init_value; +} +size_t opentelemetry__proto__metrics__v1__exemplar__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__Exemplar *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__exemplar__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__metrics__v1__exemplar__pack + (const Opentelemetry__Proto__Metrics__V1__Exemplar *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__exemplar__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__metrics__v1__exemplar__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__Exemplar *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__exemplar__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Metrics__V1__Exemplar * + opentelemetry__proto__metrics__v1__exemplar__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Metrics__V1__Exemplar *) + protobuf_c_message_unpack (&opentelemetry__proto__metrics__v1__exemplar__descriptor, + allocator, len, data); +} +void opentelemetry__proto__metrics__v1__exemplar__free_unpacked + (Opentelemetry__Proto__Metrics__V1__Exemplar *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__metrics__v1__exemplar__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__metrics_data__field_descriptors[1] = +{ + { + "resource_metrics", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__MetricsData, n_resource_metrics), + offsetof(Opentelemetry__Proto__Metrics__V1__MetricsData, resource_metrics), + &opentelemetry__proto__metrics__v1__resource_metrics__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__metrics_data__field_indices_by_name[] = { + 0, /* field[0] = resource_metrics */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__metrics_data__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__metrics_data__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.MetricsData", + "MetricsData", + "Opentelemetry__Proto__Metrics__V1__MetricsData", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__MetricsData), + 1, + opentelemetry__proto__metrics__v1__metrics_data__field_descriptors, + opentelemetry__proto__metrics__v1__metrics_data__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__metrics_data__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__metrics_data__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__resource_metrics__field_descriptors[3] = +{ + { + "resource", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ResourceMetrics, resource), + &opentelemetry__proto__resource__v1__resource__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "scope_metrics", + 2, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__ResourceMetrics, n_scope_metrics), + offsetof(Opentelemetry__Proto__Metrics__V1__ResourceMetrics, scope_metrics), + &opentelemetry__proto__metrics__v1__scope_metrics__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "schema_url", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ResourceMetrics, schema_url), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__resource_metrics__field_indices_by_name[] = { + 0, /* field[0] = resource */ + 2, /* field[2] = schema_url */ + 1, /* field[1] = scope_metrics */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__resource_metrics__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__resource_metrics__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.ResourceMetrics", + "ResourceMetrics", + "Opentelemetry__Proto__Metrics__V1__ResourceMetrics", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__ResourceMetrics), + 3, + opentelemetry__proto__metrics__v1__resource_metrics__field_descriptors, + opentelemetry__proto__metrics__v1__resource_metrics__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__resource_metrics__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__resource_metrics__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__scope_metrics__field_descriptors[3] = +{ + { + "scope", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ScopeMetrics, scope), + &opentelemetry__proto__common__v1__instrumentation_scope__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "metrics", + 2, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__ScopeMetrics, n_metrics), + offsetof(Opentelemetry__Proto__Metrics__V1__ScopeMetrics, metrics), + &opentelemetry__proto__metrics__v1__metric__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "schema_url", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ScopeMetrics, schema_url), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__scope_metrics__field_indices_by_name[] = { + 1, /* field[1] = metrics */ + 2, /* field[2] = schema_url */ + 0, /* field[0] = scope */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__scope_metrics__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__scope_metrics__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.ScopeMetrics", + "ScopeMetrics", + "Opentelemetry__Proto__Metrics__V1__ScopeMetrics", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__ScopeMetrics), + 3, + opentelemetry__proto__metrics__v1__scope_metrics__field_descriptors, + opentelemetry__proto__metrics__v1__scope_metrics__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__scope_metrics__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__scope_metrics__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__metric__field_descriptors[8] = +{ + { + "name", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__Metric, name), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "description", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__Metric, description), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "unit", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__Metric, unit), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "gauge", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__Metric, data_case), + offsetof(Opentelemetry__Proto__Metrics__V1__Metric, gauge), + &opentelemetry__proto__metrics__v1__gauge__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "sum", + 7, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__Metric, data_case), + offsetof(Opentelemetry__Proto__Metrics__V1__Metric, sum), + &opentelemetry__proto__metrics__v1__sum__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "histogram", + 9, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__Metric, data_case), + offsetof(Opentelemetry__Proto__Metrics__V1__Metric, histogram), + &opentelemetry__proto__metrics__v1__histogram__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "exponential_histogram", + 10, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__Metric, data_case), + offsetof(Opentelemetry__Proto__Metrics__V1__Metric, exponential_histogram), + &opentelemetry__proto__metrics__v1__exponential_histogram__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "summary", + 11, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__Metric, data_case), + offsetof(Opentelemetry__Proto__Metrics__V1__Metric, summary), + &opentelemetry__proto__metrics__v1__summary__descriptor, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__metric__field_indices_by_name[] = { + 1, /* field[1] = description */ + 6, /* field[6] = exponential_histogram */ + 3, /* field[3] = gauge */ + 5, /* field[5] = histogram */ + 0, /* field[0] = name */ + 4, /* field[4] = sum */ + 7, /* field[7] = summary */ + 2, /* field[2] = unit */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__metric__number_ranges[4 + 1] = +{ + { 1, 0 }, + { 5, 3 }, + { 7, 4 }, + { 9, 5 }, + { 0, 8 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__metric__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.Metric", + "Metric", + "Opentelemetry__Proto__Metrics__V1__Metric", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__Metric), + 8, + opentelemetry__proto__metrics__v1__metric__field_descriptors, + opentelemetry__proto__metrics__v1__metric__field_indices_by_name, + 4, opentelemetry__proto__metrics__v1__metric__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__metric__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__gauge__field_descriptors[1] = +{ + { + "data_points", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__Gauge, n_data_points), + offsetof(Opentelemetry__Proto__Metrics__V1__Gauge, data_points), + &opentelemetry__proto__metrics__v1__number_data_point__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__gauge__field_indices_by_name[] = { + 0, /* field[0] = data_points */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__gauge__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__gauge__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.Gauge", + "Gauge", + "Opentelemetry__Proto__Metrics__V1__Gauge", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__Gauge), + 1, + opentelemetry__proto__metrics__v1__gauge__field_descriptors, + opentelemetry__proto__metrics__v1__gauge__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__gauge__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__gauge__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__sum__field_descriptors[3] = +{ + { + "data_points", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__Sum, n_data_points), + offsetof(Opentelemetry__Proto__Metrics__V1__Sum, data_points), + &opentelemetry__proto__metrics__v1__number_data_point__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "aggregation_temporality", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__Sum, aggregation_temporality), + &opentelemetry__proto__metrics__v1__aggregation_temporality__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "is_monotonic", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BOOL, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__Sum, is_monotonic), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__sum__field_indices_by_name[] = { + 1, /* field[1] = aggregation_temporality */ + 0, /* field[0] = data_points */ + 2, /* field[2] = is_monotonic */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__sum__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__sum__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.Sum", + "Sum", + "Opentelemetry__Proto__Metrics__V1__Sum", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__Sum), + 3, + opentelemetry__proto__metrics__v1__sum__field_descriptors, + opentelemetry__proto__metrics__v1__sum__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__sum__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__sum__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__histogram__field_descriptors[2] = +{ + { + "data_points", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__Histogram, n_data_points), + offsetof(Opentelemetry__Proto__Metrics__V1__Histogram, data_points), + &opentelemetry__proto__metrics__v1__histogram_data_point__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "aggregation_temporality", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__Histogram, aggregation_temporality), + &opentelemetry__proto__metrics__v1__aggregation_temporality__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__histogram__field_indices_by_name[] = { + 1, /* field[1] = aggregation_temporality */ + 0, /* field[0] = data_points */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__histogram__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__histogram__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.Histogram", + "Histogram", + "Opentelemetry__Proto__Metrics__V1__Histogram", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__Histogram), + 2, + opentelemetry__proto__metrics__v1__histogram__field_descriptors, + opentelemetry__proto__metrics__v1__histogram__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__histogram__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__histogram__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__exponential_histogram__field_descriptors[2] = +{ + { + "data_points", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogram, n_data_points), + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogram, data_points), + &opentelemetry__proto__metrics__v1__exponential_histogram_data_point__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "aggregation_temporality", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogram, aggregation_temporality), + &opentelemetry__proto__metrics__v1__aggregation_temporality__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__exponential_histogram__field_indices_by_name[] = { + 1, /* field[1] = aggregation_temporality */ + 0, /* field[0] = data_points */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__exponential_histogram__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__exponential_histogram__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.ExponentialHistogram", + "ExponentialHistogram", + "Opentelemetry__Proto__Metrics__V1__ExponentialHistogram", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogram), + 2, + opentelemetry__proto__metrics__v1__exponential_histogram__field_descriptors, + opentelemetry__proto__metrics__v1__exponential_histogram__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__exponential_histogram__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__exponential_histogram__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__summary__field_descriptors[1] = +{ + { + "data_points", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__Summary, n_data_points), + offsetof(Opentelemetry__Proto__Metrics__V1__Summary, data_points), + &opentelemetry__proto__metrics__v1__summary_data_point__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__summary__field_indices_by_name[] = { + 0, /* field[0] = data_points */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__summary__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__summary__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.Summary", + "Summary", + "Opentelemetry__Proto__Metrics__V1__Summary", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__Summary), + 1, + opentelemetry__proto__metrics__v1__summary__field_descriptors, + opentelemetry__proto__metrics__v1__summary__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__summary__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__summary__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__number_data_point__field_descriptors[7] = +{ + { + "start_time_unix_nano", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__NumberDataPoint, start_time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "time_unix_nano", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__NumberDataPoint, time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "as_double", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(Opentelemetry__Proto__Metrics__V1__NumberDataPoint, value_case), + offsetof(Opentelemetry__Proto__Metrics__V1__NumberDataPoint, as_double), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "exemplars", + 5, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__NumberDataPoint, n_exemplars), + offsetof(Opentelemetry__Proto__Metrics__V1__NumberDataPoint, exemplars), + &opentelemetry__proto__metrics__v1__exemplar__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "as_int", + 6, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_SFIXED64, + offsetof(Opentelemetry__Proto__Metrics__V1__NumberDataPoint, value_case), + offsetof(Opentelemetry__Proto__Metrics__V1__NumberDataPoint, as_int), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "attributes", + 7, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__NumberDataPoint, n_attributes), + offsetof(Opentelemetry__Proto__Metrics__V1__NumberDataPoint, attributes), + &opentelemetry__proto__common__v1__key_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "flags", + 8, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__NumberDataPoint, flags), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__number_data_point__field_indices_by_name[] = { + 2, /* field[2] = as_double */ + 4, /* field[4] = as_int */ + 5, /* field[5] = attributes */ + 3, /* field[3] = exemplars */ + 6, /* field[6] = flags */ + 0, /* field[0] = start_time_unix_nano */ + 1, /* field[1] = time_unix_nano */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__number_data_point__number_ranges[1 + 1] = +{ + { 2, 0 }, + { 0, 7 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__number_data_point__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.NumberDataPoint", + "NumberDataPoint", + "Opentelemetry__Proto__Metrics__V1__NumberDataPoint", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__NumberDataPoint), + 7, + opentelemetry__proto__metrics__v1__number_data_point__field_descriptors, + opentelemetry__proto__metrics__v1__number_data_point__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__number_data_point__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__number_data_point__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__histogram_data_point__field_descriptors[11] = +{ + { + "start_time_unix_nano", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, start_time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "time_unix_nano", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "count", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, count), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "sum", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, sum), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "bucket_counts", + 6, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_FIXED64, + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, n_bucket_counts), + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, bucket_counts), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_PACKED, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "explicit_bounds", + 7, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, n_explicit_bounds), + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, explicit_bounds), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_PACKED, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "exemplars", + 8, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, n_exemplars), + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, exemplars), + &opentelemetry__proto__metrics__v1__exemplar__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "attributes", + 9, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, n_attributes), + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, attributes), + &opentelemetry__proto__common__v1__key_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "flags", + 10, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, flags), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "min", + 11, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, min), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "max", + 12, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint, max), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__histogram_data_point__field_indices_by_name[] = { + 7, /* field[7] = attributes */ + 4, /* field[4] = bucket_counts */ + 2, /* field[2] = count */ + 6, /* field[6] = exemplars */ + 5, /* field[5] = explicit_bounds */ + 8, /* field[8] = flags */ + 10, /* field[10] = max */ + 9, /* field[9] = min */ + 0, /* field[0] = start_time_unix_nano */ + 3, /* field[3] = sum */ + 1, /* field[1] = time_unix_nano */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__histogram_data_point__number_ranges[1 + 1] = +{ + { 2, 0 }, + { 0, 11 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__histogram_data_point__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.HistogramDataPoint", + "HistogramDataPoint", + "Opentelemetry__Proto__Metrics__V1__HistogramDataPoint", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__HistogramDataPoint), + 11, + opentelemetry__proto__metrics__v1__histogram_data_point__field_descriptors, + opentelemetry__proto__metrics__v1__histogram_data_point__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__histogram_data_point__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__histogram_data_point__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__field_descriptors[2] = +{ + { + "offset", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_SINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets, offset), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "bucket_counts", + 2, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_UINT64, + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets, n_bucket_counts), + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets, bucket_counts), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_PACKED, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__field_indices_by_name[] = { + 1, /* field[1] = bucket_counts */ + 0, /* field[0] = offset */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint.Buckets", + "Buckets", + "Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets), + 2, + opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__field_descriptors, + opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__exponential_histogram_data_point__field_descriptors[13] = +{ + { + "attributes", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, n_attributes), + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, attributes), + &opentelemetry__proto__common__v1__key_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "start_time_unix_nano", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, start_time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "time_unix_nano", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "count", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, count), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "sum", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, sum), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "scale", + 6, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_SINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, scale), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "zero_count", + 7, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, zero_count), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "positive", + 8, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, positive), + &opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "negative", + 9, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, negative), + &opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "flags", + 10, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, flags), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "exemplars", + 11, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, n_exemplars), + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, exemplars), + &opentelemetry__proto__metrics__v1__exemplar__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "min", + 12, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, min), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "max", + 13, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint, max), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__exponential_histogram_data_point__field_indices_by_name[] = { + 0, /* field[0] = attributes */ + 3, /* field[3] = count */ + 10, /* field[10] = exemplars */ + 9, /* field[9] = flags */ + 12, /* field[12] = max */ + 11, /* field[11] = min */ + 8, /* field[8] = negative */ + 7, /* field[7] = positive */ + 5, /* field[5] = scale */ + 1, /* field[1] = start_time_unix_nano */ + 4, /* field[4] = sum */ + 2, /* field[2] = time_unix_nano */ + 6, /* field[6] = zero_count */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__exponential_histogram_data_point__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 13 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__exponential_histogram_data_point__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.ExponentialHistogramDataPoint", + "ExponentialHistogramDataPoint", + "Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint), + 13, + opentelemetry__proto__metrics__v1__exponential_histogram_data_point__field_descriptors, + opentelemetry__proto__metrics__v1__exponential_histogram_data_point__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__exponential_histogram_data_point__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__exponential_histogram_data_point__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__summary_data_point__value_at_quantile__field_descriptors[2] = +{ + { + "quantile", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile, quantile), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "value", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile, value), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__summary_data_point__value_at_quantile__field_indices_by_name[] = { + 0, /* field[0] = quantile */ + 1, /* field[1] = value */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__summary_data_point__value_at_quantile__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__summary_data_point__value_at_quantile__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.SummaryDataPoint.ValueAtQuantile", + "ValueAtQuantile", + "Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile), + 2, + opentelemetry__proto__metrics__v1__summary_data_point__value_at_quantile__field_descriptors, + opentelemetry__proto__metrics__v1__summary_data_point__value_at_quantile__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__summary_data_point__value_at_quantile__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__summary_data_point__value_at_quantile__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__summary_data_point__field_descriptors[7] = +{ + { + "start_time_unix_nano", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__SummaryDataPoint, start_time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "time_unix_nano", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__SummaryDataPoint, time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "count", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__SummaryDataPoint, count), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "sum", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_DOUBLE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__SummaryDataPoint, sum), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "quantile_values", + 6, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__SummaryDataPoint, n_quantile_values), + offsetof(Opentelemetry__Proto__Metrics__V1__SummaryDataPoint, quantile_values), + &opentelemetry__proto__metrics__v1__summary_data_point__value_at_quantile__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "attributes", + 7, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__SummaryDataPoint, n_attributes), + offsetof(Opentelemetry__Proto__Metrics__V1__SummaryDataPoint, attributes), + &opentelemetry__proto__common__v1__key_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "flags", + 8, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__SummaryDataPoint, flags), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__summary_data_point__field_indices_by_name[] = { + 5, /* field[5] = attributes */ + 2, /* field[2] = count */ + 6, /* field[6] = flags */ + 4, /* field[4] = quantile_values */ + 0, /* field[0] = start_time_unix_nano */ + 3, /* field[3] = sum */ + 1, /* field[1] = time_unix_nano */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__summary_data_point__number_ranges[1 + 1] = +{ + { 2, 0 }, + { 0, 7 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__summary_data_point__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.SummaryDataPoint", + "SummaryDataPoint", + "Opentelemetry__Proto__Metrics__V1__SummaryDataPoint", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__SummaryDataPoint), + 7, + opentelemetry__proto__metrics__v1__summary_data_point__field_descriptors, + opentelemetry__proto__metrics__v1__summary_data_point__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__summary_data_point__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__summary_data_point__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__metrics__v1__exemplar__field_descriptors[6] = +{ + { + "time_unix_nano", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__Exemplar, time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "as_double", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_DOUBLE, + offsetof(Opentelemetry__Proto__Metrics__V1__Exemplar, value_case), + offsetof(Opentelemetry__Proto__Metrics__V1__Exemplar, as_double), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "span_id", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BYTES, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__Exemplar, span_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "trace_id", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BYTES, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Metrics__V1__Exemplar, trace_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "as_int", + 6, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_SFIXED64, + offsetof(Opentelemetry__Proto__Metrics__V1__Exemplar, value_case), + offsetof(Opentelemetry__Proto__Metrics__V1__Exemplar, as_int), + NULL, + NULL, + 0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "filtered_attributes", + 7, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Metrics__V1__Exemplar, n_filtered_attributes), + offsetof(Opentelemetry__Proto__Metrics__V1__Exemplar, filtered_attributes), + &opentelemetry__proto__common__v1__key_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__metrics__v1__exemplar__field_indices_by_name[] = { + 1, /* field[1] = as_double */ + 4, /* field[4] = as_int */ + 5, /* field[5] = filtered_attributes */ + 2, /* field[2] = span_id */ + 0, /* field[0] = time_unix_nano */ + 3, /* field[3] = trace_id */ +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__exemplar__number_ranges[1 + 1] = +{ + { 2, 0 }, + { 0, 6 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__exemplar__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.Exemplar", + "Exemplar", + "Opentelemetry__Proto__Metrics__V1__Exemplar", + "opentelemetry.proto.metrics.v1", + sizeof(Opentelemetry__Proto__Metrics__V1__Exemplar), + 6, + opentelemetry__proto__metrics__v1__exemplar__field_descriptors, + opentelemetry__proto__metrics__v1__exemplar__field_indices_by_name, + 1, opentelemetry__proto__metrics__v1__exemplar__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__metrics__v1__exemplar__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCEnumValue opentelemetry__proto__metrics__v1__aggregation_temporality__enum_values_by_number[3] = +{ + { "AGGREGATION_TEMPORALITY_UNSPECIFIED", "OPENTELEMETRY__PROTO__METRICS__V1__AGGREGATION_TEMPORALITY__AGGREGATION_TEMPORALITY_UNSPECIFIED", 0 }, + { "AGGREGATION_TEMPORALITY_DELTA", "OPENTELEMETRY__PROTO__METRICS__V1__AGGREGATION_TEMPORALITY__AGGREGATION_TEMPORALITY_DELTA", 1 }, + { "AGGREGATION_TEMPORALITY_CUMULATIVE", "OPENTELEMETRY__PROTO__METRICS__V1__AGGREGATION_TEMPORALITY__AGGREGATION_TEMPORALITY_CUMULATIVE", 2 }, +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__aggregation_temporality__value_ranges[] = { +{0, 0},{0, 3} +}; +static const ProtobufCEnumValueIndex opentelemetry__proto__metrics__v1__aggregation_temporality__enum_values_by_name[3] = +{ + { "AGGREGATION_TEMPORALITY_CUMULATIVE", 2 }, + { "AGGREGATION_TEMPORALITY_DELTA", 1 }, + { "AGGREGATION_TEMPORALITY_UNSPECIFIED", 0 }, +}; +const ProtobufCEnumDescriptor opentelemetry__proto__metrics__v1__aggregation_temporality__descriptor = +{ + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.AggregationTemporality", + "AggregationTemporality", + "Opentelemetry__Proto__Metrics__V1__AggregationTemporality", + "opentelemetry.proto.metrics.v1", + 3, + opentelemetry__proto__metrics__v1__aggregation_temporality__enum_values_by_number, + 3, + opentelemetry__proto__metrics__v1__aggregation_temporality__enum_values_by_name, + 1, + opentelemetry__proto__metrics__v1__aggregation_temporality__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCEnumValue opentelemetry__proto__metrics__v1__data_point_flags__enum_values_by_number[2] = +{ + { "FLAG_NONE", "OPENTELEMETRY__PROTO__METRICS__V1__DATA_POINT_FLAGS__FLAG_NONE", 0 }, + { "FLAG_NO_RECORDED_VALUE", "OPENTELEMETRY__PROTO__METRICS__V1__DATA_POINT_FLAGS__FLAG_NO_RECORDED_VALUE", 1 }, +}; +static const ProtobufCIntRange opentelemetry__proto__metrics__v1__data_point_flags__value_ranges[] = { +{0, 0},{0, 2} +}; +static const ProtobufCEnumValueIndex opentelemetry__proto__metrics__v1__data_point_flags__enum_values_by_name[2] = +{ + { "FLAG_NONE", 0 }, + { "FLAG_NO_RECORDED_VALUE", 1 }, +}; +const ProtobufCEnumDescriptor opentelemetry__proto__metrics__v1__data_point_flags__descriptor = +{ + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "opentelemetry.proto.metrics.v1.DataPointFlags", + "DataPointFlags", + "Opentelemetry__Proto__Metrics__V1__DataPointFlags", + "opentelemetry.proto.metrics.v1", + 2, + opentelemetry__proto__metrics__v1__data_point_flags__enum_values_by_number, + 2, + opentelemetry__proto__metrics__v1__data_point_flags__enum_values_by_name, + 1, + opentelemetry__proto__metrics__v1__data_point_flags__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/metrics/v1/metrics.pb-c.h b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/metrics/v1/metrics.pb-c.h new file mode 100644 index 000000000..938147690 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/metrics/v1/metrics.pb-c.h @@ -0,0 +1,1207 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/metrics/v1/metrics.proto */ + +#ifndef PROTOBUF_C_opentelemetry_2fproto_2fmetrics_2fv1_2fmetrics_2eproto__INCLUDED +#define PROTOBUF_C_opentelemetry_2fproto_2fmetrics_2fv1_2fmetrics_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1004001 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + +#include "opentelemetry/proto/common/v1/common.pb-c.h" +#include "opentelemetry/proto/resource/v1/resource.pb-c.h" + +typedef struct Opentelemetry__Proto__Metrics__V1__MetricsData Opentelemetry__Proto__Metrics__V1__MetricsData; +typedef struct Opentelemetry__Proto__Metrics__V1__ResourceMetrics Opentelemetry__Proto__Metrics__V1__ResourceMetrics; +typedef struct Opentelemetry__Proto__Metrics__V1__ScopeMetrics Opentelemetry__Proto__Metrics__V1__ScopeMetrics; +typedef struct Opentelemetry__Proto__Metrics__V1__Metric Opentelemetry__Proto__Metrics__V1__Metric; +typedef struct Opentelemetry__Proto__Metrics__V1__Gauge Opentelemetry__Proto__Metrics__V1__Gauge; +typedef struct Opentelemetry__Proto__Metrics__V1__Sum Opentelemetry__Proto__Metrics__V1__Sum; +typedef struct Opentelemetry__Proto__Metrics__V1__Histogram Opentelemetry__Proto__Metrics__V1__Histogram; +typedef struct Opentelemetry__Proto__Metrics__V1__ExponentialHistogram Opentelemetry__Proto__Metrics__V1__ExponentialHistogram; +typedef struct Opentelemetry__Proto__Metrics__V1__Summary Opentelemetry__Proto__Metrics__V1__Summary; +typedef struct Opentelemetry__Proto__Metrics__V1__NumberDataPoint Opentelemetry__Proto__Metrics__V1__NumberDataPoint; +typedef struct Opentelemetry__Proto__Metrics__V1__HistogramDataPoint Opentelemetry__Proto__Metrics__V1__HistogramDataPoint; +typedef struct Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint; +typedef struct Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets; +typedef struct Opentelemetry__Proto__Metrics__V1__SummaryDataPoint Opentelemetry__Proto__Metrics__V1__SummaryDataPoint; +typedef struct Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile; +typedef struct Opentelemetry__Proto__Metrics__V1__Exemplar Opentelemetry__Proto__Metrics__V1__Exemplar; + + +/* --- enums --- */ + +/* + * AggregationTemporality defines how a metric aggregator reports aggregated + * values. It describes how those values relate to the time interval over + * which they are aggregated. + */ +typedef enum _Opentelemetry__Proto__Metrics__V1__AggregationTemporality { + /* + * UNSPECIFIED is the default AggregationTemporality, it MUST not be used. + */ + OPENTELEMETRY__PROTO__METRICS__V1__AGGREGATION_TEMPORALITY__AGGREGATION_TEMPORALITY_UNSPECIFIED = 0, + /* + * DELTA is an AggregationTemporality for a metric aggregator which reports + * changes since last report time. Successive metrics contain aggregation of + * values from continuous and non-overlapping intervals. + * The values for a DELTA metric are based only on the time interval + * associated with one measurement cycle. There is no dependency on + * previous measurements like is the case for CUMULATIVE metrics. + * For example, consider a system measuring the number of requests that + * it receives and reports the sum of these requests every second as a + * DELTA metric: + * 1. The system starts receiving at time=t_0. + * 2. A request is received, the system measures 1 request. + * 3. A request is received, the system measures 1 request. + * 4. A request is received, the system measures 1 request. + * 5. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_0 to + * t_0+1 with a value of 3. + * 6. A request is received, the system measures 1 request. + * 7. A request is received, the system measures 1 request. + * 8. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_0+1 to + * t_0+2 with a value of 2. + */ + OPENTELEMETRY__PROTO__METRICS__V1__AGGREGATION_TEMPORALITY__AGGREGATION_TEMPORALITY_DELTA = 1, + /* + * CUMULATIVE is an AggregationTemporality for a metric aggregator which + * reports changes since a fixed start time. This means that current values + * of a CUMULATIVE metric depend on all previous measurements since the + * start time. Because of this, the sender is required to retain this state + * in some form. If this state is lost or invalidated, the CUMULATIVE metric + * values MUST be reset and a new fixed start time following the last + * reported measurement time sent MUST be used. + * For example, consider a system measuring the number of requests that + * it receives and reports the sum of these requests every second as a + * CUMULATIVE metric: + * 1. The system starts receiving at time=t_0. + * 2. A request is received, the system measures 1 request. + * 3. A request is received, the system measures 1 request. + * 4. A request is received, the system measures 1 request. + * 5. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_0 to + * t_0+1 with a value of 3. + * 6. A request is received, the system measures 1 request. + * 7. A request is received, the system measures 1 request. + * 8. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_0 to + * t_0+2 with a value of 5. + * 9. The system experiences a fault and loses state. + * 10. The system recovers and resumes receiving at time=t_1. + * 11. A request is received, the system measures 1 request. + * 12. The 1 second collection cycle ends. A metric is exported for the + * number of requests received over the interval of time t_1 to + * t_0+1 with a value of 1. + * Note: Even though, when reporting changes since last report time, using + * CUMULATIVE is valid, it is not recommended. This may cause problems for + * systems that do not use start_time to determine when the aggregation + * value was reset (e.g. Prometheus). + */ + OPENTELEMETRY__PROTO__METRICS__V1__AGGREGATION_TEMPORALITY__AGGREGATION_TEMPORALITY_CUMULATIVE = 2 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(OPENTELEMETRY__PROTO__METRICS__V1__AGGREGATION_TEMPORALITY) +} Opentelemetry__Proto__Metrics__V1__AggregationTemporality; +/* + * DataPointFlags is defined as a protobuf 'uint32' type and is to be used as a + * bit-field representing 32 distinct boolean flags. Each flag defined in this + * enum is a bit-mask. To test the presence of a single flag in the flags of + * a data point, for example, use an expression like: + * (point.flags & FLAG_NO_RECORDED_VALUE) == FLAG_NO_RECORDED_VALUE + */ +typedef enum _Opentelemetry__Proto__Metrics__V1__DataPointFlags { + OPENTELEMETRY__PROTO__METRICS__V1__DATA_POINT_FLAGS__FLAG_NONE = 0, + /* + * This DataPoint is valid but has no recorded value. This value + * SHOULD be used to reflect explicitly missing data in a series, as + * for an equivalent to the Prometheus "staleness marker". + */ + OPENTELEMETRY__PROTO__METRICS__V1__DATA_POINT_FLAGS__FLAG_NO_RECORDED_VALUE = 1 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(OPENTELEMETRY__PROTO__METRICS__V1__DATA_POINT_FLAGS) +} Opentelemetry__Proto__Metrics__V1__DataPointFlags; + +/* --- messages --- */ + +/* + * MetricsData represents the metrics data that can be stored in a persistent + * storage, OR can be embedded by other protocols that transfer OTLP metrics + * data but do not implement the OTLP protocol. + * The main difference between this message and collector protocol is that + * in this message there will not be any "control" or "metadata" specific to + * OTLP protocol. + * When new fields are added into this message, the OTLP request MUST be updated + * as well. + */ +struct Opentelemetry__Proto__Metrics__V1__MetricsData +{ + ProtobufCMessage base; + /* + * An array of ResourceMetrics. + * For data coming from a single resource this array will typically contain + * one element. Intermediary nodes that receive data from multiple origins + * typically batch the data before forwarding further and in that case this + * array will contain multiple elements. + */ + size_t n_resource_metrics; + Opentelemetry__Proto__Metrics__V1__ResourceMetrics **resource_metrics; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__METRICS_DATA__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__metrics_data__descriptor) \ + , 0,NULL } + + +/* + * A collection of ScopeMetrics from a Resource. + */ +struct Opentelemetry__Proto__Metrics__V1__ResourceMetrics +{ + ProtobufCMessage base; + /* + * The resource for the metrics in this message. + * If this field is not set then no resource info is known. + */ + Opentelemetry__Proto__Resource__V1__Resource *resource; + /* + * A list of metrics that originate from a resource. + */ + size_t n_scope_metrics; + Opentelemetry__Proto__Metrics__V1__ScopeMetrics **scope_metrics; + /* + * This schema_url applies to the data in the "resource" field. It does not apply + * to the data in the "scope_metrics" field which have their own schema_url field. + */ + char *schema_url; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__RESOURCE_METRICS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__resource_metrics__descriptor) \ + , NULL, 0,NULL, (char *)protobuf_c_empty_string } + + +/* + * A collection of Metrics produced by an Scope. + */ +struct Opentelemetry__Proto__Metrics__V1__ScopeMetrics +{ + ProtobufCMessage base; + /* + * The instrumentation scope information for the metrics in this message. + * Semantically when InstrumentationScope isn't set, it is equivalent with + * an empty instrumentation scope name (unknown). + */ + Opentelemetry__Proto__Common__V1__InstrumentationScope *scope; + /* + * A list of metrics that originate from an instrumentation library. + */ + size_t n_metrics; + Opentelemetry__Proto__Metrics__V1__Metric **metrics; + /* + * This schema_url applies to all metrics in the "metrics" field. + */ + char *schema_url; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__SCOPE_METRICS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__scope_metrics__descriptor) \ + , NULL, 0,NULL, (char *)protobuf_c_empty_string } + + +typedef enum { + OPENTELEMETRY__PROTO__METRICS__V1__METRIC__DATA__NOT_SET = 0, + OPENTELEMETRY__PROTO__METRICS__V1__METRIC__DATA_GAUGE = 5, + OPENTELEMETRY__PROTO__METRICS__V1__METRIC__DATA_SUM = 7, + OPENTELEMETRY__PROTO__METRICS__V1__METRIC__DATA_HISTOGRAM = 9, + OPENTELEMETRY__PROTO__METRICS__V1__METRIC__DATA_EXPONENTIAL_HISTOGRAM = 10, + OPENTELEMETRY__PROTO__METRICS__V1__METRIC__DATA_SUMMARY = 11 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(OPENTELEMETRY__PROTO__METRICS__V1__METRIC__DATA__CASE) +} Opentelemetry__Proto__Metrics__V1__Metric__DataCase; + +/* + * Defines a Metric which has one or more timeseries. The following is a + * brief summary of the Metric data model. For more details, see: + * https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/data-model.md + * The data model and relation between entities is shown in the + * diagram below. Here, "DataPoint" is the term used to refer to any + * one of the specific data point value types, and "points" is the term used + * to refer to any one of the lists of points contained in the Metric. + * - Metric is composed of a metadata and data. + * - Metadata part contains a name, description, unit. + * - Data is one of the possible types (Sum, Gauge, Histogram, Summary). + * - DataPoint contains timestamps, attributes, and one of the possible value type + * fields. + * Metric + * +------------+ + * |name | + * |description | + * |unit | +------------------------------------+ + * |data |---> |Gauge, Sum, Histogram, Summary, ... | + * +------------+ +------------------------------------+ + * Data [One of Gauge, Sum, Histogram, Summary, ...] + * +-----------+ + * |... | // Metadata about the Data. + * |points |--+ + * +-----------+ | + * | +---------------------------+ + * | |DataPoint 1 | + * v |+------+------+ +------+ | + * +-----+ ||label |label |...|label | | + * | 1 |-->||value1|value2|...|valueN| | + * +-----+ |+------+------+ +------+ | + * | . | |+-----+ | + * | . | ||value| | + * | . | |+-----+ | + * | . | +---------------------------+ + * | . | . + * | . | . + * | . | . + * | . | +---------------------------+ + * | . | |DataPoint M | + * +-----+ |+------+------+ +------+ | + * | M |-->||label |label |...|label | | + * +-----+ ||value1|value2|...|valueN| | + * |+------+------+ +------+ | + * |+-----+ | + * ||value| | + * |+-----+ | + * +---------------------------+ + * Each distinct type of DataPoint represents the output of a specific + * aggregation function, the result of applying the DataPoint's + * associated function of to one or more measurements. + * All DataPoint types have three common fields: + * - Attributes includes key-value pairs associated with the data point + * - TimeUnixNano is required, set to the end time of the aggregation + * - StartTimeUnixNano is optional, but strongly encouraged for DataPoints + * having an AggregationTemporality field, as discussed below. + * Both TimeUnixNano and StartTimeUnixNano values are expressed as + * UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + * # TimeUnixNano + * This field is required, having consistent interpretation across + * DataPoint types. TimeUnixNano is the moment corresponding to when + * the data point's aggregate value was captured. + * Data points with the 0 value for TimeUnixNano SHOULD be rejected + * by consumers. + * # StartTimeUnixNano + * StartTimeUnixNano in general allows detecting when a sequence of + * observations is unbroken. This field indicates to consumers the + * start time for points with cumulative and delta + * AggregationTemporality, and it should be included whenever possible + * to support correct rate calculation. Although it may be omitted + * when the start time is truly unknown, setting StartTimeUnixNano is + * strongly encouraged. + */ +struct Opentelemetry__Proto__Metrics__V1__Metric +{ + ProtobufCMessage base; + /* + * name of the metric, including its DNS name prefix. It must be unique. + */ + char *name; + /* + * description of the metric, which can be used in documentation. + */ + char *description; + /* + * unit in which the metric value is reported. Follows the format + * described by http://unitsofmeasure.org/ucum.html. + */ + char *unit; + Opentelemetry__Proto__Metrics__V1__Metric__DataCase data_case; + union { + Opentelemetry__Proto__Metrics__V1__Gauge *gauge; + Opentelemetry__Proto__Metrics__V1__Sum *sum; + Opentelemetry__Proto__Metrics__V1__Histogram *histogram; + Opentelemetry__Proto__Metrics__V1__ExponentialHistogram *exponential_histogram; + Opentelemetry__Proto__Metrics__V1__Summary *summary; + }; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__METRIC__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__metric__descriptor) \ + , (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, (char *)protobuf_c_empty_string, OPENTELEMETRY__PROTO__METRICS__V1__METRIC__DATA__NOT_SET, {0} } + + +/* + * Gauge represents the type of a scalar metric that always exports the + * "current value" for every data point. It should be used for an "unknown" + * aggregation. + * A Gauge does not support different aggregation temporalities. Given the + * aggregation is unknown, points cannot be combined using the same + * aggregation, regardless of aggregation temporalities. Therefore, + * AggregationTemporality is not included. Consequently, this also means + * "StartTimeUnixNano" is ignored for all data points. + */ +struct Opentelemetry__Proto__Metrics__V1__Gauge +{ + ProtobufCMessage base; + size_t n_data_points; + Opentelemetry__Proto__Metrics__V1__NumberDataPoint **data_points; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__GAUGE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__gauge__descriptor) \ + , 0,NULL } + + +/* + * Sum represents the type of a scalar metric that is calculated as a sum of all + * reported measurements over a time interval. + */ +struct Opentelemetry__Proto__Metrics__V1__Sum +{ + ProtobufCMessage base; + size_t n_data_points; + Opentelemetry__Proto__Metrics__V1__NumberDataPoint **data_points; + /* + * aggregation_temporality describes if the aggregator reports delta changes + * since last report time, or cumulative changes since a fixed start time. + */ + Opentelemetry__Proto__Metrics__V1__AggregationTemporality aggregation_temporality; + /* + * If "true" means that the sum is monotonic. + */ + protobuf_c_boolean is_monotonic; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__SUM__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__sum__descriptor) \ + , 0,NULL, OPENTELEMETRY__PROTO__METRICS__V1__AGGREGATION_TEMPORALITY__AGGREGATION_TEMPORALITY_UNSPECIFIED, 0 } + + +/* + * Histogram represents the type of a metric that is calculated by aggregating + * as a Histogram of all reported measurements over a time interval. + */ +struct Opentelemetry__Proto__Metrics__V1__Histogram +{ + ProtobufCMessage base; + size_t n_data_points; + Opentelemetry__Proto__Metrics__V1__HistogramDataPoint **data_points; + /* + * aggregation_temporality describes if the aggregator reports delta changes + * since last report time, or cumulative changes since a fixed start time. + */ + Opentelemetry__Proto__Metrics__V1__AggregationTemporality aggregation_temporality; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__HISTOGRAM__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__histogram__descriptor) \ + , 0,NULL, OPENTELEMETRY__PROTO__METRICS__V1__AGGREGATION_TEMPORALITY__AGGREGATION_TEMPORALITY_UNSPECIFIED } + + +/* + * ExponentialHistogram represents the type of a metric that is calculated by aggregating + * as a ExponentialHistogram of all reported double measurements over a time interval. + */ +struct Opentelemetry__Proto__Metrics__V1__ExponentialHistogram +{ + ProtobufCMessage base; + size_t n_data_points; + Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint **data_points; + /* + * aggregation_temporality describes if the aggregator reports delta changes + * since last report time, or cumulative changes since a fixed start time. + */ + Opentelemetry__Proto__Metrics__V1__AggregationTemporality aggregation_temporality; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__EXPONENTIAL_HISTOGRAM__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__exponential_histogram__descriptor) \ + , 0,NULL, OPENTELEMETRY__PROTO__METRICS__V1__AGGREGATION_TEMPORALITY__AGGREGATION_TEMPORALITY_UNSPECIFIED } + + +/* + * Summary metric data are used to convey quantile summaries, + * a Prometheus (see: https://prometheus.io/docs/concepts/metric_types/#summary) + * and OpenMetrics (see: https://github.com/OpenObservability/OpenMetrics/blob/4dbf6075567ab43296eed941037c12951faafb92/protos/prometheus.proto#L45) + * data type. These data points cannot always be merged in a meaningful way. + * While they can be useful in some applications, histogram data points are + * recommended for new applications. + */ +struct Opentelemetry__Proto__Metrics__V1__Summary +{ + ProtobufCMessage base; + size_t n_data_points; + Opentelemetry__Proto__Metrics__V1__SummaryDataPoint **data_points; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__SUMMARY__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__summary__descriptor) \ + , 0,NULL } + + +typedef enum { + OPENTELEMETRY__PROTO__METRICS__V1__NUMBER_DATA_POINT__VALUE__NOT_SET = 0, + OPENTELEMETRY__PROTO__METRICS__V1__NUMBER_DATA_POINT__VALUE_AS_DOUBLE = 4, + OPENTELEMETRY__PROTO__METRICS__V1__NUMBER_DATA_POINT__VALUE_AS_INT = 6 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(OPENTELEMETRY__PROTO__METRICS__V1__NUMBER_DATA_POINT__VALUE__CASE) +} Opentelemetry__Proto__Metrics__V1__NumberDataPoint__ValueCase; + +/* + * NumberDataPoint is a single data point in a timeseries that describes the + * time-varying scalar value of a metric. + */ +struct Opentelemetry__Proto__Metrics__V1__NumberDataPoint +{ + ProtobufCMessage base; + /* + * The set of key/value pairs that uniquely identify the timeseries from + * where this point belongs. The list may be empty (may contain 0 elements). + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + */ + size_t n_attributes; + Opentelemetry__Proto__Common__V1__KeyValue **attributes; + /* + * StartTimeUnixNano is optional but strongly encouraged, see the + * the detailed comments above Metric. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + */ + uint64_t start_time_unix_nano; + /* + * TimeUnixNano is required, see the detailed comments above Metric. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + */ + uint64_t time_unix_nano; + /* + * (Optional) List of exemplars collected from + * measurements that were used to form the data point + */ + size_t n_exemplars; + Opentelemetry__Proto__Metrics__V1__Exemplar **exemplars; + /* + * Flags that apply to this specific data point. See DataPointFlags + * for the available flags and their meaning. + */ + uint32_t flags; + Opentelemetry__Proto__Metrics__V1__NumberDataPoint__ValueCase value_case; + union { + double as_double; + int64_t as_int; + }; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__NUMBER_DATA_POINT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__number_data_point__descriptor) \ + , 0,NULL, 0, 0, 0,NULL, 0, OPENTELEMETRY__PROTO__METRICS__V1__NUMBER_DATA_POINT__VALUE__NOT_SET, {0} } + + +/* + * HistogramDataPoint is a single data point in a timeseries that describes the + * time-varying values of a Histogram. A Histogram contains summary statistics + * for a population of values, it may optionally contain the distribution of + * those values across a set of buckets. + * If the histogram contains the distribution of values, then both + * "explicit_bounds" and "bucket counts" fields must be defined. + * If the histogram does not contain the distribution of values, then both + * "explicit_bounds" and "bucket_counts" must be omitted and only "count" and + * "sum" are known. + */ +struct Opentelemetry__Proto__Metrics__V1__HistogramDataPoint +{ + ProtobufCMessage base; + /* + * The set of key/value pairs that uniquely identify the timeseries from + * where this point belongs. The list may be empty (may contain 0 elements). + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + */ + size_t n_attributes; + Opentelemetry__Proto__Common__V1__KeyValue **attributes; + /* + * StartTimeUnixNano is optional but strongly encouraged, see the + * the detailed comments above Metric. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + */ + uint64_t start_time_unix_nano; + /* + * TimeUnixNano is required, see the detailed comments above Metric. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + */ + uint64_t time_unix_nano; + /* + * count is the number of values in the population. Must be non-negative. This + * value must be equal to the sum of the "count" fields in buckets if a + * histogram is provided. + */ + uint64_t count; + /* + * sum of the values in the population. If count is zero then this field + * must be zero. + * Note: Sum should only be filled out when measuring non-negative discrete + * events, and is assumed to be monotonic over the values of these events. + * Negative events *can* be recorded, but sum should not be filled out when + * doing so. This is specifically to enforce compatibility w/ OpenMetrics, + * see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram + */ + double sum; + /* + * bucket_counts is an optional field contains the count values of histogram + * for each bucket. + * The sum of the bucket_counts must equal the value in the count field. + * The number of elements in bucket_counts array must be by one greater than + * the number of elements in explicit_bounds array. + */ + size_t n_bucket_counts; + uint64_t *bucket_counts; + /* + * explicit_bounds specifies buckets with explicitly defined bounds for values. + * The boundaries for bucket at index i are: + * (-infinity, explicit_bounds[i]] for i == 0 + * (explicit_bounds[i-1], explicit_bounds[i]] for 0 < i < size(explicit_bounds) + * (explicit_bounds[i-1], +infinity) for i == size(explicit_bounds) + * The values in the explicit_bounds array must be strictly increasing. + * Histogram buckets are inclusive of their upper boundary, except the last + * bucket where the boundary is at infinity. This format is intentionally + * compatible with the OpenMetrics histogram definition. + */ + size_t n_explicit_bounds; + double *explicit_bounds; + /* + * (Optional) List of exemplars collected from + * measurements that were used to form the data point + */ + size_t n_exemplars; + Opentelemetry__Proto__Metrics__V1__Exemplar **exemplars; + /* + * Flags that apply to this specific data point. See DataPointFlags + * for the available flags and their meaning. + */ + uint32_t flags; + /* + * min is the minimum value over (start_time, end_time]. + */ + double min; + /* + * max is the maximum value over (start_time, end_time]. + */ + double max; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__HISTOGRAM_DATA_POINT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__histogram_data_point__descriptor) \ + , 0,NULL, 0, 0, 0, 0, 0,NULL, 0,NULL, 0,NULL, 0, 0, 0 } + + +/* + * Buckets are a set of bucket counts, encoded in a contiguous array + * of counts. + */ +struct Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets +{ + ProtobufCMessage base; + /* + * Offset is the bucket index of the first entry in the bucket_counts array. + * + * Note: This uses a varint encoding as a simple form of compression. + */ + int32_t offset; + /* + * Count is an array of counts, where count[i] carries the count + * of the bucket at index (offset+i). count[i] is the count of + * values greater than base^(offset+i) and less or equal to than + * base^(offset+i+1). + * Note: By contrast, the explicit HistogramDataPoint uses + * fixed64. This field is expected to have many buckets, + * especially zeros, so uint64 has been selected to ensure + * varint encoding. + */ + size_t n_bucket_counts; + uint64_t *bucket_counts; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__EXPONENTIAL_HISTOGRAM_DATA_POINT__BUCKETS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__descriptor) \ + , 0, 0,NULL } + + +/* + * ExponentialHistogramDataPoint is a single data point in a timeseries that describes the + * time-varying values of a ExponentialHistogram of double values. A ExponentialHistogram contains + * summary statistics for a population of values, it may optionally contain the + * distribution of those values across a set of buckets. + */ +struct Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint +{ + ProtobufCMessage base; + /* + * The set of key/value pairs that uniquely identify the timeseries from + * where this point belongs. The list may be empty (may contain 0 elements). + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + */ + size_t n_attributes; + Opentelemetry__Proto__Common__V1__KeyValue **attributes; + /* + * StartTimeUnixNano is optional but strongly encouraged, see the + * the detailed comments above Metric. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + */ + uint64_t start_time_unix_nano; + /* + * TimeUnixNano is required, see the detailed comments above Metric. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + */ + uint64_t time_unix_nano; + /* + * count is the number of values in the population. Must be + * non-negative. This value must be equal to the sum of the "bucket_counts" + * values in the positive and negative Buckets plus the "zero_count" field. + */ + uint64_t count; + /* + * sum of the values in the population. If count is zero then this field + * must be zero. + * Note: Sum should only be filled out when measuring non-negative discrete + * events, and is assumed to be monotonic over the values of these events. + * Negative events *can* be recorded, but sum should not be filled out when + * doing so. This is specifically to enforce compatibility w/ OpenMetrics, + * see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram + */ + double sum; + /* + * scale describes the resolution of the histogram. Boundaries are + * located at powers of the base, where: + * base = (2^(2^-scale)) + * The histogram bucket identified by `index`, a signed integer, + * contains values that are greater than (base^index) and + * less than or equal to (base^(index+1)). + * The positive and negative ranges of the histogram are expressed + * separately. Negative values are mapped by their absolute value + * into the negative range using the same scale as the positive range. + * scale is not restricted by the protocol, as the permissible + * values depend on the range of the data. + */ + int32_t scale; + /* + * zero_count is the count of values that are either exactly zero or + * within the region considered zero by the instrumentation at the + * tolerated degree of precision. This bucket stores values that + * cannot be expressed using the standard exponential formula as + * well as values that have been rounded to zero. + * Implementations MAY consider the zero bucket to have probability + * mass equal to (zero_count / count). + */ + uint64_t zero_count; + /* + * positive carries the positive range of exponential bucket counts. + */ + Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets *positive; + /* + * negative carries the negative range of exponential bucket counts. + */ + Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets *negative; + /* + * Flags that apply to this specific data point. See DataPointFlags + * for the available flags and their meaning. + */ + uint32_t flags; + /* + * (Optional) List of exemplars collected from + * measurements that were used to form the data point + */ + size_t n_exemplars; + Opentelemetry__Proto__Metrics__V1__Exemplar **exemplars; + /* + * min is the minimum value over (start_time, end_time]. + */ + double min; + /* + * max is the maximum value over (start_time, end_time]. + */ + double max; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__EXPONENTIAL_HISTOGRAM_DATA_POINT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__exponential_histogram_data_point__descriptor) \ + , 0,NULL, 0, 0, 0, 0, 0, 0, NULL, NULL, 0, 0,NULL, 0, 0 } + + +/* + * Represents the value at a given quantile of a distribution. + * To record Min and Max values following conventions are used: + * - The 1.0 quantile is equivalent to the maximum value observed. + * - The 0.0 quantile is equivalent to the minimum value observed. + * See the following issue for more context: + * https://github.com/open-telemetry/opentelemetry-proto/issues/125 + */ +struct Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile +{ + ProtobufCMessage base; + /* + * The quantile of a distribution. Must be in the interval + * [0.0, 1.0]. + */ + double quantile; + /* + * The value at the given quantile of a distribution. + * Quantile values must NOT be negative. + */ + double value; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__SUMMARY_DATA_POINT__VALUE_AT_QUANTILE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__summary_data_point__value_at_quantile__descriptor) \ + , 0, 0 } + + +/* + * SummaryDataPoint is a single data point in a timeseries that describes the + * time-varying values of a Summary metric. + */ +struct Opentelemetry__Proto__Metrics__V1__SummaryDataPoint +{ + ProtobufCMessage base; + /* + * The set of key/value pairs that uniquely identify the timeseries from + * where this point belongs. The list may be empty (may contain 0 elements). + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + */ + size_t n_attributes; + Opentelemetry__Proto__Common__V1__KeyValue **attributes; + /* + * StartTimeUnixNano is optional but strongly encouraged, see the + * the detailed comments above Metric. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + */ + uint64_t start_time_unix_nano; + /* + * TimeUnixNano is required, see the detailed comments above Metric. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + */ + uint64_t time_unix_nano; + /* + * count is the number of values in the population. Must be non-negative. + */ + uint64_t count; + /* + * sum of the values in the population. If count is zero then this field + * must be zero. + * Note: Sum should only be filled out when measuring non-negative discrete + * events, and is assumed to be monotonic over the values of these events. + * Negative events *can* be recorded, but sum should not be filled out when + * doing so. This is specifically to enforce compatibility w/ OpenMetrics, + * see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#summary + */ + double sum; + /* + * (Optional) list of values at different quantiles of the distribution calculated + * from the current snapshot. The quantiles must be strictly increasing. + */ + size_t n_quantile_values; + Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile **quantile_values; + /* + * Flags that apply to this specific data point. See DataPointFlags + * for the available flags and their meaning. + */ + uint32_t flags; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__SUMMARY_DATA_POINT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__summary_data_point__descriptor) \ + , 0,NULL, 0, 0, 0, 0, 0,NULL, 0 } + + +typedef enum { + OPENTELEMETRY__PROTO__METRICS__V1__EXEMPLAR__VALUE__NOT_SET = 0, + OPENTELEMETRY__PROTO__METRICS__V1__EXEMPLAR__VALUE_AS_DOUBLE = 3, + OPENTELEMETRY__PROTO__METRICS__V1__EXEMPLAR__VALUE_AS_INT = 6 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(OPENTELEMETRY__PROTO__METRICS__V1__EXEMPLAR__VALUE__CASE) +} Opentelemetry__Proto__Metrics__V1__Exemplar__ValueCase; + +/* + * A representation of an exemplar, which is a sample input measurement. + * Exemplars also hold information about the environment when the measurement + * was recorded, for example the span and trace ID of the active span when the + * exemplar was recorded. + */ +struct Opentelemetry__Proto__Metrics__V1__Exemplar +{ + ProtobufCMessage base; + /* + * The set of key/value pairs that were filtered out by the aggregator, but + * recorded alongside the original measurement. Only key/value pairs that were + * filtered out by the aggregator should be included + */ + size_t n_filtered_attributes; + Opentelemetry__Proto__Common__V1__KeyValue **filtered_attributes; + /* + * time_unix_nano is the exact time when this exemplar was recorded + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January + * 1970. + */ + uint64_t time_unix_nano; + /* + * (Optional) Span ID of the exemplar trace. + * span_id may be missing if the measurement is not recorded inside a trace + * or if the trace is not sampled. + */ + ProtobufCBinaryData span_id; + /* + * (Optional) Trace ID of the exemplar trace. + * trace_id may be missing if the measurement is not recorded inside a trace + * or if the trace is not sampled. + */ + ProtobufCBinaryData trace_id; + Opentelemetry__Proto__Metrics__V1__Exemplar__ValueCase value_case; + union { + double as_double; + int64_t as_int; + }; +}; +#define OPENTELEMETRY__PROTO__METRICS__V1__EXEMPLAR__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__metrics__v1__exemplar__descriptor) \ + , 0,NULL, 0, {0,NULL}, {0,NULL}, OPENTELEMETRY__PROTO__METRICS__V1__EXEMPLAR__VALUE__NOT_SET, {0} } + + +/* Opentelemetry__Proto__Metrics__V1__MetricsData methods */ +void opentelemetry__proto__metrics__v1__metrics_data__init + (Opentelemetry__Proto__Metrics__V1__MetricsData *message); +size_t opentelemetry__proto__metrics__v1__metrics_data__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__MetricsData *message); +size_t opentelemetry__proto__metrics__v1__metrics_data__pack + (const Opentelemetry__Proto__Metrics__V1__MetricsData *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__metrics_data__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__MetricsData *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__MetricsData * + opentelemetry__proto__metrics__v1__metrics_data__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__metrics_data__free_unpacked + (Opentelemetry__Proto__Metrics__V1__MetricsData *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Metrics__V1__ResourceMetrics methods */ +void opentelemetry__proto__metrics__v1__resource_metrics__init + (Opentelemetry__Proto__Metrics__V1__ResourceMetrics *message); +size_t opentelemetry__proto__metrics__v1__resource_metrics__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__ResourceMetrics *message); +size_t opentelemetry__proto__metrics__v1__resource_metrics__pack + (const Opentelemetry__Proto__Metrics__V1__ResourceMetrics *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__resource_metrics__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__ResourceMetrics *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__ResourceMetrics * + opentelemetry__proto__metrics__v1__resource_metrics__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__resource_metrics__free_unpacked + (Opentelemetry__Proto__Metrics__V1__ResourceMetrics *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Metrics__V1__ScopeMetrics methods */ +void opentelemetry__proto__metrics__v1__scope_metrics__init + (Opentelemetry__Proto__Metrics__V1__ScopeMetrics *message); +size_t opentelemetry__proto__metrics__v1__scope_metrics__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__ScopeMetrics *message); +size_t opentelemetry__proto__metrics__v1__scope_metrics__pack + (const Opentelemetry__Proto__Metrics__V1__ScopeMetrics *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__scope_metrics__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__ScopeMetrics *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__ScopeMetrics * + opentelemetry__proto__metrics__v1__scope_metrics__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__scope_metrics__free_unpacked + (Opentelemetry__Proto__Metrics__V1__ScopeMetrics *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Metrics__V1__Metric methods */ +void opentelemetry__proto__metrics__v1__metric__init + (Opentelemetry__Proto__Metrics__V1__Metric *message); +size_t opentelemetry__proto__metrics__v1__metric__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__Metric *message); +size_t opentelemetry__proto__metrics__v1__metric__pack + (const Opentelemetry__Proto__Metrics__V1__Metric *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__metric__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__Metric *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__Metric * + opentelemetry__proto__metrics__v1__metric__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__metric__free_unpacked + (Opentelemetry__Proto__Metrics__V1__Metric *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Metrics__V1__Gauge methods */ +void opentelemetry__proto__metrics__v1__gauge__init + (Opentelemetry__Proto__Metrics__V1__Gauge *message); +size_t opentelemetry__proto__metrics__v1__gauge__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__Gauge *message); +size_t opentelemetry__proto__metrics__v1__gauge__pack + (const Opentelemetry__Proto__Metrics__V1__Gauge *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__gauge__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__Gauge *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__Gauge * + opentelemetry__proto__metrics__v1__gauge__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__gauge__free_unpacked + (Opentelemetry__Proto__Metrics__V1__Gauge *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Metrics__V1__Sum methods */ +void opentelemetry__proto__metrics__v1__sum__init + (Opentelemetry__Proto__Metrics__V1__Sum *message); +size_t opentelemetry__proto__metrics__v1__sum__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__Sum *message); +size_t opentelemetry__proto__metrics__v1__sum__pack + (const Opentelemetry__Proto__Metrics__V1__Sum *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__sum__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__Sum *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__Sum * + opentelemetry__proto__metrics__v1__sum__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__sum__free_unpacked + (Opentelemetry__Proto__Metrics__V1__Sum *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Metrics__V1__Histogram methods */ +void opentelemetry__proto__metrics__v1__histogram__init + (Opentelemetry__Proto__Metrics__V1__Histogram *message); +size_t opentelemetry__proto__metrics__v1__histogram__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__Histogram *message); +size_t opentelemetry__proto__metrics__v1__histogram__pack + (const Opentelemetry__Proto__Metrics__V1__Histogram *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__histogram__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__Histogram *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__Histogram * + opentelemetry__proto__metrics__v1__histogram__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__histogram__free_unpacked + (Opentelemetry__Proto__Metrics__V1__Histogram *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Metrics__V1__ExponentialHistogram methods */ +void opentelemetry__proto__metrics__v1__exponential_histogram__init + (Opentelemetry__Proto__Metrics__V1__ExponentialHistogram *message); +size_t opentelemetry__proto__metrics__v1__exponential_histogram__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogram *message); +size_t opentelemetry__proto__metrics__v1__exponential_histogram__pack + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogram *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__exponential_histogram__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogram *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__ExponentialHistogram * + opentelemetry__proto__metrics__v1__exponential_histogram__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__exponential_histogram__free_unpacked + (Opentelemetry__Proto__Metrics__V1__ExponentialHistogram *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Metrics__V1__Summary methods */ +void opentelemetry__proto__metrics__v1__summary__init + (Opentelemetry__Proto__Metrics__V1__Summary *message); +size_t opentelemetry__proto__metrics__v1__summary__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__Summary *message); +size_t opentelemetry__proto__metrics__v1__summary__pack + (const Opentelemetry__Proto__Metrics__V1__Summary *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__summary__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__Summary *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__Summary * + opentelemetry__proto__metrics__v1__summary__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__summary__free_unpacked + (Opentelemetry__Proto__Metrics__V1__Summary *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Metrics__V1__NumberDataPoint methods */ +void opentelemetry__proto__metrics__v1__number_data_point__init + (Opentelemetry__Proto__Metrics__V1__NumberDataPoint *message); +size_t opentelemetry__proto__metrics__v1__number_data_point__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__NumberDataPoint *message); +size_t opentelemetry__proto__metrics__v1__number_data_point__pack + (const Opentelemetry__Proto__Metrics__V1__NumberDataPoint *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__number_data_point__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__NumberDataPoint *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__NumberDataPoint * + opentelemetry__proto__metrics__v1__number_data_point__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__number_data_point__free_unpacked + (Opentelemetry__Proto__Metrics__V1__NumberDataPoint *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Metrics__V1__HistogramDataPoint methods */ +void opentelemetry__proto__metrics__v1__histogram_data_point__init + (Opentelemetry__Proto__Metrics__V1__HistogramDataPoint *message); +size_t opentelemetry__proto__metrics__v1__histogram_data_point__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__HistogramDataPoint *message); +size_t opentelemetry__proto__metrics__v1__histogram_data_point__pack + (const Opentelemetry__Proto__Metrics__V1__HistogramDataPoint *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__histogram_data_point__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__HistogramDataPoint *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__HistogramDataPoint * + opentelemetry__proto__metrics__v1__histogram_data_point__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__histogram_data_point__free_unpacked + (Opentelemetry__Proto__Metrics__V1__HistogramDataPoint *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets methods */ +void opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__init + (Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets *message); +/* Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint methods */ +void opentelemetry__proto__metrics__v1__exponential_histogram_data_point__init + (Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint *message); +size_t opentelemetry__proto__metrics__v1__exponential_histogram_data_point__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint *message); +size_t opentelemetry__proto__metrics__v1__exponential_histogram_data_point__pack + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__exponential_histogram_data_point__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint * + opentelemetry__proto__metrics__v1__exponential_histogram_data_point__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__exponential_histogram_data_point__free_unpacked + (Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile methods */ +void opentelemetry__proto__metrics__v1__summary_data_point__value_at_quantile__init + (Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile *message); +/* Opentelemetry__Proto__Metrics__V1__SummaryDataPoint methods */ +void opentelemetry__proto__metrics__v1__summary_data_point__init + (Opentelemetry__Proto__Metrics__V1__SummaryDataPoint *message); +size_t opentelemetry__proto__metrics__v1__summary_data_point__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__SummaryDataPoint *message); +size_t opentelemetry__proto__metrics__v1__summary_data_point__pack + (const Opentelemetry__Proto__Metrics__V1__SummaryDataPoint *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__summary_data_point__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__SummaryDataPoint *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__SummaryDataPoint * + opentelemetry__proto__metrics__v1__summary_data_point__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__summary_data_point__free_unpacked + (Opentelemetry__Proto__Metrics__V1__SummaryDataPoint *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Metrics__V1__Exemplar methods */ +void opentelemetry__proto__metrics__v1__exemplar__init + (Opentelemetry__Proto__Metrics__V1__Exemplar *message); +size_t opentelemetry__proto__metrics__v1__exemplar__get_packed_size + (const Opentelemetry__Proto__Metrics__V1__Exemplar *message); +size_t opentelemetry__proto__metrics__v1__exemplar__pack + (const Opentelemetry__Proto__Metrics__V1__Exemplar *message, + uint8_t *out); +size_t opentelemetry__proto__metrics__v1__exemplar__pack_to_buffer + (const Opentelemetry__Proto__Metrics__V1__Exemplar *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Metrics__V1__Exemplar * + opentelemetry__proto__metrics__v1__exemplar__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__metrics__v1__exemplar__free_unpacked + (Opentelemetry__Proto__Metrics__V1__Exemplar *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*Opentelemetry__Proto__Metrics__V1__MetricsData_Closure) + (const Opentelemetry__Proto__Metrics__V1__MetricsData *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__ResourceMetrics_Closure) + (const Opentelemetry__Proto__Metrics__V1__ResourceMetrics *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__ScopeMetrics_Closure) + (const Opentelemetry__Proto__Metrics__V1__ScopeMetrics *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__Metric_Closure) + (const Opentelemetry__Proto__Metrics__V1__Metric *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__Gauge_Closure) + (const Opentelemetry__Proto__Metrics__V1__Gauge *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__Sum_Closure) + (const Opentelemetry__Proto__Metrics__V1__Sum *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__Histogram_Closure) + (const Opentelemetry__Proto__Metrics__V1__Histogram *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__ExponentialHistogram_Closure) + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogram *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__Summary_Closure) + (const Opentelemetry__Proto__Metrics__V1__Summary *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__NumberDataPoint_Closure) + (const Opentelemetry__Proto__Metrics__V1__NumberDataPoint *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__HistogramDataPoint_Closure) + (const Opentelemetry__Proto__Metrics__V1__HistogramDataPoint *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets_Closure) + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint__Buckets *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint_Closure) + (const Opentelemetry__Proto__Metrics__V1__ExponentialHistogramDataPoint *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile_Closure) + (const Opentelemetry__Proto__Metrics__V1__SummaryDataPoint__ValueAtQuantile *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__SummaryDataPoint_Closure) + (const Opentelemetry__Proto__Metrics__V1__SummaryDataPoint *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Metrics__V1__Exemplar_Closure) + (const Opentelemetry__Proto__Metrics__V1__Exemplar *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCEnumDescriptor opentelemetry__proto__metrics__v1__aggregation_temporality__descriptor; +extern const ProtobufCEnumDescriptor opentelemetry__proto__metrics__v1__data_point_flags__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__metrics_data__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__resource_metrics__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__scope_metrics__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__metric__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__gauge__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__sum__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__histogram__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__exponential_histogram__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__summary__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__number_data_point__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__histogram_data_point__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__exponential_histogram_data_point__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__exponential_histogram_data_point__buckets__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__summary_data_point__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__summary_data_point__value_at_quantile__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__metrics__v1__exemplar__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_opentelemetry_2fproto_2fmetrics_2fv1_2fmetrics_2eproto__INCLUDED */ diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/resource/v1/resource.pb-c.c b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/resource/v1/resource.pb-c.c new file mode 100644 index 000000000..c250bf6c4 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/resource/v1/resource.pb-c.c @@ -0,0 +1,105 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/resource/v1/resource.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "opentelemetry/proto/resource/v1/resource.pb-c.h" +void opentelemetry__proto__resource__v1__resource__init + (Opentelemetry__Proto__Resource__V1__Resource *message) +{ + static const Opentelemetry__Proto__Resource__V1__Resource init_value = OPENTELEMETRY__PROTO__RESOURCE__V1__RESOURCE__INIT; + *message = init_value; +} +size_t opentelemetry__proto__resource__v1__resource__get_packed_size + (const Opentelemetry__Proto__Resource__V1__Resource *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__resource__v1__resource__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__resource__v1__resource__pack + (const Opentelemetry__Proto__Resource__V1__Resource *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__resource__v1__resource__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__resource__v1__resource__pack_to_buffer + (const Opentelemetry__Proto__Resource__V1__Resource *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__resource__v1__resource__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Resource__V1__Resource * + opentelemetry__proto__resource__v1__resource__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Resource__V1__Resource *) + protobuf_c_message_unpack (&opentelemetry__proto__resource__v1__resource__descriptor, + allocator, len, data); +} +void opentelemetry__proto__resource__v1__resource__free_unpacked + (Opentelemetry__Proto__Resource__V1__Resource *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__resource__v1__resource__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor opentelemetry__proto__resource__v1__resource__field_descriptors[2] = +{ + { + "attributes", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Resource__V1__Resource, n_attributes), + offsetof(Opentelemetry__Proto__Resource__V1__Resource, attributes), + &opentelemetry__proto__common__v1__key_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dropped_attributes_count", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Resource__V1__Resource, dropped_attributes_count), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__resource__v1__resource__field_indices_by_name[] = { + 0, /* field[0] = attributes */ + 1, /* field[1] = dropped_attributes_count */ +}; +static const ProtobufCIntRange opentelemetry__proto__resource__v1__resource__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__resource__v1__resource__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.resource.v1.Resource", + "Resource", + "Opentelemetry__Proto__Resource__V1__Resource", + "opentelemetry.proto.resource.v1", + sizeof(Opentelemetry__Proto__Resource__V1__Resource), + 2, + opentelemetry__proto__resource__v1__resource__field_descriptors, + opentelemetry__proto__resource__v1__resource__field_indices_by_name, + 1, opentelemetry__proto__resource__v1__resource__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__resource__v1__resource__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/resource/v1/resource.pb-c.h b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/resource/v1/resource.pb-c.h new file mode 100644 index 000000000..f58b87f02 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/resource/v1/resource.pb-c.h @@ -0,0 +1,86 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/resource/v1/resource.proto */ + +#ifndef PROTOBUF_C_opentelemetry_2fproto_2fresource_2fv1_2fresource_2eproto__INCLUDED +#define PROTOBUF_C_opentelemetry_2fproto_2fresource_2fv1_2fresource_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1004001 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + +#include "opentelemetry/proto/common/v1/common.pb-c.h" + +typedef struct Opentelemetry__Proto__Resource__V1__Resource Opentelemetry__Proto__Resource__V1__Resource; + + +/* --- enums --- */ + + +/* --- messages --- */ + +/* + * Resource information. + */ +struct Opentelemetry__Proto__Resource__V1__Resource +{ + ProtobufCMessage base; + /* + * Set of attributes that describe the resource. + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + */ + size_t n_attributes; + Opentelemetry__Proto__Common__V1__KeyValue **attributes; + /* + * dropped_attributes_count is the number of dropped attributes. If the value is 0, then + * no attributes were dropped. + */ + uint32_t dropped_attributes_count; +}; +#define OPENTELEMETRY__PROTO__RESOURCE__V1__RESOURCE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__resource__v1__resource__descriptor) \ + , 0,NULL, 0 } + + +/* Opentelemetry__Proto__Resource__V1__Resource methods */ +void opentelemetry__proto__resource__v1__resource__init + (Opentelemetry__Proto__Resource__V1__Resource *message); +size_t opentelemetry__proto__resource__v1__resource__get_packed_size + (const Opentelemetry__Proto__Resource__V1__Resource *message); +size_t opentelemetry__proto__resource__v1__resource__pack + (const Opentelemetry__Proto__Resource__V1__Resource *message, + uint8_t *out); +size_t opentelemetry__proto__resource__v1__resource__pack_to_buffer + (const Opentelemetry__Proto__Resource__V1__Resource *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Resource__V1__Resource * + opentelemetry__proto__resource__v1__resource__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__resource__v1__resource__free_unpacked + (Opentelemetry__Proto__Resource__V1__Resource *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*Opentelemetry__Proto__Resource__V1__Resource_Closure) + (const Opentelemetry__Proto__Resource__V1__Resource *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor opentelemetry__proto__resource__v1__resource__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_opentelemetry_2fproto_2fresource_2fv1_2fresource_2eproto__INCLUDED */ diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/trace/v1/trace.pb-c.c b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/trace/v1/trace.pb-c.c new file mode 100644 index 000000000..56c2f173a --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/trace/v1/trace.pb-c.c @@ -0,0 +1,916 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/trace/v1/trace.proto */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C__NO_DEPRECATED +#define PROTOBUF_C__NO_DEPRECATED +#endif + +#include "opentelemetry/proto/trace/v1/trace.pb-c.h" +void opentelemetry__proto__trace__v1__traces_data__init + (Opentelemetry__Proto__Trace__V1__TracesData *message) +{ + static const Opentelemetry__Proto__Trace__V1__TracesData init_value = OPENTELEMETRY__PROTO__TRACE__V1__TRACES_DATA__INIT; + *message = init_value; +} +size_t opentelemetry__proto__trace__v1__traces_data__get_packed_size + (const Opentelemetry__Proto__Trace__V1__TracesData *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__traces_data__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__trace__v1__traces_data__pack + (const Opentelemetry__Proto__Trace__V1__TracesData *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__traces_data__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__trace__v1__traces_data__pack_to_buffer + (const Opentelemetry__Proto__Trace__V1__TracesData *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__traces_data__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Trace__V1__TracesData * + opentelemetry__proto__trace__v1__traces_data__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Trace__V1__TracesData *) + protobuf_c_message_unpack (&opentelemetry__proto__trace__v1__traces_data__descriptor, + allocator, len, data); +} +void opentelemetry__proto__trace__v1__traces_data__free_unpacked + (Opentelemetry__Proto__Trace__V1__TracesData *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__traces_data__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__trace__v1__resource_spans__init + (Opentelemetry__Proto__Trace__V1__ResourceSpans *message) +{ + static const Opentelemetry__Proto__Trace__V1__ResourceSpans init_value = OPENTELEMETRY__PROTO__TRACE__V1__RESOURCE_SPANS__INIT; + *message = init_value; +} +size_t opentelemetry__proto__trace__v1__resource_spans__get_packed_size + (const Opentelemetry__Proto__Trace__V1__ResourceSpans *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__resource_spans__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__trace__v1__resource_spans__pack + (const Opentelemetry__Proto__Trace__V1__ResourceSpans *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__resource_spans__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__trace__v1__resource_spans__pack_to_buffer + (const Opentelemetry__Proto__Trace__V1__ResourceSpans *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__resource_spans__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Trace__V1__ResourceSpans * + opentelemetry__proto__trace__v1__resource_spans__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Trace__V1__ResourceSpans *) + protobuf_c_message_unpack (&opentelemetry__proto__trace__v1__resource_spans__descriptor, + allocator, len, data); +} +void opentelemetry__proto__trace__v1__resource_spans__free_unpacked + (Opentelemetry__Proto__Trace__V1__ResourceSpans *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__resource_spans__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__trace__v1__scope_spans__init + (Opentelemetry__Proto__Trace__V1__ScopeSpans *message) +{ + static const Opentelemetry__Proto__Trace__V1__ScopeSpans init_value = OPENTELEMETRY__PROTO__TRACE__V1__SCOPE_SPANS__INIT; + *message = init_value; +} +size_t opentelemetry__proto__trace__v1__scope_spans__get_packed_size + (const Opentelemetry__Proto__Trace__V1__ScopeSpans *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__scope_spans__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__trace__v1__scope_spans__pack + (const Opentelemetry__Proto__Trace__V1__ScopeSpans *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__scope_spans__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__trace__v1__scope_spans__pack_to_buffer + (const Opentelemetry__Proto__Trace__V1__ScopeSpans *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__scope_spans__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Trace__V1__ScopeSpans * + opentelemetry__proto__trace__v1__scope_spans__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Trace__V1__ScopeSpans *) + protobuf_c_message_unpack (&opentelemetry__proto__trace__v1__scope_spans__descriptor, + allocator, len, data); +} +void opentelemetry__proto__trace__v1__scope_spans__free_unpacked + (Opentelemetry__Proto__Trace__V1__ScopeSpans *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__scope_spans__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__trace__v1__span__event__init + (Opentelemetry__Proto__Trace__V1__Span__Event *message) +{ + static const Opentelemetry__Proto__Trace__V1__Span__Event init_value = OPENTELEMETRY__PROTO__TRACE__V1__SPAN__EVENT__INIT; + *message = init_value; +} +void opentelemetry__proto__trace__v1__span__link__init + (Opentelemetry__Proto__Trace__V1__Span__Link *message) +{ + static const Opentelemetry__Proto__Trace__V1__Span__Link init_value = OPENTELEMETRY__PROTO__TRACE__V1__SPAN__LINK__INIT; + *message = init_value; +} +void opentelemetry__proto__trace__v1__span__init + (Opentelemetry__Proto__Trace__V1__Span *message) +{ + static const Opentelemetry__Proto__Trace__V1__Span init_value = OPENTELEMETRY__PROTO__TRACE__V1__SPAN__INIT; + *message = init_value; +} +size_t opentelemetry__proto__trace__v1__span__get_packed_size + (const Opentelemetry__Proto__Trace__V1__Span *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__span__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__trace__v1__span__pack + (const Opentelemetry__Proto__Trace__V1__Span *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__span__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__trace__v1__span__pack_to_buffer + (const Opentelemetry__Proto__Trace__V1__Span *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__span__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Trace__V1__Span * + opentelemetry__proto__trace__v1__span__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Trace__V1__Span *) + protobuf_c_message_unpack (&opentelemetry__proto__trace__v1__span__descriptor, + allocator, len, data); +} +void opentelemetry__proto__trace__v1__span__free_unpacked + (Opentelemetry__Proto__Trace__V1__Span *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__span__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void opentelemetry__proto__trace__v1__status__init + (Opentelemetry__Proto__Trace__V1__Status *message) +{ + static const Opentelemetry__Proto__Trace__V1__Status init_value = OPENTELEMETRY__PROTO__TRACE__V1__STATUS__INIT; + *message = init_value; +} +size_t opentelemetry__proto__trace__v1__status__get_packed_size + (const Opentelemetry__Proto__Trace__V1__Status *message) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__status__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t opentelemetry__proto__trace__v1__status__pack + (const Opentelemetry__Proto__Trace__V1__Status *message, + uint8_t *out) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__status__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t opentelemetry__proto__trace__v1__status__pack_to_buffer + (const Opentelemetry__Proto__Trace__V1__Status *message, + ProtobufCBuffer *buffer) +{ + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__status__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Opentelemetry__Proto__Trace__V1__Status * + opentelemetry__proto__trace__v1__status__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Opentelemetry__Proto__Trace__V1__Status *) + protobuf_c_message_unpack (&opentelemetry__proto__trace__v1__status__descriptor, + allocator, len, data); +} +void opentelemetry__proto__trace__v1__status__free_unpacked + (Opentelemetry__Proto__Trace__V1__Status *message, + ProtobufCAllocator *allocator) +{ + if(!message) + return; + assert(message->base.descriptor == &opentelemetry__proto__trace__v1__status__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor opentelemetry__proto__trace__v1__traces_data__field_descriptors[1] = +{ + { + "resource_spans", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Trace__V1__TracesData, n_resource_spans), + offsetof(Opentelemetry__Proto__Trace__V1__TracesData, resource_spans), + &opentelemetry__proto__trace__v1__resource_spans__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__trace__v1__traces_data__field_indices_by_name[] = { + 0, /* field[0] = resource_spans */ +}; +static const ProtobufCIntRange opentelemetry__proto__trace__v1__traces_data__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__traces_data__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.trace.v1.TracesData", + "TracesData", + "Opentelemetry__Proto__Trace__V1__TracesData", + "opentelemetry.proto.trace.v1", + sizeof(Opentelemetry__Proto__Trace__V1__TracesData), + 1, + opentelemetry__proto__trace__v1__traces_data__field_descriptors, + opentelemetry__proto__trace__v1__traces_data__field_indices_by_name, + 1, opentelemetry__proto__trace__v1__traces_data__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__trace__v1__traces_data__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__trace__v1__resource_spans__field_descriptors[3] = +{ + { + "resource", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__ResourceSpans, resource), + &opentelemetry__proto__resource__v1__resource__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "scope_spans", + 2, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Trace__V1__ResourceSpans, n_scope_spans), + offsetof(Opentelemetry__Proto__Trace__V1__ResourceSpans, scope_spans), + &opentelemetry__proto__trace__v1__scope_spans__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "schema_url", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__ResourceSpans, schema_url), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__trace__v1__resource_spans__field_indices_by_name[] = { + 0, /* field[0] = resource */ + 2, /* field[2] = schema_url */ + 1, /* field[1] = scope_spans */ +}; +static const ProtobufCIntRange opentelemetry__proto__trace__v1__resource_spans__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__resource_spans__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.trace.v1.ResourceSpans", + "ResourceSpans", + "Opentelemetry__Proto__Trace__V1__ResourceSpans", + "opentelemetry.proto.trace.v1", + sizeof(Opentelemetry__Proto__Trace__V1__ResourceSpans), + 3, + opentelemetry__proto__trace__v1__resource_spans__field_descriptors, + opentelemetry__proto__trace__v1__resource_spans__field_indices_by_name, + 1, opentelemetry__proto__trace__v1__resource_spans__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__trace__v1__resource_spans__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__trace__v1__scope_spans__field_descriptors[3] = +{ + { + "scope", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__ScopeSpans, scope), + &opentelemetry__proto__common__v1__instrumentation_scope__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "spans", + 2, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Trace__V1__ScopeSpans, n_spans), + offsetof(Opentelemetry__Proto__Trace__V1__ScopeSpans, spans), + &opentelemetry__proto__trace__v1__span__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "schema_url", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__ScopeSpans, schema_url), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__trace__v1__scope_spans__field_indices_by_name[] = { + 2, /* field[2] = schema_url */ + 0, /* field[0] = scope */ + 1, /* field[1] = spans */ +}; +static const ProtobufCIntRange opentelemetry__proto__trace__v1__scope_spans__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__scope_spans__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.trace.v1.ScopeSpans", + "ScopeSpans", + "Opentelemetry__Proto__Trace__V1__ScopeSpans", + "opentelemetry.proto.trace.v1", + sizeof(Opentelemetry__Proto__Trace__V1__ScopeSpans), + 3, + opentelemetry__proto__trace__v1__scope_spans__field_descriptors, + opentelemetry__proto__trace__v1__scope_spans__field_indices_by_name, + 1, opentelemetry__proto__trace__v1__scope_spans__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__trace__v1__scope_spans__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__trace__v1__span__event__field_descriptors[4] = +{ + { + "time_unix_nano", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span__Event, time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "name", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span__Event, name), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "attributes", + 3, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Trace__V1__Span__Event, n_attributes), + offsetof(Opentelemetry__Proto__Trace__V1__Span__Event, attributes), + &opentelemetry__proto__common__v1__key_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dropped_attributes_count", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span__Event, dropped_attributes_count), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__trace__v1__span__event__field_indices_by_name[] = { + 2, /* field[2] = attributes */ + 3, /* field[3] = dropped_attributes_count */ + 1, /* field[1] = name */ + 0, /* field[0] = time_unix_nano */ +}; +static const ProtobufCIntRange opentelemetry__proto__trace__v1__span__event__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 4 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__span__event__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.trace.v1.Span.Event", + "Event", + "Opentelemetry__Proto__Trace__V1__Span__Event", + "opentelemetry.proto.trace.v1", + sizeof(Opentelemetry__Proto__Trace__V1__Span__Event), + 4, + opentelemetry__proto__trace__v1__span__event__field_descriptors, + opentelemetry__proto__trace__v1__span__event__field_indices_by_name, + 1, opentelemetry__proto__trace__v1__span__event__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__trace__v1__span__event__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__trace__v1__span__link__field_descriptors[5] = +{ + { + "trace_id", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BYTES, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span__Link, trace_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "span_id", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BYTES, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span__Link, span_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "trace_state", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span__Link, trace_state), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "attributes", + 4, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Trace__V1__Span__Link, n_attributes), + offsetof(Opentelemetry__Proto__Trace__V1__Span__Link, attributes), + &opentelemetry__proto__common__v1__key_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dropped_attributes_count", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span__Link, dropped_attributes_count), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__trace__v1__span__link__field_indices_by_name[] = { + 3, /* field[3] = attributes */ + 4, /* field[4] = dropped_attributes_count */ + 1, /* field[1] = span_id */ + 0, /* field[0] = trace_id */ + 2, /* field[2] = trace_state */ +}; +static const ProtobufCIntRange opentelemetry__proto__trace__v1__span__link__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 5 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__span__link__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.trace.v1.Span.Link", + "Link", + "Opentelemetry__Proto__Trace__V1__Span__Link", + "opentelemetry.proto.trace.v1", + sizeof(Opentelemetry__Proto__Trace__V1__Span__Link), + 5, + opentelemetry__proto__trace__v1__span__link__field_descriptors, + opentelemetry__proto__trace__v1__span__link__field_indices_by_name, + 1, opentelemetry__proto__trace__v1__span__link__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__trace__v1__span__link__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCEnumValue opentelemetry__proto__trace__v1__span__span_kind__enum_values_by_number[6] = +{ + { "SPAN_KIND_UNSPECIFIED", "OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND__SPAN_KIND_UNSPECIFIED", 0 }, + { "SPAN_KIND_INTERNAL", "OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND__SPAN_KIND_INTERNAL", 1 }, + { "SPAN_KIND_SERVER", "OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND__SPAN_KIND_SERVER", 2 }, + { "SPAN_KIND_CLIENT", "OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND__SPAN_KIND_CLIENT", 3 }, + { "SPAN_KIND_PRODUCER", "OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND__SPAN_KIND_PRODUCER", 4 }, + { "SPAN_KIND_CONSUMER", "OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND__SPAN_KIND_CONSUMER", 5 }, +}; +static const ProtobufCIntRange opentelemetry__proto__trace__v1__span__span_kind__value_ranges[] = { +{0, 0},{0, 6} +}; +static const ProtobufCEnumValueIndex opentelemetry__proto__trace__v1__span__span_kind__enum_values_by_name[6] = +{ + { "SPAN_KIND_CLIENT", 3 }, + { "SPAN_KIND_CONSUMER", 5 }, + { "SPAN_KIND_INTERNAL", 1 }, + { "SPAN_KIND_PRODUCER", 4 }, + { "SPAN_KIND_SERVER", 2 }, + { "SPAN_KIND_UNSPECIFIED", 0 }, +}; +const ProtobufCEnumDescriptor opentelemetry__proto__trace__v1__span__span_kind__descriptor = +{ + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "opentelemetry.proto.trace.v1.Span.SpanKind", + "SpanKind", + "Opentelemetry__Proto__Trace__V1__Span__SpanKind", + "opentelemetry.proto.trace.v1", + 6, + opentelemetry__proto__trace__v1__span__span_kind__enum_values_by_number, + 6, + opentelemetry__proto__trace__v1__span__span_kind__enum_values_by_name, + 1, + opentelemetry__proto__trace__v1__span__span_kind__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__trace__v1__span__field_descriptors[15] = +{ + { + "trace_id", + 1, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BYTES, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span, trace_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "span_id", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BYTES, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span, span_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "trace_state", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span, trace_state), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "parent_span_id", + 4, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_BYTES, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span, parent_span_id), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "name", + 5, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span, name), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "kind", + 6, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span, kind), + &opentelemetry__proto__trace__v1__span__span_kind__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "start_time_unix_nano", + 7, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span, start_time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "end_time_unix_nano", + 8, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_FIXED64, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span, end_time_unix_nano), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "attributes", + 9, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Trace__V1__Span, n_attributes), + offsetof(Opentelemetry__Proto__Trace__V1__Span, attributes), + &opentelemetry__proto__common__v1__key_value__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dropped_attributes_count", + 10, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span, dropped_attributes_count), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "events", + 11, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Trace__V1__Span, n_events), + offsetof(Opentelemetry__Proto__Trace__V1__Span, events), + &opentelemetry__proto__trace__v1__span__event__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dropped_events_count", + 12, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span, dropped_events_count), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "links", + 13, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + offsetof(Opentelemetry__Proto__Trace__V1__Span, n_links), + offsetof(Opentelemetry__Proto__Trace__V1__Span, links), + &opentelemetry__proto__trace__v1__span__link__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dropped_links_count", + 14, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span, dropped_links_count), + NULL, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "status", + 15, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Span, status), + &opentelemetry__proto__trace__v1__status__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__trace__v1__span__field_indices_by_name[] = { + 8, /* field[8] = attributes */ + 9, /* field[9] = dropped_attributes_count */ + 11, /* field[11] = dropped_events_count */ + 13, /* field[13] = dropped_links_count */ + 7, /* field[7] = end_time_unix_nano */ + 10, /* field[10] = events */ + 5, /* field[5] = kind */ + 12, /* field[12] = links */ + 4, /* field[4] = name */ + 3, /* field[3] = parent_span_id */ + 1, /* field[1] = span_id */ + 6, /* field[6] = start_time_unix_nano */ + 14, /* field[14] = status */ + 0, /* field[0] = trace_id */ + 2, /* field[2] = trace_state */ +}; +static const ProtobufCIntRange opentelemetry__proto__trace__v1__span__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 15 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__span__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.trace.v1.Span", + "Span", + "Opentelemetry__Proto__Trace__V1__Span", + "opentelemetry.proto.trace.v1", + sizeof(Opentelemetry__Proto__Trace__V1__Span), + 15, + opentelemetry__proto__trace__v1__span__field_descriptors, + opentelemetry__proto__trace__v1__span__field_indices_by_name, + 1, opentelemetry__proto__trace__v1__span__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__trace__v1__span__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCEnumValue opentelemetry__proto__trace__v1__status__status_code__enum_values_by_number[3] = +{ + { "STATUS_CODE_UNSET", "OPENTELEMETRY__PROTO__TRACE__V1__STATUS__STATUS_CODE__STATUS_CODE_UNSET", 0 }, + { "STATUS_CODE_OK", "OPENTELEMETRY__PROTO__TRACE__V1__STATUS__STATUS_CODE__STATUS_CODE_OK", 1 }, + { "STATUS_CODE_ERROR", "OPENTELEMETRY__PROTO__TRACE__V1__STATUS__STATUS_CODE__STATUS_CODE_ERROR", 2 }, +}; +static const ProtobufCIntRange opentelemetry__proto__trace__v1__status__status_code__value_ranges[] = { +{0, 0},{0, 3} +}; +static const ProtobufCEnumValueIndex opentelemetry__proto__trace__v1__status__status_code__enum_values_by_name[3] = +{ + { "STATUS_CODE_ERROR", 2 }, + { "STATUS_CODE_OK", 1 }, + { "STATUS_CODE_UNSET", 0 }, +}; +const ProtobufCEnumDescriptor opentelemetry__proto__trace__v1__status__status_code__descriptor = +{ + PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC, + "opentelemetry.proto.trace.v1.Status.StatusCode", + "StatusCode", + "Opentelemetry__Proto__Trace__V1__Status__StatusCode", + "opentelemetry.proto.trace.v1", + 3, + opentelemetry__proto__trace__v1__status__status_code__enum_values_by_number, + 3, + opentelemetry__proto__trace__v1__status__status_code__enum_values_by_name, + 1, + opentelemetry__proto__trace__v1__status__status_code__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor opentelemetry__proto__trace__v1__status__field_descriptors[2] = +{ + { + "message", + 2, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Status, message), + NULL, + &protobuf_c_empty_string, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "code", + 3, + PROTOBUF_C_LABEL_NONE, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + offsetof(Opentelemetry__Proto__Trace__V1__Status, code), + &opentelemetry__proto__trace__v1__status__status_code__descriptor, + NULL, + 0, /* flags */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned opentelemetry__proto__trace__v1__status__field_indices_by_name[] = { + 1, /* field[1] = code */ + 0, /* field[0] = message */ +}; +static const ProtobufCIntRange opentelemetry__proto__trace__v1__status__number_ranges[1 + 1] = +{ + { 2, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__status__descriptor = +{ + PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, + "opentelemetry.proto.trace.v1.Status", + "Status", + "Opentelemetry__Proto__Trace__V1__Status", + "opentelemetry.proto.trace.v1", + sizeof(Opentelemetry__Proto__Trace__V1__Status), + 2, + opentelemetry__proto__trace__v1__status__field_descriptors, + opentelemetry__proto__trace__v1__status__field_indices_by_name, + 1, opentelemetry__proto__trace__v1__status__number_ranges, + (ProtobufCMessageInit) opentelemetry__proto__trace__v1__status__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/trace/v1/trace.pb-c.h b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/trace/v1/trace.pb-c.h new file mode 100644 index 000000000..cfb6ee9b7 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/opentelemetry/proto/trace/v1/trace.pb-c.h @@ -0,0 +1,534 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ +/* Generated from: opentelemetry/proto/trace/v1/trace.proto */ + +#ifndef PROTOBUF_C_opentelemetry_2fproto_2ftrace_2fv1_2ftrace_2eproto__INCLUDED +#define PROTOBUF_C_opentelemetry_2fproto_2ftrace_2fv1_2ftrace_2eproto__INCLUDED + +#include <protobuf-c/protobuf-c.h> + +PROTOBUF_C__BEGIN_DECLS + +#if PROTOBUF_C_VERSION_NUMBER < 1003000 +# error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. +#elif 1004001 < PROTOBUF_C_MIN_COMPILER_VERSION +# error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. +#endif + +#include "opentelemetry/proto/common/v1/common.pb-c.h" +#include "opentelemetry/proto/resource/v1/resource.pb-c.h" + +typedef struct Opentelemetry__Proto__Trace__V1__TracesData Opentelemetry__Proto__Trace__V1__TracesData; +typedef struct Opentelemetry__Proto__Trace__V1__ResourceSpans Opentelemetry__Proto__Trace__V1__ResourceSpans; +typedef struct Opentelemetry__Proto__Trace__V1__ScopeSpans Opentelemetry__Proto__Trace__V1__ScopeSpans; +typedef struct Opentelemetry__Proto__Trace__V1__Span Opentelemetry__Proto__Trace__V1__Span; +typedef struct Opentelemetry__Proto__Trace__V1__Span__Event Opentelemetry__Proto__Trace__V1__Span__Event; +typedef struct Opentelemetry__Proto__Trace__V1__Span__Link Opentelemetry__Proto__Trace__V1__Span__Link; +typedef struct Opentelemetry__Proto__Trace__V1__Status Opentelemetry__Proto__Trace__V1__Status; + + +/* --- enums --- */ + +/* + * SpanKind is the type of span. Can be used to specify additional relationships between spans + * in addition to a parent/child relationship. + */ +typedef enum _Opentelemetry__Proto__Trace__V1__Span__SpanKind { + /* + * Unspecified. Do NOT use as default. + * Implementations MAY assume SpanKind to be INTERNAL when receiving UNSPECIFIED. + */ + OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND__SPAN_KIND_UNSPECIFIED = 0, + /* + * Indicates that the span represents an internal operation within an application, + * as opposed to an operation happening at the boundaries. Default value. + */ + OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND__SPAN_KIND_INTERNAL = 1, + /* + * Indicates that the span covers server-side handling of an RPC or other + * remote network request. + */ + OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND__SPAN_KIND_SERVER = 2, + /* + * Indicates that the span describes a request to some remote service. + */ + OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND__SPAN_KIND_CLIENT = 3, + /* + * Indicates that the span describes a producer sending a message to a broker. + * Unlike CLIENT and SERVER, there is often no direct critical path latency relationship + * between producer and consumer spans. A PRODUCER span ends when the message was accepted + * by the broker while the logical processing of the message might span a much longer time. + */ + OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND__SPAN_KIND_PRODUCER = 4, + /* + * Indicates that the span describes consumer receiving a message from a broker. + * Like the PRODUCER kind, there is often no direct critical path latency relationship + * between producer and consumer spans. + */ + OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND__SPAN_KIND_CONSUMER = 5 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND) +} Opentelemetry__Proto__Trace__V1__Span__SpanKind; +/* + * For the semantics of status codes see + * https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status + */ +typedef enum _Opentelemetry__Proto__Trace__V1__Status__StatusCode { + /* + * The default status. + */ + OPENTELEMETRY__PROTO__TRACE__V1__STATUS__STATUS_CODE__STATUS_CODE_UNSET = 0, + /* + * The Span has been validated by an Application developer or Operator to + * have completed successfully. + */ + OPENTELEMETRY__PROTO__TRACE__V1__STATUS__STATUS_CODE__STATUS_CODE_OK = 1, + /* + * The Span contains an error. + */ + OPENTELEMETRY__PROTO__TRACE__V1__STATUS__STATUS_CODE__STATUS_CODE_ERROR = 2 + PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(OPENTELEMETRY__PROTO__TRACE__V1__STATUS__STATUS_CODE) +} Opentelemetry__Proto__Trace__V1__Status__StatusCode; + +/* --- messages --- */ + +/* + * TracesData represents the traces data that can be stored in a persistent storage, + * OR can be embedded by other protocols that transfer OTLP traces data but do + * not implement the OTLP protocol. + * The main difference between this message and collector protocol is that + * in this message there will not be any "control" or "metadata" specific to + * OTLP protocol. + * When new fields are added into this message, the OTLP request MUST be updated + * as well. + */ +struct Opentelemetry__Proto__Trace__V1__TracesData +{ + ProtobufCMessage base; + /* + * An array of ResourceSpans. + * For data coming from a single resource this array will typically contain + * one element. Intermediary nodes that receive data from multiple origins + * typically batch the data before forwarding further and in that case this + * array will contain multiple elements. + */ + size_t n_resource_spans; + Opentelemetry__Proto__Trace__V1__ResourceSpans **resource_spans; +}; +#define OPENTELEMETRY__PROTO__TRACE__V1__TRACES_DATA__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__trace__v1__traces_data__descriptor) \ + , 0,NULL } + + +/* + * A collection of ScopeSpans from a Resource. + */ +struct Opentelemetry__Proto__Trace__V1__ResourceSpans +{ + ProtobufCMessage base; + /* + * The resource for the spans in this message. + * If this field is not set then no resource info is known. + */ + Opentelemetry__Proto__Resource__V1__Resource *resource; + /* + * A list of ScopeSpans that originate from a resource. + */ + size_t n_scope_spans; + Opentelemetry__Proto__Trace__V1__ScopeSpans **scope_spans; + /* + * This schema_url applies to the data in the "resource" field. It does not apply + * to the data in the "scope_spans" field which have their own schema_url field. + */ + char *schema_url; +}; +#define OPENTELEMETRY__PROTO__TRACE__V1__RESOURCE_SPANS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__trace__v1__resource_spans__descriptor) \ + , NULL, 0,NULL, (char *)protobuf_c_empty_string } + + +/* + * A collection of Spans produced by an InstrumentationScope. + */ +struct Opentelemetry__Proto__Trace__V1__ScopeSpans +{ + ProtobufCMessage base; + /* + * The instrumentation scope information for the spans in this message. + * Semantically when InstrumentationScope isn't set, it is equivalent with + * an empty instrumentation scope name (unknown). + */ + Opentelemetry__Proto__Common__V1__InstrumentationScope *scope; + /* + * A list of Spans that originate from an instrumentation scope. + */ + size_t n_spans; + Opentelemetry__Proto__Trace__V1__Span **spans; + /* + * This schema_url applies to all spans and span events in the "spans" field. + */ + char *schema_url; +}; +#define OPENTELEMETRY__PROTO__TRACE__V1__SCOPE_SPANS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__trace__v1__scope_spans__descriptor) \ + , NULL, 0,NULL, (char *)protobuf_c_empty_string } + + +/* + * Event is a time-stamped annotation of the span, consisting of user-supplied + * text description and key-value pairs. + */ +struct Opentelemetry__Proto__Trace__V1__Span__Event +{ + ProtobufCMessage base; + /* + * time_unix_nano is the time the event occurred. + */ + uint64_t time_unix_nano; + /* + * name of the event. + * This field is semantically required to be set to non-empty string. + */ + char *name; + /* + * attributes is a collection of attribute key/value pairs on the event. + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + */ + size_t n_attributes; + Opentelemetry__Proto__Common__V1__KeyValue **attributes; + /* + * dropped_attributes_count is the number of dropped attributes. If the value is 0, + * then no attributes were dropped. + */ + uint32_t dropped_attributes_count; +}; +#define OPENTELEMETRY__PROTO__TRACE__V1__SPAN__EVENT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__trace__v1__span__event__descriptor) \ + , 0, (char *)protobuf_c_empty_string, 0,NULL, 0 } + + +/* + * A pointer from the current span to another span in the same trace or in a + * different trace. For example, this can be used in batching operations, + * where a single batch handler processes multiple requests from different + * traces or when the handler receives a request from a different project. + */ +struct Opentelemetry__Proto__Trace__V1__Span__Link +{ + ProtobufCMessage base; + /* + * A unique identifier of a trace that this linked span is part of. The ID is a + * 16-byte array. + */ + ProtobufCBinaryData trace_id; + /* + * A unique identifier for the linked span. The ID is an 8-byte array. + */ + ProtobufCBinaryData span_id; + /* + * The trace_state associated with the link. + */ + char *trace_state; + /* + * attributes is a collection of attribute key/value pairs on the link. + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + */ + size_t n_attributes; + Opentelemetry__Proto__Common__V1__KeyValue **attributes; + /* + * dropped_attributes_count is the number of dropped attributes. If the value is 0, + * then no attributes were dropped. + */ + uint32_t dropped_attributes_count; +}; +#define OPENTELEMETRY__PROTO__TRACE__V1__SPAN__LINK__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__trace__v1__span__link__descriptor) \ + , {0,NULL}, {0,NULL}, (char *)protobuf_c_empty_string, 0,NULL, 0 } + + +/* + * A Span represents a single operation performed by a single component of the system. + * The next available field id is 17. + */ +struct Opentelemetry__Proto__Trace__V1__Span +{ + ProtobufCMessage base; + /* + * A unique identifier for a trace. All spans from the same trace share + * the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes + * is considered invalid. + * This field is semantically required. Receiver should generate new + * random trace_id if empty or invalid trace_id was received. + * This field is required. + */ + ProtobufCBinaryData trace_id; + /* + * A unique identifier for a span within a trace, assigned when the span + * is created. The ID is an 8-byte array. An ID with all zeroes is considered + * invalid. + * This field is semantically required. Receiver should generate new + * random span_id if empty or invalid span_id was received. + * This field is required. + */ + ProtobufCBinaryData span_id; + /* + * trace_state conveys information about request position in multiple distributed tracing graphs. + * It is a trace_state in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header + * See also https://github.com/w3c/distributed-tracing for more details about this field. + */ + char *trace_state; + /* + * The `span_id` of this span's parent span. If this is a root span, then this + * field must be empty. The ID is an 8-byte array. + */ + ProtobufCBinaryData parent_span_id; + /* + * A description of the span's operation. + * For example, the name can be a qualified method name or a file name + * and a line number where the operation is called. A best practice is to use + * the same display name at the same call point in an application. + * This makes it easier to correlate spans in different traces. + * This field is semantically required to be set to non-empty string. + * Empty value is equivalent to an unknown span name. + * This field is required. + */ + char *name; + /* + * Distinguishes between spans generated in a particular context. For example, + * two spans with the same name may be distinguished using `CLIENT` (caller) + * and `SERVER` (callee) to identify queueing latency associated with the span. + */ + Opentelemetry__Proto__Trace__V1__Span__SpanKind kind; + /* + * start_time_unix_nano is the start time of the span. On the client side, this is the time + * kept by the local machine where the span execution starts. On the server side, this + * is the time when the server's application handler starts running. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + * This field is semantically required and it is expected that end_time >= start_time. + */ + uint64_t start_time_unix_nano; + /* + * end_time_unix_nano is the end time of the span. On the client side, this is the time + * kept by the local machine where the span execution ends. On the server side, this + * is the time when the server application handler stops running. + * Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970. + * This field is semantically required and it is expected that end_time >= start_time. + */ + uint64_t end_time_unix_nano; + /* + * attributes is a collection of key/value pairs. Note, global attributes + * like server name can be set using the resource API. Examples of attributes: + * "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" + * "/http/server_latency": 300 + * "abc.com/myattribute": true + * "abc.com/score": 10.239 + * The OpenTelemetry API specification further restricts the allowed value types: + * https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute + * Attribute keys MUST be unique (it is not allowed to have more than one + * attribute with the same key). + */ + size_t n_attributes; + Opentelemetry__Proto__Common__V1__KeyValue **attributes; + /* + * dropped_attributes_count is the number of attributes that were discarded. Attributes + * can be discarded because their keys are too long or because there are too many + * attributes. If this value is 0, then no attributes were dropped. + */ + uint32_t dropped_attributes_count; + /* + * events is a collection of Event items. + */ + size_t n_events; + Opentelemetry__Proto__Trace__V1__Span__Event **events; + /* + * dropped_events_count is the number of dropped events. If the value is 0, then no + * events were dropped. + */ + uint32_t dropped_events_count; + /* + * links is a collection of Links, which are references from this span to a span + * in the same or different trace. + */ + size_t n_links; + Opentelemetry__Proto__Trace__V1__Span__Link **links; + /* + * dropped_links_count is the number of dropped links after the maximum size was + * enforced. If this value is 0, then no links were dropped. + */ + uint32_t dropped_links_count; + /* + * An optional final status for this span. Semantically when Status isn't set, it means + * span's status code is unset, i.e. assume STATUS_CODE_UNSET (code = 0). + */ + Opentelemetry__Proto__Trace__V1__Status *status; +}; +#define OPENTELEMETRY__PROTO__TRACE__V1__SPAN__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__trace__v1__span__descriptor) \ + , {0,NULL}, {0,NULL}, (char *)protobuf_c_empty_string, {0,NULL}, (char *)protobuf_c_empty_string, OPENTELEMETRY__PROTO__TRACE__V1__SPAN__SPAN_KIND__SPAN_KIND_UNSPECIFIED, 0, 0, 0,NULL, 0, 0,NULL, 0, 0,NULL, 0, NULL } + + +/* + * The Status type defines a logical error model that is suitable for different + * programming environments, including REST APIs and RPC APIs. + */ +struct Opentelemetry__Proto__Trace__V1__Status +{ + ProtobufCMessage base; + /* + * A developer-facing human readable error message. + */ + char *message; + /* + * The status code. + */ + Opentelemetry__Proto__Trace__V1__Status__StatusCode code; +}; +#define OPENTELEMETRY__PROTO__TRACE__V1__STATUS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&opentelemetry__proto__trace__v1__status__descriptor) \ + , (char *)protobuf_c_empty_string, OPENTELEMETRY__PROTO__TRACE__V1__STATUS__STATUS_CODE__STATUS_CODE_UNSET } + + +/* Opentelemetry__Proto__Trace__V1__TracesData methods */ +void opentelemetry__proto__trace__v1__traces_data__init + (Opentelemetry__Proto__Trace__V1__TracesData *message); +size_t opentelemetry__proto__trace__v1__traces_data__get_packed_size + (const Opentelemetry__Proto__Trace__V1__TracesData *message); +size_t opentelemetry__proto__trace__v1__traces_data__pack + (const Opentelemetry__Proto__Trace__V1__TracesData *message, + uint8_t *out); +size_t opentelemetry__proto__trace__v1__traces_data__pack_to_buffer + (const Opentelemetry__Proto__Trace__V1__TracesData *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Trace__V1__TracesData * + opentelemetry__proto__trace__v1__traces_data__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__trace__v1__traces_data__free_unpacked + (Opentelemetry__Proto__Trace__V1__TracesData *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Trace__V1__ResourceSpans methods */ +void opentelemetry__proto__trace__v1__resource_spans__init + (Opentelemetry__Proto__Trace__V1__ResourceSpans *message); +size_t opentelemetry__proto__trace__v1__resource_spans__get_packed_size + (const Opentelemetry__Proto__Trace__V1__ResourceSpans *message); +size_t opentelemetry__proto__trace__v1__resource_spans__pack + (const Opentelemetry__Proto__Trace__V1__ResourceSpans *message, + uint8_t *out); +size_t opentelemetry__proto__trace__v1__resource_spans__pack_to_buffer + (const Opentelemetry__Proto__Trace__V1__ResourceSpans *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Trace__V1__ResourceSpans * + opentelemetry__proto__trace__v1__resource_spans__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__trace__v1__resource_spans__free_unpacked + (Opentelemetry__Proto__Trace__V1__ResourceSpans *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Trace__V1__ScopeSpans methods */ +void opentelemetry__proto__trace__v1__scope_spans__init + (Opentelemetry__Proto__Trace__V1__ScopeSpans *message); +size_t opentelemetry__proto__trace__v1__scope_spans__get_packed_size + (const Opentelemetry__Proto__Trace__V1__ScopeSpans *message); +size_t opentelemetry__proto__trace__v1__scope_spans__pack + (const Opentelemetry__Proto__Trace__V1__ScopeSpans *message, + uint8_t *out); +size_t opentelemetry__proto__trace__v1__scope_spans__pack_to_buffer + (const Opentelemetry__Proto__Trace__V1__ScopeSpans *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Trace__V1__ScopeSpans * + opentelemetry__proto__trace__v1__scope_spans__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__trace__v1__scope_spans__free_unpacked + (Opentelemetry__Proto__Trace__V1__ScopeSpans *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Trace__V1__Span__Event methods */ +void opentelemetry__proto__trace__v1__span__event__init + (Opentelemetry__Proto__Trace__V1__Span__Event *message); +/* Opentelemetry__Proto__Trace__V1__Span__Link methods */ +void opentelemetry__proto__trace__v1__span__link__init + (Opentelemetry__Proto__Trace__V1__Span__Link *message); +/* Opentelemetry__Proto__Trace__V1__Span methods */ +void opentelemetry__proto__trace__v1__span__init + (Opentelemetry__Proto__Trace__V1__Span *message); +size_t opentelemetry__proto__trace__v1__span__get_packed_size + (const Opentelemetry__Proto__Trace__V1__Span *message); +size_t opentelemetry__proto__trace__v1__span__pack + (const Opentelemetry__Proto__Trace__V1__Span *message, + uint8_t *out); +size_t opentelemetry__proto__trace__v1__span__pack_to_buffer + (const Opentelemetry__Proto__Trace__V1__Span *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Trace__V1__Span * + opentelemetry__proto__trace__v1__span__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__trace__v1__span__free_unpacked + (Opentelemetry__Proto__Trace__V1__Span *message, + ProtobufCAllocator *allocator); +/* Opentelemetry__Proto__Trace__V1__Status methods */ +void opentelemetry__proto__trace__v1__status__init + (Opentelemetry__Proto__Trace__V1__Status *message); +size_t opentelemetry__proto__trace__v1__status__get_packed_size + (const Opentelemetry__Proto__Trace__V1__Status *message); +size_t opentelemetry__proto__trace__v1__status__pack + (const Opentelemetry__Proto__Trace__V1__Status *message, + uint8_t *out); +size_t opentelemetry__proto__trace__v1__status__pack_to_buffer + (const Opentelemetry__Proto__Trace__V1__Status *message, + ProtobufCBuffer *buffer); +Opentelemetry__Proto__Trace__V1__Status * + opentelemetry__proto__trace__v1__status__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void opentelemetry__proto__trace__v1__status__free_unpacked + (Opentelemetry__Proto__Trace__V1__Status *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*Opentelemetry__Proto__Trace__V1__TracesData_Closure) + (const Opentelemetry__Proto__Trace__V1__TracesData *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Trace__V1__ResourceSpans_Closure) + (const Opentelemetry__Proto__Trace__V1__ResourceSpans *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Trace__V1__ScopeSpans_Closure) + (const Opentelemetry__Proto__Trace__V1__ScopeSpans *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Trace__V1__Span__Event_Closure) + (const Opentelemetry__Proto__Trace__V1__Span__Event *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Trace__V1__Span__Link_Closure) + (const Opentelemetry__Proto__Trace__V1__Span__Link *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Trace__V1__Span_Closure) + (const Opentelemetry__Proto__Trace__V1__Span *message, + void *closure_data); +typedef void (*Opentelemetry__Proto__Trace__V1__Status_Closure) + (const Opentelemetry__Proto__Trace__V1__Status *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__traces_data__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__resource_spans__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__scope_spans__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__span__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__span__event__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__span__link__descriptor; +extern const ProtobufCEnumDescriptor opentelemetry__proto__trace__v1__span__span_kind__descriptor; +extern const ProtobufCMessageDescriptor opentelemetry__proto__trace__v1__status__descriptor; +extern const ProtobufCEnumDescriptor opentelemetry__proto__trace__v1__status__status_code__descriptor; + +PROTOBUF_C__END_DECLS + + +#endif /* PROTOBUF_C_opentelemetry_2fproto_2ftrace_2fv1_2ftrace_2eproto__INCLUDED */ diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/protobuf-c/protobuf-c.c b/fluent-bit/lib/fluent-otel-proto/proto_c/protobuf-c/protobuf-c.c new file mode 100644 index 000000000..0606cf677 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/protobuf-c/protobuf-c.c @@ -0,0 +1,3672 @@ +/* + * Copyright (c) 2008-2022, Dave Benson and the protobuf-c authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/*! \file + * Support library for `protoc-c` generated code. + * + * This file implements the public API used by the code generated + * by `protoc-c`. + * + * \authors Dave Benson and the protobuf-c authors + * + * \copyright 2008-2014. Licensed under the terms of the [BSD-2-Clause] license. + */ + +/** + * \todo 64-BIT OPTIMIZATION: certain implementations use 32-bit math + * even on 64-bit platforms (uint64_size, uint64_pack, parse_uint64). + * + * \todo Use size_t consistently. + */ + +#include <stdlib.h> /* for malloc, free */ +#include <string.h> /* for strcmp, strlen, memcpy, memmove, memset */ + +#include "protobuf-c.h" + +#define TRUE 1 +#define FALSE 0 + +#define PROTOBUF_C__ASSERT_NOT_REACHED() assert(0) + +/* Workaround for Microsoft compilers. */ +#ifdef _MSC_VER +# define inline __inline +#endif + +/** + * \defgroup internal Internal functions and macros + * + * These are not exported by the library but are useful to developers working + * on `libprotobuf-c` itself. + */ + +/** + * \defgroup macros Utility macros for manipulating structures + * + * Macros and constants used to manipulate the base "classes" generated by + * `protobuf-c`. They also define limits and check correctness. + * + * \ingroup internal + * @{ + */ + +/** The maximum length of a 64-bit integer in varint encoding. */ +#define MAX_UINT64_ENCODED_SIZE 10 + +#ifndef PROTOBUF_C_UNPACK_ERROR +# define PROTOBUF_C_UNPACK_ERROR(...) +#endif + +#if !defined(_WIN32) || !defined(PROTOBUF_C_USE_SHARED_LIB) +const char protobuf_c_empty_string[] = ""; +#endif + +/** + * Internal `ProtobufCMessage` manipulation macro. + * + * Base macro for manipulating a `ProtobufCMessage`. Used by STRUCT_MEMBER() and + * STRUCT_MEMBER_PTR(). + */ +#define STRUCT_MEMBER_P(struct_p, struct_offset) \ + ((void *) ((uint8_t *) (struct_p) + (struct_offset))) + +/** + * Return field in a `ProtobufCMessage` based on offset. + * + * Take a pointer to a `ProtobufCMessage` and find the field at the offset. + * Cast it to the passed type. + */ +#define STRUCT_MEMBER(member_type, struct_p, struct_offset) \ + (*(member_type *) STRUCT_MEMBER_P((struct_p), (struct_offset))) + +/** + * Return field in a `ProtobufCMessage` based on offset. + * + * Take a pointer to a `ProtobufCMessage` and find the field at the offset. Cast + * it to a pointer to the passed type. + */ +#define STRUCT_MEMBER_PTR(member_type, struct_p, struct_offset) \ + ((member_type *) STRUCT_MEMBER_P((struct_p), (struct_offset))) + +/* Assertions for magic numbers. */ + +#define ASSERT_IS_ENUM_DESCRIPTOR(desc) \ + assert((desc)->magic == PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC) + +#define ASSERT_IS_MESSAGE_DESCRIPTOR(desc) \ + assert((desc)->magic == PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC) + +#define ASSERT_IS_MESSAGE(message) \ + ASSERT_IS_MESSAGE_DESCRIPTOR((message)->descriptor) + +#define ASSERT_IS_SERVICE_DESCRIPTOR(desc) \ + assert((desc)->magic == PROTOBUF_C__SERVICE_DESCRIPTOR_MAGIC) + +/**@}*/ + +/* --- version --- */ + +const char * +protobuf_c_version(void) +{ + return PROTOBUF_C_VERSION; +} + +uint32_t +protobuf_c_version_number(void) +{ + return PROTOBUF_C_VERSION_NUMBER; +} + +/* --- allocator --- */ + +static void * +system_alloc(void *allocator_data, size_t size) +{ + (void)allocator_data; + return malloc(size); +} + +static void +system_free(void *allocator_data, void *data) +{ + (void)allocator_data; + free(data); +} + +static inline void * +do_alloc(ProtobufCAllocator *allocator, size_t size) +{ + return allocator->alloc(allocator->allocator_data, size); +} + +static inline void +do_free(ProtobufCAllocator *allocator, void *data) +{ + if (data != NULL) + allocator->free(allocator->allocator_data, data); +} + +/* + * This allocator uses the system's malloc() and free(). It is the default + * allocator used if NULL is passed as the ProtobufCAllocator to an exported + * function. + */ +static ProtobufCAllocator protobuf_c__allocator = { + .alloc = &system_alloc, + .free = &system_free, + .allocator_data = NULL, +}; + +/* === buffer-simple === */ + +void +protobuf_c_buffer_simple_append(ProtobufCBuffer *buffer, + size_t len, const uint8_t *data) +{ + ProtobufCBufferSimple *simp = (ProtobufCBufferSimple *) buffer; + size_t new_len = simp->len + len; + + if (new_len > simp->alloced) { + ProtobufCAllocator *allocator = simp->allocator; + size_t new_alloced = simp->alloced * 2; + uint8_t *new_data; + + if (allocator == NULL) + allocator = &protobuf_c__allocator; + while (new_alloced < new_len) + new_alloced += new_alloced; + new_data = do_alloc(allocator, new_alloced); + if (!new_data) + return; + memcpy(new_data, simp->data, simp->len); + if (simp->must_free_data) + do_free(allocator, simp->data); + else + simp->must_free_data = TRUE; + simp->data = new_data; + simp->alloced = new_alloced; + } + memcpy(simp->data + simp->len, data, len); + simp->len = new_len; +} + +/** + * \defgroup packedsz protobuf_c_message_get_packed_size() implementation + * + * Routines mainly used by protobuf_c_message_get_packed_size(). + * + * \ingroup internal + * @{ + */ + +/** + * Return the number of bytes required to store the tag for the field. Includes + * 3 bits for the wire-type, and a single bit that denotes the end-of-tag. + * + * \param number + * Field tag to encode. + * \return + * Number of bytes required. + */ +static inline size_t +get_tag_size(uint32_t number) +{ + if (number < (1UL << 4)) { + return 1; + } else if (number < (1UL << 11)) { + return 2; + } else if (number < (1UL << 18)) { + return 3; + } else if (number < (1UL << 25)) { + return 4; + } else { + return 5; + } +} + +/** + * Return the number of bytes required to store a variable-length unsigned + * 32-bit integer in base-128 varint encoding. + * + * \param v + * Value to encode. + * \return + * Number of bytes required. + */ +static inline size_t +uint32_size(uint32_t v) +{ + if (v < (1UL << 7)) { + return 1; + } else if (v < (1UL << 14)) { + return 2; + } else if (v < (1UL << 21)) { + return 3; + } else if (v < (1UL << 28)) { + return 4; + } else { + return 5; + } +} + +/** + * Return the number of bytes required to store a variable-length signed 32-bit + * integer in base-128 varint encoding. + * + * \param v + * Value to encode. + * \return + * Number of bytes required. + */ +static inline size_t +int32_size(int32_t v) +{ + if (v < 0) { + return 10; + } else if (v < (1L << 7)) { + return 1; + } else if (v < (1L << 14)) { + return 2; + } else if (v < (1L << 21)) { + return 3; + } else if (v < (1L << 28)) { + return 4; + } else { + return 5; + } +} + +/** + * Return the ZigZag-encoded 32-bit unsigned integer form of a 32-bit signed + * integer. + * + * \param v + * Value to encode. + * \return + * ZigZag encoded integer. + */ +static inline uint32_t +zigzag32(int32_t v) +{ + // Note: Using unsigned types prevents undefined behavior + return ((uint32_t)v << 1) ^ -((uint32_t)v >> 31); +} + +/** + * Return the number of bytes required to store a signed 32-bit integer, + * converted to an unsigned 32-bit integer with ZigZag encoding, using base-128 + * varint encoding. + * + * \param v + * Value to encode. + * \return + * Number of bytes required. + */ +static inline size_t +sint32_size(int32_t v) +{ + return uint32_size(zigzag32(v)); +} + +/** + * Return the number of bytes required to store a 64-bit unsigned integer in + * base-128 varint encoding. + * + * \param v + * Value to encode. + * \return + * Number of bytes required. + */ +static inline size_t +uint64_size(uint64_t v) +{ + uint32_t upper_v = (uint32_t) (v >> 32); + + if (upper_v == 0) { + return uint32_size((uint32_t) v); + } else if (upper_v < (1UL << 3)) { + return 5; + } else if (upper_v < (1UL << 10)) { + return 6; + } else if (upper_v < (1UL << 17)) { + return 7; + } else if (upper_v < (1UL << 24)) { + return 8; + } else if (upper_v < (1UL << 31)) { + return 9; + } else { + return 10; + } +} + +/** + * Return the ZigZag-encoded 64-bit unsigned integer form of a 64-bit signed + * integer. + * + * \param v + * Value to encode. + * \return + * ZigZag encoded integer. + */ +static inline uint64_t +zigzag64(int64_t v) +{ + // Note: Using unsigned types prevents undefined behavior + return ((uint64_t)v << 1) ^ -((uint64_t)v >> 63); +} + +/** + * Return the number of bytes required to store a signed 64-bit integer, + * converted to an unsigned 64-bit integer with ZigZag encoding, using base-128 + * varint encoding. + * + * \param v + * Value to encode. + * \return + * Number of bytes required. + */ +static inline size_t +sint64_size(int64_t v) +{ + return uint64_size(zigzag64(v)); +} + +/** + * Calculate the serialized size of a single required message field, including + * the space needed by the preceding tag. + * + * \param field + * Field descriptor for member. + * \param member + * Field to encode. + * \return + * Number of bytes required. + */ +static size_t +required_field_get_packed_size(const ProtobufCFieldDescriptor *field, + const void *member) +{ + size_t rv = get_tag_size(field->id); + + switch (field->type) { + case PROTOBUF_C_TYPE_SINT32: + return rv + sint32_size(*(const int32_t *) member); + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + return rv + int32_size(*(const int32_t *) member); + case PROTOBUF_C_TYPE_UINT32: + return rv + uint32_size(*(const uint32_t *) member); + case PROTOBUF_C_TYPE_SINT64: + return rv + sint64_size(*(const int64_t *) member); + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + return rv + uint64_size(*(const uint64_t *) member); + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + return rv + 4; + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + return rv + 8; + case PROTOBUF_C_TYPE_BOOL: + return rv + 1; + case PROTOBUF_C_TYPE_FLOAT: + return rv + 4; + case PROTOBUF_C_TYPE_DOUBLE: + return rv + 8; + case PROTOBUF_C_TYPE_STRING: { + const char *str = *(char * const *) member; + size_t len = str ? strlen(str) : 0; + return rv + uint32_size(len) + len; + } + case PROTOBUF_C_TYPE_BYTES: { + size_t len = ((const ProtobufCBinaryData *) member)->len; + return rv + uint32_size(len) + len; + } + case PROTOBUF_C_TYPE_MESSAGE: { + const ProtobufCMessage *msg = *(ProtobufCMessage * const *) member; + size_t subrv = msg ? protobuf_c_message_get_packed_size(msg) : 0; + return rv + uint32_size(subrv) + subrv; + } + } + PROTOBUF_C__ASSERT_NOT_REACHED(); + return 0; +} + +/** + * Calculate the serialized size of a single oneof message field, including + * the space needed by the preceding tag. Returns 0 if the oneof field isn't + * selected or is not set. + * + * \param field + * Field descriptor for member. + * \param oneof_case + * Enum value that selects the field in the oneof. + * \param member + * Field to encode. + * \return + * Number of bytes required. + */ +static size_t +oneof_field_get_packed_size(const ProtobufCFieldDescriptor *field, + uint32_t oneof_case, + const void *member) +{ + if (oneof_case != field->id) { + return 0; + } + if (field->type == PROTOBUF_C_TYPE_MESSAGE || + field->type == PROTOBUF_C_TYPE_STRING) + { + const void *ptr = *(const void * const *) member; + if (ptr == NULL || ptr == field->default_value) + return 0; + } + return required_field_get_packed_size(field, member); +} + +/** + * Calculate the serialized size of a single optional message field, including + * the space needed by the preceding tag. Returns 0 if the optional field isn't + * set. + * + * \param field + * Field descriptor for member. + * \param has + * True if the field exists, false if not. + * \param member + * Field to encode. + * \return + * Number of bytes required. + */ +static size_t +optional_field_get_packed_size(const ProtobufCFieldDescriptor *field, + const protobuf_c_boolean has, + const void *member) +{ + if (field->type == PROTOBUF_C_TYPE_MESSAGE || + field->type == PROTOBUF_C_TYPE_STRING) + { + const void *ptr = *(const void * const *) member; + if (ptr == NULL || ptr == field->default_value) + return 0; + } else { + if (!has) + return 0; + } + return required_field_get_packed_size(field, member); +} + +static protobuf_c_boolean +field_is_zeroish(const ProtobufCFieldDescriptor *field, + const void *member) +{ + protobuf_c_boolean ret = FALSE; + + switch (field->type) { + case PROTOBUF_C_TYPE_BOOL: + ret = (0 == *(const protobuf_c_boolean *) member); + break; + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_SINT32: + case PROTOBUF_C_TYPE_INT32: + case PROTOBUF_C_TYPE_UINT32: + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + ret = (0 == *(const uint32_t *) member); + break; + case PROTOBUF_C_TYPE_SINT64: + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + ret = (0 == *(const uint64_t *) member); + break; + case PROTOBUF_C_TYPE_FLOAT: + ret = (0 == *(const float *) member); + break; + case PROTOBUF_C_TYPE_DOUBLE: + ret = (0 == *(const double *) member); + break; + case PROTOBUF_C_TYPE_STRING: + ret = (NULL == *(const char * const *) member) || + ('\0' == **(const char * const *) member); + break; + case PROTOBUF_C_TYPE_BYTES: + case PROTOBUF_C_TYPE_MESSAGE: + ret = (NULL == *(const void * const *) member); + break; + default: + ret = TRUE; + break; + } + + return ret; +} + +/** + * Calculate the serialized size of a single unlabeled message field, including + * the space needed by the preceding tag. Returns 0 if the field isn't set or + * if it is set to a "zeroish" value (null pointer or 0 for numerical values). + * Unlabeled fields are supported only in proto3. + * + * \param field + * Field descriptor for member. + * \param member + * Field to encode. + * \return + * Number of bytes required. + */ +static size_t +unlabeled_field_get_packed_size(const ProtobufCFieldDescriptor *field, + const void *member) +{ + if (field_is_zeroish(field, member)) + return 0; + return required_field_get_packed_size(field, member); +} + +/** + * Calculate the serialized size of repeated message fields, which may consist + * of any number of values (including 0). Includes the space needed by the + * preceding tags (as needed). + * + * \param field + * Field descriptor for member. + * \param count + * Number of repeated field members. + * \param member + * Field to encode. + * \return + * Number of bytes required. + */ +static size_t +repeated_field_get_packed_size(const ProtobufCFieldDescriptor *field, + size_t count, const void *member) +{ + size_t header_size; + size_t rv = 0; + unsigned i; + void *array = *(void * const *) member; + + if (count == 0) + return 0; + header_size = get_tag_size(field->id); + if (0 == (field->flags & PROTOBUF_C_FIELD_FLAG_PACKED)) + header_size *= count; + + switch (field->type) { + case PROTOBUF_C_TYPE_SINT32: + for (i = 0; i < count; i++) + rv += sint32_size(((int32_t *) array)[i]); + break; + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + for (i = 0; i < count; i++) + rv += int32_size(((int32_t *) array)[i]); + break; + case PROTOBUF_C_TYPE_UINT32: + for (i = 0; i < count; i++) + rv += uint32_size(((uint32_t *) array)[i]); + break; + case PROTOBUF_C_TYPE_SINT64: + for (i = 0; i < count; i++) + rv += sint64_size(((int64_t *) array)[i]); + break; + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + for (i = 0; i < count; i++) + rv += uint64_size(((uint64_t *) array)[i]); + break; + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + rv += 4 * count; + break; + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + rv += 8 * count; + break; + case PROTOBUF_C_TYPE_BOOL: + rv += count; + break; + case PROTOBUF_C_TYPE_STRING: + for (i = 0; i < count; i++) { + size_t len = strlen(((char **) array)[i]); + rv += uint32_size(len) + len; + } + break; + case PROTOBUF_C_TYPE_BYTES: + for (i = 0; i < count; i++) { + size_t len = ((ProtobufCBinaryData *) array)[i].len; + rv += uint32_size(len) + len; + } + break; + case PROTOBUF_C_TYPE_MESSAGE: + for (i = 0; i < count; i++) { + size_t len = protobuf_c_message_get_packed_size( + ((ProtobufCMessage **) array)[i]); + rv += uint32_size(len) + len; + } + break; + } + + if (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_PACKED)) + header_size += uint32_size(rv); + return header_size + rv; +} + +/** + * Calculate the serialized size of an unknown field, i.e. one that is passed + * through mostly uninterpreted. This is required for forward compatibility if + * new fields are added to the message descriptor. + * + * \param field + * Unknown field type. + * \return + * Number of bytes required. + */ +static inline size_t +unknown_field_get_packed_size(const ProtobufCMessageUnknownField *field) +{ + return get_tag_size(field->tag) + field->len; +} + +/**@}*/ + +/* + * Calculate the serialized size of the message. + */ +size_t protobuf_c_message_get_packed_size(const ProtobufCMessage *message) +{ + unsigned i; + size_t rv = 0; + + ASSERT_IS_MESSAGE(message); + for (i = 0; i < message->descriptor->n_fields; i++) { + const ProtobufCFieldDescriptor *field = + message->descriptor->fields + i; + const void *member = + ((const char *) message) + field->offset; + const void *qmember = + ((const char *) message) + field->quantifier_offset; + + if (field->label == PROTOBUF_C_LABEL_REQUIRED) { + rv += required_field_get_packed_size(field, member); + } else if ((field->label == PROTOBUF_C_LABEL_OPTIONAL || + field->label == PROTOBUF_C_LABEL_NONE) && + (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_ONEOF))) { + rv += oneof_field_get_packed_size( + field, + *(const uint32_t *) qmember, + member + ); + } else if (field->label == PROTOBUF_C_LABEL_OPTIONAL) { + rv += optional_field_get_packed_size( + field, + *(protobuf_c_boolean *) qmember, + member + ); + } else if (field->label == PROTOBUF_C_LABEL_NONE) { + rv += unlabeled_field_get_packed_size( + field, + member + ); + } else { + rv += repeated_field_get_packed_size( + field, + *(const size_t *) qmember, + member + ); + } + } + for (i = 0; i < message->n_unknown_fields; i++) + rv += unknown_field_get_packed_size(&message->unknown_fields[i]); + return rv; +} + +/** + * \defgroup pack protobuf_c_message_pack() implementation + * + * Routines mainly used by protobuf_c_message_pack(). + * + * \ingroup internal + * @{ + */ + +/** + * Pack an unsigned 32-bit integer in base-128 varint encoding and return the + * number of bytes written, which must be 5 or less. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t +uint32_pack(uint32_t value, uint8_t *out) +{ + unsigned rv = 0; + + if (value >= 0x80) { + out[rv++] = value | 0x80; + value >>= 7; + if (value >= 0x80) { + out[rv++] = value | 0x80; + value >>= 7; + if (value >= 0x80) { + out[rv++] = value | 0x80; + value >>= 7; + if (value >= 0x80) { + out[rv++] = value | 0x80; + value >>= 7; + } + } + } + } + /* assert: value<128 */ + out[rv++] = value; + return rv; +} + +/** + * Pack a signed 32-bit integer and return the number of bytes written, + * passed as unsigned to avoid implementation-specific behavior. + * Negative numbers are encoded as two's complement 64-bit integers. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t +int32_pack(uint32_t value, uint8_t *out) +{ + if ((int32_t)value < 0) { + out[0] = value | 0x80; + out[1] = (value >> 7) | 0x80; + out[2] = (value >> 14) | 0x80; + out[3] = (value >> 21) | 0x80; + out[4] = (value >> 28) | 0xf0; + out[5] = out[6] = out[7] = out[8] = 0xff; + out[9] = 0x01; + return 10; + } else { + return uint32_pack(value, out); + } +} + +/** + * Pack a signed 32-bit integer using ZigZag encoding and return the number of + * bytes written. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t +sint32_pack(int32_t value, uint8_t *out) +{ + return uint32_pack(zigzag32(value), out); +} + +/** + * Pack a 64-bit unsigned integer using base-128 varint encoding and return the + * number of bytes written. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static size_t +uint64_pack(uint64_t value, uint8_t *out) +{ + uint32_t hi = (uint32_t) (value >> 32); + uint32_t lo = (uint32_t) value; + unsigned rv; + + if (hi == 0) + return uint32_pack((uint32_t) lo, out); + out[0] = (lo) | 0x80; + out[1] = (lo >> 7) | 0x80; + out[2] = (lo >> 14) | 0x80; + out[3] = (lo >> 21) | 0x80; + if (hi < 8) { + out[4] = (hi << 4) | (lo >> 28); + return 5; + } else { + out[4] = ((hi & 7) << 4) | (lo >> 28) | 0x80; + hi >>= 3; + } + rv = 5; + while (hi >= 128) { + out[rv++] = hi | 0x80; + hi >>= 7; + } + out[rv++] = hi; + return rv; +} + +/** + * Pack a 64-bit signed integer in ZigZag encoding and return the number of + * bytes written. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t +sint64_pack(int64_t value, uint8_t *out) +{ + return uint64_pack(zigzag64(value), out); +} + +/** + * Pack a 32-bit quantity in little-endian byte order. Used for protobuf wire + * types fixed32, sfixed32, float. Similar to "htole32". + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t +fixed32_pack(uint32_t value, void *out) +{ +#if !defined(WORDS_BIGENDIAN) + memcpy(out, &value, 4); +#else + uint8_t *buf = out; + + buf[0] = value; + buf[1] = value >> 8; + buf[2] = value >> 16; + buf[3] = value >> 24; +#endif + return 4; +} + +/** + * Pack a 64-bit quantity in little-endian byte order. Used for protobuf wire + * types fixed64, sfixed64, double. Similar to "htole64". + * + * \todo The big-endian impl is really only good for 32-bit machines, a 64-bit + * version would be appreciated, plus a way to decide to use 64-bit math where + * convenient. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t +fixed64_pack(uint64_t value, void *out) +{ +#if !defined(WORDS_BIGENDIAN) + memcpy(out, &value, 8); +#else + fixed32_pack(value, out); + fixed32_pack(value >> 32, ((char *) out) + 4); +#endif + return 8; +} + +/** + * Pack a boolean value as an integer and return the number of bytes written. + * + * \todo Perhaps on some platforms *out = !!value would be a better impl, b/c + * that is idiomatic C++ in some STL implementations. + * + * \param value + * Value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t +boolean_pack(protobuf_c_boolean value, uint8_t *out) +{ + *out = value ? TRUE : FALSE; + return 1; +} + +/** + * Pack a NUL-terminated C string and return the number of bytes written. The + * output includes a length delimiter. + * + * The NULL pointer is treated as an empty string. This isn't really necessary, + * but it allows people to leave required strings blank. (See Issue #13 in the + * bug tracker for a little more explanation). + * + * \param str + * String to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t +string_pack(const char *str, uint8_t *out) +{ + if (str == NULL) { + out[0] = 0; + return 1; + } else { + size_t len = strlen(str); + size_t rv = uint32_pack(len, out); + memcpy(out + rv, str, len); + return rv + len; + } +} + +/** + * Pack a ProtobufCBinaryData and return the number of bytes written. The output + * includes a length delimiter. + * + * \param bd + * ProtobufCBinaryData to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static inline size_t +binary_data_pack(const ProtobufCBinaryData *bd, uint8_t *out) +{ + size_t len = bd->len; + size_t rv = uint32_pack(len, out); + memcpy(out + rv, bd->data, len); + return rv + len; +} + +/** + * Pack a ProtobufCMessage and return the number of bytes written. The output + * includes a length delimiter. + * + * \param message + * ProtobufCMessage object to pack. + * \param[out] out + * Packed message. + * \return + * Number of bytes written to `out`. + */ +static inline size_t +prefixed_message_pack(const ProtobufCMessage *message, uint8_t *out) +{ + if (message == NULL) { + out[0] = 0; + return 1; + } else { + size_t rv = protobuf_c_message_pack(message, out + 1); + uint32_t rv_packed_size = uint32_size(rv); + if (rv_packed_size != 1) + memmove(out + rv_packed_size, out + 1, rv); + return uint32_pack(rv, out) + rv; + } +} + +/** + * Pack a field tag. + * + * Wire-type will be added in required_field_pack(). + * + * \todo Just call uint64_pack on 64-bit platforms. + * + * \param id + * Tag value to encode. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static size_t +tag_pack(uint32_t id, uint8_t *out) +{ + if (id < (1UL << (32 - 3))) + return uint32_pack(id << 3, out); + else + return uint64_pack(((uint64_t) id) << 3, out); +} + +/** + * Pack a required field and return the number of bytes written. + * + * \param field + * Field descriptor. + * \param member + * The field member. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static size_t +required_field_pack(const ProtobufCFieldDescriptor *field, + const void *member, uint8_t *out) +{ + size_t rv = tag_pack(field->id, out); + + switch (field->type) { + case PROTOBUF_C_TYPE_SINT32: + out[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + return rv + sint32_pack(*(const int32_t *) member, out + rv); + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + out[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + return rv + int32_pack(*(const int32_t *) member, out + rv); + case PROTOBUF_C_TYPE_UINT32: + out[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + return rv + uint32_pack(*(const uint32_t *) member, out + rv); + case PROTOBUF_C_TYPE_SINT64: + out[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + return rv + sint64_pack(*(const int64_t *) member, out + rv); + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + out[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + return rv + uint64_pack(*(const uint64_t *) member, out + rv); + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + out[0] |= PROTOBUF_C_WIRE_TYPE_32BIT; + return rv + fixed32_pack(*(const uint32_t *) member, out + rv); + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + out[0] |= PROTOBUF_C_WIRE_TYPE_64BIT; + return rv + fixed64_pack(*(const uint64_t *) member, out + rv); + case PROTOBUF_C_TYPE_BOOL: + out[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + return rv + boolean_pack(*(const protobuf_c_boolean *) member, out + rv); + case PROTOBUF_C_TYPE_STRING: + out[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED; + return rv + string_pack(*(char *const *) member, out + rv); + case PROTOBUF_C_TYPE_BYTES: + out[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED; + return rv + binary_data_pack((const ProtobufCBinaryData *) member, out + rv); + case PROTOBUF_C_TYPE_MESSAGE: + out[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED; + return rv + prefixed_message_pack(*(ProtobufCMessage * const *) member, out + rv); + } + PROTOBUF_C__ASSERT_NOT_REACHED(); + return 0; +} + +/** + * Pack a oneof field and return the number of bytes written. Only packs the + * field that is selected by the case enum. + * + * \param field + * Field descriptor. + * \param oneof_case + * Enum value that selects the field in the oneof. + * \param member + * The field member. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static size_t +oneof_field_pack(const ProtobufCFieldDescriptor *field, + uint32_t oneof_case, + const void *member, uint8_t *out) +{ + if (oneof_case != field->id) { + return 0; + } + if (field->type == PROTOBUF_C_TYPE_MESSAGE || + field->type == PROTOBUF_C_TYPE_STRING) + { + const void *ptr = *(const void * const *) member; + if (ptr == NULL || ptr == field->default_value) + return 0; + } + return required_field_pack(field, member, out); +} + +/** + * Pack an optional field and return the number of bytes written. + * + * \param field + * Field descriptor. + * \param has + * Whether the field is set. + * \param member + * The field member. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static size_t +optional_field_pack(const ProtobufCFieldDescriptor *field, + const protobuf_c_boolean has, + const void *member, uint8_t *out) +{ + if (field->type == PROTOBUF_C_TYPE_MESSAGE || + field->type == PROTOBUF_C_TYPE_STRING) + { + const void *ptr = *(const void * const *) member; + if (ptr == NULL || ptr == field->default_value) + return 0; + } else { + if (!has) + return 0; + } + return required_field_pack(field, member, out); +} + +/** + * Pack an unlabeled field and return the number of bytes written. + * + * \param field + * Field descriptor. + * \param member + * The field member. + * \param[out] out + * Packed value. + * \return + * Number of bytes written to `out`. + */ +static size_t +unlabeled_field_pack(const ProtobufCFieldDescriptor *field, + const void *member, uint8_t *out) +{ + if (field_is_zeroish(field, member)) + return 0; + return required_field_pack(field, member, out); +} + +/** + * Given a field type, return the in-memory size. + * + * \todo Implement as a table lookup. + * + * \param type + * Field type. + * \return + * Size of the field. + */ +static inline size_t +sizeof_elt_in_repeated_array(ProtobufCType type) +{ + switch (type) { + case PROTOBUF_C_TYPE_SINT32: + case PROTOBUF_C_TYPE_INT32: + case PROTOBUF_C_TYPE_UINT32: + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + case PROTOBUF_C_TYPE_ENUM: + return 4; + case PROTOBUF_C_TYPE_SINT64: + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + return 8; + case PROTOBUF_C_TYPE_BOOL: + return sizeof(protobuf_c_boolean); + case PROTOBUF_C_TYPE_STRING: + case PROTOBUF_C_TYPE_MESSAGE: + return sizeof(void *); + case PROTOBUF_C_TYPE_BYTES: + return sizeof(ProtobufCBinaryData); + } + PROTOBUF_C__ASSERT_NOT_REACHED(); + return 0; +} + +/** + * Pack an array of 32-bit quantities. + * + * \param[out] out + * Destination. + * \param[in] in + * Source. + * \param[in] n + * Number of elements in the source array. + */ +static void +copy_to_little_endian_32(void *out, const void *in, const unsigned n) +{ +#if !defined(WORDS_BIGENDIAN) + memcpy(out, in, n * 4); +#else + unsigned i; + const uint32_t *ini = in; + for (i = 0; i < n; i++) + fixed32_pack(ini[i], (uint32_t *) out + i); +#endif +} + +/** + * Pack an array of 64-bit quantities. + * + * \param[out] out + * Destination. + * \param[in] in + * Source. + * \param[in] n + * Number of elements in the source array. + */ +static void +copy_to_little_endian_64(void *out, const void *in, const unsigned n) +{ +#if !defined(WORDS_BIGENDIAN) + memcpy(out, in, n * 8); +#else + unsigned i; + const uint64_t *ini = in; + for (i = 0; i < n; i++) + fixed64_pack(ini[i], (uint64_t *) out + i); +#endif +} + +/** + * Get the minimum number of bytes required to pack a field value of a + * particular type. + * + * \param type + * Field type. + * \return + * Number of bytes. + */ +static unsigned +get_type_min_size(ProtobufCType type) +{ + if (type == PROTOBUF_C_TYPE_SFIXED32 || + type == PROTOBUF_C_TYPE_FIXED32 || + type == PROTOBUF_C_TYPE_FLOAT) + { + return 4; + } + if (type == PROTOBUF_C_TYPE_SFIXED64 || + type == PROTOBUF_C_TYPE_FIXED64 || + type == PROTOBUF_C_TYPE_DOUBLE) + { + return 8; + } + return 1; +} + +/** + * Packs the elements of a repeated field and returns the serialised field and + * its length. + * + * \param field + * Field descriptor. + * \param count + * Number of elements in the repeated field array. + * \param member + * Pointer to the elements for this repeated field. + * \param[out] out + * Serialised representation of the repeated field. + * \return + * Number of bytes serialised to `out`. + */ +static size_t +repeated_field_pack(const ProtobufCFieldDescriptor *field, + size_t count, const void *member, uint8_t *out) +{ + void *array = *(void * const *) member; + unsigned i; + + if (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_PACKED)) { + unsigned header_len; + unsigned len_start; + unsigned min_length; + unsigned payload_len; + unsigned length_size_min; + unsigned actual_length_size; + uint8_t *payload_at; + + if (count == 0) + return 0; + header_len = tag_pack(field->id, out); + out[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED; + len_start = header_len; + min_length = get_type_min_size(field->type) * count; + length_size_min = uint32_size(min_length); + header_len += length_size_min; + payload_at = out + header_len; + + switch (field->type) { + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + copy_to_little_endian_32(payload_at, array, count); + payload_at += count * 4; + break; + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + copy_to_little_endian_64(payload_at, array, count); + payload_at += count * 8; + break; + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: { + const int32_t *arr = (const int32_t *) array; + for (i = 0; i < count; i++) + payload_at += int32_pack(arr[i], payload_at); + break; + } + case PROTOBUF_C_TYPE_SINT32: { + const int32_t *arr = (const int32_t *) array; + for (i = 0; i < count; i++) + payload_at += sint32_pack(arr[i], payload_at); + break; + } + case PROTOBUF_C_TYPE_SINT64: { + const int64_t *arr = (const int64_t *) array; + for (i = 0; i < count; i++) + payload_at += sint64_pack(arr[i], payload_at); + break; + } + case PROTOBUF_C_TYPE_UINT32: { + const uint32_t *arr = (const uint32_t *) array; + for (i = 0; i < count; i++) + payload_at += uint32_pack(arr[i], payload_at); + break; + } + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: { + const uint64_t *arr = (const uint64_t *) array; + for (i = 0; i < count; i++) + payload_at += uint64_pack(arr[i], payload_at); + break; + } + case PROTOBUF_C_TYPE_BOOL: { + const protobuf_c_boolean *arr = (const protobuf_c_boolean *) array; + for (i = 0; i < count; i++) + payload_at += boolean_pack(arr[i], payload_at); + break; + } + default: + PROTOBUF_C__ASSERT_NOT_REACHED(); + } + + payload_len = payload_at - (out + header_len); + actual_length_size = uint32_size(payload_len); + if (length_size_min != actual_length_size) { + assert(actual_length_size == length_size_min + 1); + memmove(out + header_len + 1, out + header_len, + payload_len); + header_len++; + } + uint32_pack(payload_len, out + len_start); + return header_len + payload_len; + } else { + /* not "packed" cased */ + /* CONSIDER: optimize this case a bit (by putting the loop inside the switch) */ + size_t rv = 0; + unsigned siz = sizeof_elt_in_repeated_array(field->type); + + for (i = 0; i < count; i++) { + rv += required_field_pack(field, array, out + rv); + array = (char *)array + siz; + } + return rv; + } +} + +static size_t +unknown_field_pack(const ProtobufCMessageUnknownField *field, uint8_t *out) +{ + size_t rv = tag_pack(field->tag, out); + out[0] |= field->wire_type; + memcpy(out + rv, field->data, field->len); + return rv + field->len; +} + +/**@}*/ + +size_t +protobuf_c_message_pack(const ProtobufCMessage *message, uint8_t *out) +{ + unsigned i; + size_t rv = 0; + + ASSERT_IS_MESSAGE(message); + for (i = 0; i < message->descriptor->n_fields; i++) { + const ProtobufCFieldDescriptor *field = + message->descriptor->fields + i; + const void *member = ((const char *) message) + field->offset; + + /* + * It doesn't hurt to compute qmember (a pointer to the + * quantifier field of the structure), but the pointer is only + * valid if the field is: + * - a repeated field, or + * - a field that is part of a oneof + * - an optional field that isn't a pointer type + * (Meaning: not a message or a string). + */ + const void *qmember = + ((const char *) message) + field->quantifier_offset; + + if (field->label == PROTOBUF_C_LABEL_REQUIRED) { + rv += required_field_pack(field, member, out + rv); + } else if ((field->label == PROTOBUF_C_LABEL_OPTIONAL || + field->label == PROTOBUF_C_LABEL_NONE) && + (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_ONEOF))) { + rv += oneof_field_pack( + field, + *(const uint32_t *) qmember, + member, + out + rv + ); + } else if (field->label == PROTOBUF_C_LABEL_OPTIONAL) { + rv += optional_field_pack( + field, + *(const protobuf_c_boolean *) qmember, + member, + out + rv + ); + } else if (field->label == PROTOBUF_C_LABEL_NONE) { + rv += unlabeled_field_pack(field, member, out + rv); + } else { + rv += repeated_field_pack(field, *(const size_t *) qmember, + member, out + rv); + } + } + for (i = 0; i < message->n_unknown_fields; i++) + rv += unknown_field_pack(&message->unknown_fields[i], out + rv); + return rv; +} + +/** + * \defgroup packbuf protobuf_c_message_pack_to_buffer() implementation + * + * Routines mainly used by protobuf_c_message_pack_to_buffer(). + * + * \ingroup internal + * @{ + */ + +/** + * Pack a required field to a virtual buffer. + * + * \param field + * Field descriptor. + * \param member + * The element to be packed. + * \param[out] buffer + * Virtual buffer to append data to. + * \return + * Number of bytes packed. + */ +static size_t +required_field_pack_to_buffer(const ProtobufCFieldDescriptor *field, + const void *member, ProtobufCBuffer *buffer) +{ + size_t rv; + uint8_t scratch[MAX_UINT64_ENCODED_SIZE * 2]; + + rv = tag_pack(field->id, scratch); + switch (field->type) { + case PROTOBUF_C_TYPE_SINT32: + scratch[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + rv += sint32_pack(*(const int32_t *) member, scratch + rv); + buffer->append(buffer, rv, scratch); + break; + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + scratch[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + rv += int32_pack(*(const int32_t *) member, scratch + rv); + buffer->append(buffer, rv, scratch); + break; + case PROTOBUF_C_TYPE_UINT32: + scratch[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + rv += uint32_pack(*(const uint32_t *) member, scratch + rv); + buffer->append(buffer, rv, scratch); + break; + case PROTOBUF_C_TYPE_SINT64: + scratch[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + rv += sint64_pack(*(const int64_t *) member, scratch + rv); + buffer->append(buffer, rv, scratch); + break; + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + scratch[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + rv += uint64_pack(*(const uint64_t *) member, scratch + rv); + buffer->append(buffer, rv, scratch); + break; + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + scratch[0] |= PROTOBUF_C_WIRE_TYPE_32BIT; + rv += fixed32_pack(*(const uint32_t *) member, scratch + rv); + buffer->append(buffer, rv, scratch); + break; + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + scratch[0] |= PROTOBUF_C_WIRE_TYPE_64BIT; + rv += fixed64_pack(*(const uint64_t *) member, scratch + rv); + buffer->append(buffer, rv, scratch); + break; + case PROTOBUF_C_TYPE_BOOL: + scratch[0] |= PROTOBUF_C_WIRE_TYPE_VARINT; + rv += boolean_pack(*(const protobuf_c_boolean *) member, scratch + rv); + buffer->append(buffer, rv, scratch); + break; + case PROTOBUF_C_TYPE_STRING: { + const char *str = *(char *const *) member; + size_t sublen = str ? strlen(str) : 0; + + scratch[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED; + rv += uint32_pack(sublen, scratch + rv); + buffer->append(buffer, rv, scratch); + buffer->append(buffer, sublen, (const uint8_t *) str); + rv += sublen; + break; + } + case PROTOBUF_C_TYPE_BYTES: { + const ProtobufCBinaryData *bd = ((const ProtobufCBinaryData *) member); + size_t sublen = bd->len; + + scratch[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED; + rv += uint32_pack(sublen, scratch + rv); + buffer->append(buffer, rv, scratch); + buffer->append(buffer, sublen, bd->data); + rv += sublen; + break; + } + case PROTOBUF_C_TYPE_MESSAGE: { + const ProtobufCMessage *msg = *(ProtobufCMessage * const *) member; + + scratch[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED; + if (msg == NULL) { + rv += uint32_pack(0, scratch + rv); + buffer->append(buffer, rv, scratch); + } else { + size_t sublen = protobuf_c_message_get_packed_size(msg); + rv += uint32_pack(sublen, scratch + rv); + buffer->append(buffer, rv, scratch); + protobuf_c_message_pack_to_buffer(msg, buffer); + rv += sublen; + } + break; + } + default: + PROTOBUF_C__ASSERT_NOT_REACHED(); + } + return rv; +} + +/** + * Pack a oneof field to a buffer. Only packs the field that is selected by the case enum. + * + * \param field + * Field descriptor. + * \param oneof_case + * Enum value that selects the field in the oneof. + * \param member + * The element to be packed. + * \param[out] buffer + * Virtual buffer to append data to. + * \return + * Number of bytes serialised to `buffer`. + */ +static size_t +oneof_field_pack_to_buffer(const ProtobufCFieldDescriptor *field, + uint32_t oneof_case, + const void *member, ProtobufCBuffer *buffer) +{ + if (oneof_case != field->id) { + return 0; + } + if (field->type == PROTOBUF_C_TYPE_MESSAGE || + field->type == PROTOBUF_C_TYPE_STRING) + { + const void *ptr = *(const void *const *) member; + if (ptr == NULL || ptr == field->default_value) + return 0; + } + return required_field_pack_to_buffer(field, member, buffer); +} + +/** + * Pack an optional field to a buffer. + * + * \param field + * Field descriptor. + * \param has + * Whether the field is set. + * \param member + * The element to be packed. + * \param[out] buffer + * Virtual buffer to append data to. + * \return + * Number of bytes serialised to `buffer`. + */ +static size_t +optional_field_pack_to_buffer(const ProtobufCFieldDescriptor *field, + const protobuf_c_boolean has, + const void *member, ProtobufCBuffer *buffer) +{ + if (field->type == PROTOBUF_C_TYPE_MESSAGE || + field->type == PROTOBUF_C_TYPE_STRING) + { + const void *ptr = *(const void *const *) member; + if (ptr == NULL || ptr == field->default_value) + return 0; + } else { + if (!has) + return 0; + } + return required_field_pack_to_buffer(field, member, buffer); +} + +/** + * Pack an unlabeled field to a buffer. + * + * \param field + * Field descriptor. + * \param member + * The element to be packed. + * \param[out] buffer + * Virtual buffer to append data to. + * \return + * Number of bytes serialised to `buffer`. + */ +static size_t +unlabeled_field_pack_to_buffer(const ProtobufCFieldDescriptor *field, + const void *member, ProtobufCBuffer *buffer) +{ + if (field_is_zeroish(field, member)) + return 0; + return required_field_pack_to_buffer(field, member, buffer); +} + +/** + * Get the packed size of an array of same field type. + * + * \param field + * Field descriptor. + * \param count + * Number of elements of this type. + * \param array + * The elements to get the size of. + * \return + * Number of bytes required. + */ +static size_t +get_packed_payload_length(const ProtobufCFieldDescriptor *field, + unsigned count, const void *array) +{ + unsigned rv = 0; + unsigned i; + + switch (field->type) { + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + return count * 4; + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + return count * 8; + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: { + const int32_t *arr = (const int32_t *) array; + for (i = 0; i < count; i++) + rv += int32_size(arr[i]); + break; + } + case PROTOBUF_C_TYPE_SINT32: { + const int32_t *arr = (const int32_t *) array; + for (i = 0; i < count; i++) + rv += sint32_size(arr[i]); + break; + } + case PROTOBUF_C_TYPE_UINT32: { + const uint32_t *arr = (const uint32_t *) array; + for (i = 0; i < count; i++) + rv += uint32_size(arr[i]); + break; + } + case PROTOBUF_C_TYPE_SINT64: { + const int64_t *arr = (const int64_t *) array; + for (i = 0; i < count; i++) + rv += sint64_size(arr[i]); + break; + } + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: { + const uint64_t *arr = (const uint64_t *) array; + for (i = 0; i < count; i++) + rv += uint64_size(arr[i]); + break; + } + case PROTOBUF_C_TYPE_BOOL: + return count; + default: + PROTOBUF_C__ASSERT_NOT_REACHED(); + } + return rv; +} + +/** + * Pack an array of same field type to a virtual buffer. + * + * \param field + * Field descriptor. + * \param count + * Number of elements of this type. + * \param array + * The elements to get the size of. + * \param[out] buffer + * Virtual buffer to append data to. + * \return + * Number of bytes packed. + */ +static size_t +pack_buffer_packed_payload(const ProtobufCFieldDescriptor *field, + unsigned count, const void *array, + ProtobufCBuffer *buffer) +{ + uint8_t scratch[16]; + size_t rv = 0; + unsigned i; + + switch (field->type) { + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: +#if !defined(WORDS_BIGENDIAN) + rv = count * 4; + goto no_packing_needed; +#else + for (i = 0; i < count; i++) { + unsigned len = fixed32_pack(((uint32_t *) array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; +#endif + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: +#if !defined(WORDS_BIGENDIAN) + rv = count * 8; + goto no_packing_needed; +#else + for (i = 0; i < count; i++) { + unsigned len = fixed64_pack(((uint64_t *) array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; +#endif + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + for (i = 0; i < count; i++) { + unsigned len = int32_pack(((int32_t *) array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; + case PROTOBUF_C_TYPE_SINT32: + for (i = 0; i < count; i++) { + unsigned len = sint32_pack(((int32_t *) array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; + case PROTOBUF_C_TYPE_UINT32: + for (i = 0; i < count; i++) { + unsigned len = uint32_pack(((uint32_t *) array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; + case PROTOBUF_C_TYPE_SINT64: + for (i = 0; i < count; i++) { + unsigned len = sint64_pack(((int64_t *) array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + for (i = 0; i < count; i++) { + unsigned len = uint64_pack(((uint64_t *) array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + break; + case PROTOBUF_C_TYPE_BOOL: + for (i = 0; i < count; i++) { + unsigned len = boolean_pack(((protobuf_c_boolean *) array)[i], scratch); + buffer->append(buffer, len, scratch); + rv += len; + } + return count; + default: + PROTOBUF_C__ASSERT_NOT_REACHED(); + } + return rv; + +#if !defined(WORDS_BIGENDIAN) +no_packing_needed: + buffer->append(buffer, rv, array); + return rv; +#endif +} + +static size_t +repeated_field_pack_to_buffer(const ProtobufCFieldDescriptor *field, + unsigned count, const void *member, + ProtobufCBuffer *buffer) +{ + char *array = *(char * const *) member; + + if (count == 0) + return 0; + if (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_PACKED)) { + uint8_t scratch[MAX_UINT64_ENCODED_SIZE * 2]; + size_t rv = tag_pack(field->id, scratch); + size_t payload_len = get_packed_payload_length(field, count, array); + size_t tmp; + + scratch[0] |= PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED; + rv += uint32_pack(payload_len, scratch + rv); + buffer->append(buffer, rv, scratch); + tmp = pack_buffer_packed_payload(field, count, array, buffer); + assert(tmp == payload_len); + return rv + payload_len; + } else { + size_t siz; + unsigned i; + /* CONSIDER: optimize this case a bit (by putting the loop inside the switch) */ + unsigned rv = 0; + + siz = sizeof_elt_in_repeated_array(field->type); + for (i = 0; i < count; i++) { + rv += required_field_pack_to_buffer(field, array, buffer); + array += siz; + } + return rv; + } +} + +static size_t +unknown_field_pack_to_buffer(const ProtobufCMessageUnknownField *field, + ProtobufCBuffer *buffer) +{ + uint8_t header[MAX_UINT64_ENCODED_SIZE]; + size_t rv = tag_pack(field->tag, header); + + header[0] |= field->wire_type; + buffer->append(buffer, rv, header); + buffer->append(buffer, field->len, field->data); + return rv + field->len; +} + +/**@}*/ + +size_t +protobuf_c_message_pack_to_buffer(const ProtobufCMessage *message, + ProtobufCBuffer *buffer) +{ + unsigned i; + size_t rv = 0; + + ASSERT_IS_MESSAGE(message); + for (i = 0; i < message->descriptor->n_fields; i++) { + const ProtobufCFieldDescriptor *field = + message->descriptor->fields + i; + const void *member = + ((const char *) message) + field->offset; + const void *qmember = + ((const char *) message) + field->quantifier_offset; + + if (field->label == PROTOBUF_C_LABEL_REQUIRED) { + rv += required_field_pack_to_buffer(field, member, buffer); + } else if ((field->label == PROTOBUF_C_LABEL_OPTIONAL || + field->label == PROTOBUF_C_LABEL_NONE) && + (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_ONEOF))) { + rv += oneof_field_pack_to_buffer( + field, + *(const uint32_t *) qmember, + member, + buffer + ); + } else if (field->label == PROTOBUF_C_LABEL_OPTIONAL) { + rv += optional_field_pack_to_buffer( + field, + *(const protobuf_c_boolean *) qmember, + member, + buffer + ); + } else if (field->label == PROTOBUF_C_LABEL_NONE) { + rv += unlabeled_field_pack_to_buffer( + field, + member, + buffer + ); + } else { + rv += repeated_field_pack_to_buffer( + field, + *(const size_t *) qmember, + member, + buffer + ); + } + } + for (i = 0; i < message->n_unknown_fields; i++) + rv += unknown_field_pack_to_buffer(&message->unknown_fields[i], buffer); + + return rv; +} + +/** + * \defgroup unpack unpacking implementation + * + * Routines mainly used by the unpacking functions. + * + * \ingroup internal + * @{ + */ + +static inline int +int_range_lookup(unsigned n_ranges, const ProtobufCIntRange *ranges, int value) +{ + unsigned n; + unsigned start; + + if (n_ranges == 0) + return -1; + start = 0; + n = n_ranges; + while (n > 1) { + unsigned mid = start + n / 2; + + if (value < ranges[mid].start_value) { + n = mid - start; + } else if (value >= ranges[mid].start_value + + (int) (ranges[mid + 1].orig_index - + ranges[mid].orig_index)) + { + unsigned new_start = mid + 1; + n = start + n - new_start; + start = new_start; + } else + return (value - ranges[mid].start_value) + + ranges[mid].orig_index; + } + if (n > 0) { + unsigned start_orig_index = ranges[start].orig_index; + unsigned range_size = + ranges[start + 1].orig_index - start_orig_index; + + if (ranges[start].start_value <= value && + value < (int) (ranges[start].start_value + range_size)) + { + return (value - ranges[start].start_value) + + start_orig_index; + } + } + return -1; +} + +static size_t +parse_tag_and_wiretype(size_t len, + const uint8_t *data, + uint32_t *tag_out, + uint8_t *wiretype_out) +{ + unsigned max_rv = len > 5 ? 5 : len; + uint32_t tag = (data[0] & 0x7f) >> 3; + unsigned shift = 4; + unsigned rv; + + /* 0 is not a valid tag value */ + if ((data[0] & 0xf8) == 0) { + return 0; + } + + *wiretype_out = data[0] & 7; + if ((data[0] & 0x80) == 0) { + *tag_out = tag; + return 1; + } + for (rv = 1; rv < max_rv; rv++) { + if (data[rv] & 0x80) { + tag |= (data[rv] & 0x7f) << shift; + shift += 7; + } else { + tag |= data[rv] << shift; + *tag_out = tag; + return rv + 1; + } + } + return 0; /* error: bad header */ +} + +/* sizeof(ScannedMember) must be <= (1UL<<BOUND_SIZEOF_SCANNED_MEMBER_LOG2) */ +#define BOUND_SIZEOF_SCANNED_MEMBER_LOG2 5 +typedef struct ScannedMember ScannedMember; +/** Field as it's being read. */ +struct ScannedMember { + uint32_t tag; /**< Field tag. */ + uint8_t wire_type; /**< Field type. */ + uint8_t length_prefix_len; /**< Prefix length. */ + const ProtobufCFieldDescriptor *field; /**< Field descriptor. */ + size_t len; /**< Field length. */ + const uint8_t *data; /**< Pointer to field data. */ +}; + +static inline size_t +scan_length_prefixed_data(size_t len, const uint8_t *data, + size_t *prefix_len_out) +{ + unsigned hdr_max = len < 5 ? len : 5; + unsigned hdr_len; + size_t val = 0; + unsigned i; + unsigned shift = 0; + + for (i = 0; i < hdr_max; i++) { + val |= ((size_t)data[i] & 0x7f) << shift; + shift += 7; + if ((data[i] & 0x80) == 0) + break; + } + if (i == hdr_max) { + PROTOBUF_C_UNPACK_ERROR("error parsing length for length-prefixed data"); + return 0; + } + hdr_len = i + 1; + *prefix_len_out = hdr_len; + if (val > INT_MAX) { + // Protobuf messages should always be less than 2 GiB in size. + // We also want to return early here so that hdr_len + val does + // not overflow on 32-bit systems. + PROTOBUF_C_UNPACK_ERROR("length prefix of %lu is too large", + (unsigned long int)val); + return 0; + } + if (hdr_len + val > len) { + PROTOBUF_C_UNPACK_ERROR("data too short after length-prefix of %lu", + (unsigned long int)val); + return 0; + } + return hdr_len + val; +} + +static size_t +max_b128_numbers(size_t len, const uint8_t *data) +{ + size_t rv = 0; + while (len--) + if ((*data++ & 0x80) == 0) + ++rv; + return rv; +} + +/**@}*/ + +/** + * Merge earlier message into a latter message. + * + * For numeric types and strings, if the same value appears multiple + * times, the parser accepts the last value it sees. For embedded + * message fields, the parser merges multiple instances of the same + * field. That is, all singular scalar fields in the latter instance + * replace those in the former, singular embedded messages are merged, + * and repeated fields are concatenated. + * + * The earlier message should be freed after calling this function, as + * some of its fields may have been reused and changed to their default + * values during the merge. + */ +static protobuf_c_boolean +merge_messages(ProtobufCMessage *earlier_msg, + ProtobufCMessage *latter_msg, + ProtobufCAllocator *allocator) +{ + unsigned i; + const ProtobufCFieldDescriptor *fields = + latter_msg->descriptor->fields; + for (i = 0; i < latter_msg->descriptor->n_fields; i++) { + if (fields[i].label == PROTOBUF_C_LABEL_REPEATED) { + size_t *n_earlier = + STRUCT_MEMBER_PTR(size_t, earlier_msg, + fields[i].quantifier_offset); + uint8_t **p_earlier = + STRUCT_MEMBER_PTR(uint8_t *, earlier_msg, + fields[i].offset); + size_t *n_latter = + STRUCT_MEMBER_PTR(size_t, latter_msg, + fields[i].quantifier_offset); + uint8_t **p_latter = + STRUCT_MEMBER_PTR(uint8_t *, latter_msg, + fields[i].offset); + + if (*n_earlier > 0) { + if (*n_latter > 0) { + /* Concatenate the repeated field */ + size_t el_size = + sizeof_elt_in_repeated_array(fields[i].type); + uint8_t *new_field; + + new_field = do_alloc(allocator, + (*n_earlier + *n_latter) * el_size); + if (!new_field) + return FALSE; + + memcpy(new_field, *p_earlier, + *n_earlier * el_size); + memcpy(new_field + + *n_earlier * el_size, + *p_latter, + *n_latter * el_size); + + do_free(allocator, *p_latter); + do_free(allocator, *p_earlier); + *p_latter = new_field; + *n_latter = *n_earlier + *n_latter; + } else { + /* Zero copy the repeated field from the earlier message */ + *n_latter = *n_earlier; + *p_latter = *p_earlier; + } + /* Make sure the field does not get double freed */ + *n_earlier = 0; + *p_earlier = 0; + } + } else if (fields[i].label == PROTOBUF_C_LABEL_OPTIONAL || + fields[i].label == PROTOBUF_C_LABEL_NONE) { + const ProtobufCFieldDescriptor *field; + uint32_t *earlier_case_p = STRUCT_MEMBER_PTR(uint32_t, + earlier_msg, + fields[i]. + quantifier_offset); + uint32_t *latter_case_p = STRUCT_MEMBER_PTR(uint32_t, + latter_msg, + fields[i]. + quantifier_offset); + protobuf_c_boolean need_to_merge = FALSE; + void *earlier_elem; + void *latter_elem; + const void *def_val; + + if (fields[i].flags & PROTOBUF_C_FIELD_FLAG_ONEOF) { + if (*latter_case_p == 0) { + /* lookup correct oneof field */ + int field_index = + int_range_lookup( + latter_msg->descriptor + ->n_field_ranges, + latter_msg->descriptor + ->field_ranges, + *earlier_case_p); + if (field_index < 0) + return FALSE; + field = latter_msg->descriptor->fields + + field_index; + } else { + /* Oneof is present in the latter message, move on */ + continue; + } + } else { + field = &fields[i]; + } + + earlier_elem = STRUCT_MEMBER_P(earlier_msg, field->offset); + latter_elem = STRUCT_MEMBER_P(latter_msg, field->offset); + def_val = field->default_value; + + switch (field->type) { + case PROTOBUF_C_TYPE_MESSAGE: { + ProtobufCMessage *em = *(ProtobufCMessage **) earlier_elem; + ProtobufCMessage *lm = *(ProtobufCMessage **) latter_elem; + if (em != NULL) { + if (lm != NULL) { + if (!merge_messages(em, lm, allocator)) + return FALSE; + /* Already merged */ + need_to_merge = FALSE; + } else { + /* Zero copy the message */ + need_to_merge = TRUE; + } + } + break; + } + case PROTOBUF_C_TYPE_BYTES: { + uint8_t *e_data = + ((ProtobufCBinaryData *) earlier_elem)->data; + uint8_t *l_data = + ((ProtobufCBinaryData *) latter_elem)->data; + const ProtobufCBinaryData *d_bd = + (ProtobufCBinaryData *) def_val; + + need_to_merge = + (e_data != NULL && + (d_bd == NULL || + e_data != d_bd->data)) && + (l_data == NULL || + (d_bd != NULL && + l_data == d_bd->data)); + break; + } + case PROTOBUF_C_TYPE_STRING: { + char *e_str = *(char **) earlier_elem; + char *l_str = *(char **) latter_elem; + const char *d_str = def_val; + + need_to_merge = e_str != d_str && l_str == d_str; + break; + } + default: { + /* Could be has field or case enum, the logic is + * equivalent, since 0 (FALSE) means not set for + * oneof */ + need_to_merge = (*earlier_case_p != 0) && + (*latter_case_p == 0); + break; + } + } + + if (need_to_merge) { + size_t el_size = + sizeof_elt_in_repeated_array(field->type); + memcpy(latter_elem, earlier_elem, el_size); + /* + * Reset the element from the old message to 0 + * to make sure earlier message deallocation + * doesn't corrupt zero-copied data in the new + * message, earlier message will be freed after + * this function is called anyway + */ + memset(earlier_elem, 0, el_size); + + if (field->quantifier_offset != 0) { + /* Set the has field or the case enum, + * if applicable */ + *latter_case_p = *earlier_case_p; + *earlier_case_p = 0; + } + } + } + } + return TRUE; +} + +/** + * Count packed elements. + * + * Given a raw slab of packed-repeated values, determine the number of + * elements. This function detects certain kinds of errors but not + * others; the remaining error checking is done by + * parse_packed_repeated_member(). + */ +static protobuf_c_boolean +count_packed_elements(ProtobufCType type, + size_t len, const uint8_t *data, size_t *count_out) +{ + switch (type) { + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + if (len % 4 != 0) { + PROTOBUF_C_UNPACK_ERROR("length must be a multiple of 4 for fixed-length 32-bit types"); + return FALSE; + } + *count_out = len / 4; + return TRUE; + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + if (len % 8 != 0) { + PROTOBUF_C_UNPACK_ERROR("length must be a multiple of 8 for fixed-length 64-bit types"); + return FALSE; + } + *count_out = len / 8; + return TRUE; + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + case PROTOBUF_C_TYPE_SINT32: + case PROTOBUF_C_TYPE_UINT32: + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_SINT64: + case PROTOBUF_C_TYPE_UINT64: + *count_out = max_b128_numbers(len, data); + return TRUE; + case PROTOBUF_C_TYPE_BOOL: + *count_out = len; + return TRUE; + case PROTOBUF_C_TYPE_STRING: + case PROTOBUF_C_TYPE_BYTES: + case PROTOBUF_C_TYPE_MESSAGE: + default: + PROTOBUF_C_UNPACK_ERROR("bad protobuf-c type %u for packed-repeated", type); + return FALSE; + } +} + +static inline uint32_t +parse_uint32(unsigned len, const uint8_t *data) +{ + uint32_t rv = data[0] & 0x7f; + if (len > 1) { + rv |= ((uint32_t) (data[1] & 0x7f) << 7); + if (len > 2) { + rv |= ((uint32_t) (data[2] & 0x7f) << 14); + if (len > 3) { + rv |= ((uint32_t) (data[3] & 0x7f) << 21); + if (len > 4) + rv |= ((uint32_t) (data[4]) << 28); + } + } + } + return rv; +} + +static inline uint32_t +parse_int32(unsigned len, const uint8_t *data) +{ + return parse_uint32(len, data); +} + +static inline int32_t +unzigzag32(uint32_t v) +{ + // Note: Using unsigned types prevents undefined behavior + return (int32_t)((v >> 1) ^ -(v & 1)); +} + +static inline uint32_t +parse_fixed_uint32(const uint8_t *data) +{ +#if !defined(WORDS_BIGENDIAN) + uint32_t t; + memcpy(&t, data, 4); + return t; +#else + return data[0] | + ((uint32_t) (data[1]) << 8) | + ((uint32_t) (data[2]) << 16) | + ((uint32_t) (data[3]) << 24); +#endif +} + +static uint64_t +parse_uint64(unsigned len, const uint8_t *data) +{ + unsigned shift, i; + uint64_t rv; + + if (len < 5) + return parse_uint32(len, data); + rv = ((uint64_t) (data[0] & 0x7f)) | + ((uint64_t) (data[1] & 0x7f) << 7) | + ((uint64_t) (data[2] & 0x7f) << 14) | + ((uint64_t) (data[3] & 0x7f) << 21); + shift = 28; + for (i = 4; i < len; i++) { + rv |= (((uint64_t) (data[i] & 0x7f)) << shift); + shift += 7; + } + return rv; +} + +static inline int64_t +unzigzag64(uint64_t v) +{ + // Note: Using unsigned types prevents undefined behavior + return (int64_t)((v >> 1) ^ -(v & 1)); +} + +static inline uint64_t +parse_fixed_uint64(const uint8_t *data) +{ +#if !defined(WORDS_BIGENDIAN) + uint64_t t; + memcpy(&t, data, 8); + return t; +#else + return (uint64_t) parse_fixed_uint32(data) | + (((uint64_t) parse_fixed_uint32(data + 4)) << 32); +#endif +} + +static protobuf_c_boolean +parse_boolean(unsigned len, const uint8_t *data) +{ + unsigned i; + for (i = 0; i < len; i++) + if (data[i] & 0x7f) + return TRUE; + return FALSE; +} + +static protobuf_c_boolean +parse_required_member(ScannedMember *scanned_member, + void *member, + ProtobufCAllocator *allocator, + protobuf_c_boolean maybe_clear) +{ + unsigned len = scanned_member->len; + const uint8_t *data = scanned_member->data; + uint8_t wire_type = scanned_member->wire_type; + + switch (scanned_member->field->type) { + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) + return FALSE; + *(int32_t *) member = parse_int32(len, data); + return TRUE; + case PROTOBUF_C_TYPE_UINT32: + if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) + return FALSE; + *(uint32_t *) member = parse_uint32(len, data); + return TRUE; + case PROTOBUF_C_TYPE_SINT32: + if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) + return FALSE; + *(int32_t *) member = unzigzag32(parse_uint32(len, data)); + return TRUE; + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + if (wire_type != PROTOBUF_C_WIRE_TYPE_32BIT) + return FALSE; + *(uint32_t *) member = parse_fixed_uint32(data); + return TRUE; + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) + return FALSE; + *(uint64_t *) member = parse_uint64(len, data); + return TRUE; + case PROTOBUF_C_TYPE_SINT64: + if (wire_type != PROTOBUF_C_WIRE_TYPE_VARINT) + return FALSE; + *(int64_t *) member = unzigzag64(parse_uint64(len, data)); + return TRUE; + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + if (wire_type != PROTOBUF_C_WIRE_TYPE_64BIT) + return FALSE; + *(uint64_t *) member = parse_fixed_uint64(data); + return TRUE; + case PROTOBUF_C_TYPE_BOOL: + *(protobuf_c_boolean *) member = parse_boolean(len, data); + return TRUE; + case PROTOBUF_C_TYPE_STRING: { + char **pstr = member; + unsigned pref_len = scanned_member->length_prefix_len; + + if (wire_type != PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED) + return FALSE; + + if (maybe_clear && *pstr != NULL) { + const char *def = scanned_member->field->default_value; + if (*pstr != NULL && *pstr != def) + do_free(allocator, *pstr); + } + *pstr = do_alloc(allocator, len - pref_len + 1); + if (*pstr == NULL) + return FALSE; + memcpy(*pstr, data + pref_len, len - pref_len); + (*pstr)[len - pref_len] = 0; + return TRUE; + } + case PROTOBUF_C_TYPE_BYTES: { + ProtobufCBinaryData *bd = member; + const ProtobufCBinaryData *def_bd; + unsigned pref_len = scanned_member->length_prefix_len; + + if (wire_type != PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED) + return FALSE; + + def_bd = scanned_member->field->default_value; + if (maybe_clear && + bd->data != NULL && + (def_bd == NULL || bd->data != def_bd->data)) + { + do_free(allocator, bd->data); + } + if (len > pref_len) { + bd->data = do_alloc(allocator, len - pref_len); + if (bd->data == NULL) + return FALSE; + memcpy(bd->data, data + pref_len, len - pref_len); + } else { + bd->data = NULL; + } + bd->len = len - pref_len; + return TRUE; + } + case PROTOBUF_C_TYPE_MESSAGE: { + ProtobufCMessage **pmessage = member; + ProtobufCMessage *subm; + const ProtobufCMessage *def_mess; + protobuf_c_boolean merge_successful = TRUE; + unsigned pref_len = scanned_member->length_prefix_len; + + if (wire_type != PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED) + return FALSE; + + def_mess = scanned_member->field->default_value; + if (len >= pref_len) + subm = protobuf_c_message_unpack(scanned_member->field->descriptor, + allocator, + len - pref_len, + data + pref_len); + else + subm = NULL; + + if (maybe_clear && + *pmessage != NULL && + *pmessage != def_mess) + { + if (subm != NULL) + merge_successful = merge_messages(*pmessage, subm, allocator); + /* Delete the previous message */ + protobuf_c_message_free_unpacked(*pmessage, allocator); + } + *pmessage = subm; + if (subm == NULL || !merge_successful) + return FALSE; + return TRUE; + } + } + return FALSE; +} + +static protobuf_c_boolean +parse_oneof_member (ScannedMember *scanned_member, + void *member, + ProtobufCMessage *message, + ProtobufCAllocator *allocator) +{ + uint32_t *oneof_case = STRUCT_MEMBER_PTR(uint32_t, message, + scanned_member->field->quantifier_offset); + + /* If we have already parsed a member of this oneof, free it. */ + if (*oneof_case != 0) { + const ProtobufCFieldDescriptor *old_field; + size_t el_size; + /* lookup field */ + int field_index = + int_range_lookup(message->descriptor->n_field_ranges, + message->descriptor->field_ranges, + *oneof_case); + if (field_index < 0) + return FALSE; + old_field = message->descriptor->fields + field_index; + el_size = sizeof_elt_in_repeated_array(old_field->type); + + switch (old_field->type) { + case PROTOBUF_C_TYPE_STRING: { + char **pstr = member; + const char *def = old_field->default_value; + if (*pstr != NULL && *pstr != def) + do_free(allocator, *pstr); + break; + } + case PROTOBUF_C_TYPE_BYTES: { + ProtobufCBinaryData *bd = member; + const ProtobufCBinaryData *def_bd = old_field->default_value; + if (bd->data != NULL && + (def_bd == NULL || bd->data != def_bd->data)) + { + do_free(allocator, bd->data); + } + break; + } + case PROTOBUF_C_TYPE_MESSAGE: { + ProtobufCMessage **pmessage = member; + const ProtobufCMessage *def_mess = old_field->default_value; + if (*pmessage != NULL && *pmessage != def_mess) + protobuf_c_message_free_unpacked(*pmessage, allocator); + break; + } + default: + break; + } + + memset (member, 0, el_size); + } + if (!parse_required_member (scanned_member, member, allocator, TRUE)) + return FALSE; + + *oneof_case = scanned_member->tag; + return TRUE; +} + + +static protobuf_c_boolean +parse_optional_member(ScannedMember *scanned_member, + void *member, + ProtobufCMessage *message, + ProtobufCAllocator *allocator) +{ + if (!parse_required_member(scanned_member, member, allocator, TRUE)) + return FALSE; + if (scanned_member->field->quantifier_offset != 0) + STRUCT_MEMBER(protobuf_c_boolean, + message, + scanned_member->field->quantifier_offset) = TRUE; + return TRUE; +} + +static protobuf_c_boolean +parse_repeated_member(ScannedMember *scanned_member, + void *member, + ProtobufCMessage *message, + ProtobufCAllocator *allocator) +{ + const ProtobufCFieldDescriptor *field = scanned_member->field; + size_t *p_n = STRUCT_MEMBER_PTR(size_t, message, field->quantifier_offset); + size_t siz = sizeof_elt_in_repeated_array(field->type); + char *array = *(char **) member; + + if (!parse_required_member(scanned_member, array + siz * (*p_n), + allocator, FALSE)) + { + return FALSE; + } + *p_n += 1; + return TRUE; +} + +static unsigned +scan_varint(unsigned len, const uint8_t *data) +{ + unsigned i; + if (len > 10) + len = 10; + for (i = 0; i < len; i++) + if ((data[i] & 0x80) == 0) + break; + if (i == len) + return 0; + return i + 1; +} + +static protobuf_c_boolean +parse_packed_repeated_member(ScannedMember *scanned_member, + void *member, + ProtobufCMessage *message) +{ + const ProtobufCFieldDescriptor *field = scanned_member->field; + size_t *p_n = STRUCT_MEMBER_PTR(size_t, message, field->quantifier_offset); + size_t siz = sizeof_elt_in_repeated_array(field->type); + void *array = *(char **) member + siz * (*p_n); + const uint8_t *at = scanned_member->data + scanned_member->length_prefix_len; + size_t rem = scanned_member->len - scanned_member->length_prefix_len; + size_t count = 0; +#if defined(WORDS_BIGENDIAN) + unsigned i; +#endif + + switch (field->type) { + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + count = (scanned_member->len - scanned_member->length_prefix_len) / 4; +#if !defined(WORDS_BIGENDIAN) + goto no_unpacking_needed; +#else + for (i = 0; i < count; i++) { + ((uint32_t *) array)[i] = parse_fixed_uint32(at); + at += 4; + } + break; +#endif + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + count = (scanned_member->len - scanned_member->length_prefix_len) / 8; +#if !defined(WORDS_BIGENDIAN) + goto no_unpacking_needed; +#else + for (i = 0; i < count; i++) { + ((uint64_t *) array)[i] = parse_fixed_uint64(at); + at += 8; + } + break; +#endif + case PROTOBUF_C_TYPE_ENUM: + case PROTOBUF_C_TYPE_INT32: + while (rem > 0) { + unsigned s = scan_varint(rem, at); + if (s == 0) { + PROTOBUF_C_UNPACK_ERROR("bad packed-repeated int32 value"); + return FALSE; + } + ((int32_t *) array)[count++] = parse_int32(s, at); + at += s; + rem -= s; + } + break; + case PROTOBUF_C_TYPE_SINT32: + while (rem > 0) { + unsigned s = scan_varint(rem, at); + if (s == 0) { + PROTOBUF_C_UNPACK_ERROR("bad packed-repeated sint32 value"); + return FALSE; + } + ((int32_t *) array)[count++] = unzigzag32(parse_uint32(s, at)); + at += s; + rem -= s; + } + break; + case PROTOBUF_C_TYPE_UINT32: + while (rem > 0) { + unsigned s = scan_varint(rem, at); + if (s == 0) { + PROTOBUF_C_UNPACK_ERROR("bad packed-repeated enum or uint32 value"); + return FALSE; + } + ((uint32_t *) array)[count++] = parse_uint32(s, at); + at += s; + rem -= s; + } + break; + + case PROTOBUF_C_TYPE_SINT64: + while (rem > 0) { + unsigned s = scan_varint(rem, at); + if (s == 0) { + PROTOBUF_C_UNPACK_ERROR("bad packed-repeated sint64 value"); + return FALSE; + } + ((int64_t *) array)[count++] = unzigzag64(parse_uint64(s, at)); + at += s; + rem -= s; + } + break; + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_UINT64: + while (rem > 0) { + unsigned s = scan_varint(rem, at); + if (s == 0) { + PROTOBUF_C_UNPACK_ERROR("bad packed-repeated int64/uint64 value"); + return FALSE; + } + ((int64_t *) array)[count++] = parse_uint64(s, at); + at += s; + rem -= s; + } + break; + case PROTOBUF_C_TYPE_BOOL: + while (rem > 0) { + unsigned s = scan_varint(rem, at); + if (s == 0) { + PROTOBUF_C_UNPACK_ERROR("bad packed-repeated boolean value"); + return FALSE; + } + ((protobuf_c_boolean *) array)[count++] = parse_boolean(s, at); + at += s; + rem -= s; + } + break; + default: + PROTOBUF_C__ASSERT_NOT_REACHED(); + } + *p_n += count; + return TRUE; + +#if !defined(WORDS_BIGENDIAN) +no_unpacking_needed: + memcpy(array, at, count * siz); + *p_n += count; + return TRUE; +#endif +} + +static protobuf_c_boolean +is_packable_type(ProtobufCType type) +{ + return + type != PROTOBUF_C_TYPE_STRING && + type != PROTOBUF_C_TYPE_BYTES && + type != PROTOBUF_C_TYPE_MESSAGE; +} + +static protobuf_c_boolean +parse_member(ScannedMember *scanned_member, + ProtobufCMessage *message, + ProtobufCAllocator *allocator) +{ + const ProtobufCFieldDescriptor *field = scanned_member->field; + void *member; + + if (field == NULL) { + ProtobufCMessageUnknownField *ufield = + message->unknown_fields + + (message->n_unknown_fields++); + ufield->tag = scanned_member->tag; + ufield->wire_type = scanned_member->wire_type; + ufield->len = scanned_member->len; + ufield->data = do_alloc(allocator, scanned_member->len); + if (ufield->data == NULL) + return FALSE; + memcpy(ufield->data, scanned_member->data, ufield->len); + return TRUE; + } + member = (char *) message + field->offset; + switch (field->label) { + case PROTOBUF_C_LABEL_REQUIRED: + return parse_required_member(scanned_member, member, + allocator, TRUE); + case PROTOBUF_C_LABEL_OPTIONAL: + case PROTOBUF_C_LABEL_NONE: + if (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_ONEOF)) { + return parse_oneof_member(scanned_member, member, + message, allocator); + } else { + return parse_optional_member(scanned_member, member, + message, allocator); + } + case PROTOBUF_C_LABEL_REPEATED: + if (scanned_member->wire_type == + PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED && + (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_PACKED) || + is_packable_type(field->type))) + { + return parse_packed_repeated_member(scanned_member, + member, message); + } else { + return parse_repeated_member(scanned_member, + member, message, + allocator); + } + } + PROTOBUF_C__ASSERT_NOT_REACHED(); + return 0; +} + +/** + * Initialise messages generated by old code. + * + * This function is used if desc->message_init == NULL (which occurs + * for old code, and which would be useful to support allocating + * descriptors dynamically). + */ +static void +message_init_generic(const ProtobufCMessageDescriptor *desc, + ProtobufCMessage *message) +{ + unsigned i; + + memset(message, 0, desc->sizeof_message); + message->descriptor = desc; + for (i = 0; i < desc->n_fields; i++) { + if (desc->fields[i].default_value != NULL && + desc->fields[i].label != PROTOBUF_C_LABEL_REPEATED) + { + void *field = + STRUCT_MEMBER_P(message, desc->fields[i].offset); + const void *dv = desc->fields[i].default_value; + + switch (desc->fields[i].type) { + case PROTOBUF_C_TYPE_INT32: + case PROTOBUF_C_TYPE_SINT32: + case PROTOBUF_C_TYPE_SFIXED32: + case PROTOBUF_C_TYPE_UINT32: + case PROTOBUF_C_TYPE_FIXED32: + case PROTOBUF_C_TYPE_FLOAT: + case PROTOBUF_C_TYPE_ENUM: + memcpy(field, dv, 4); + break; + case PROTOBUF_C_TYPE_INT64: + case PROTOBUF_C_TYPE_SINT64: + case PROTOBUF_C_TYPE_SFIXED64: + case PROTOBUF_C_TYPE_UINT64: + case PROTOBUF_C_TYPE_FIXED64: + case PROTOBUF_C_TYPE_DOUBLE: + memcpy(field, dv, 8); + break; + case PROTOBUF_C_TYPE_BOOL: + memcpy(field, dv, sizeof(protobuf_c_boolean)); + break; + case PROTOBUF_C_TYPE_BYTES: + memcpy(field, dv, sizeof(ProtobufCBinaryData)); + break; + + case PROTOBUF_C_TYPE_STRING: + case PROTOBUF_C_TYPE_MESSAGE: + /* + * The next line essentially implements a cast + * from const, which is totally unavoidable. + */ + *(const void **) field = dv; + break; + } + } + } +} + +/**@}*/ + +/* + * ScannedMember slabs (an unpacking implementation detail). Before doing real + * unpacking, we first scan through the elements to see how many there are (for + * repeated fields), and which field to use (for non-repeated fields given + * twice). + * + * In order to avoid allocations for small messages, we keep a stack-allocated + * slab of ScannedMembers of size FIRST_SCANNED_MEMBER_SLAB_SIZE (16). After we + * fill that up, we allocate each slab twice as large as the previous one. + */ +#define FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2 4 + +/* + * The number of slabs, including the stack-allocated ones; choose the number so + * that we would overflow if we needed a slab larger than provided. + */ +#define MAX_SCANNED_MEMBER_SLAB \ + (sizeof(unsigned int)*8 - 1 \ + - BOUND_SIZEOF_SCANNED_MEMBER_LOG2 \ + - FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2) + +#define REQUIRED_FIELD_BITMAP_SET(index) \ + (required_fields_bitmap[(index)/8] |= (1UL<<((index)%8))) + +#define REQUIRED_FIELD_BITMAP_IS_SET(index) \ + (required_fields_bitmap[(index)/8] & (1UL<<((index)%8))) + +ProtobufCMessage * +protobuf_c_message_unpack(const ProtobufCMessageDescriptor *desc, + ProtobufCAllocator *allocator, + size_t len, const uint8_t *data) +{ + ProtobufCMessage *rv; + size_t rem = len; + const uint8_t *at = data; + const ProtobufCFieldDescriptor *last_field = desc->fields + 0; + ScannedMember first_member_slab[1UL << + FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2]; + + /* + * scanned_member_slabs[i] is an array of arrays of ScannedMember. + * The first slab (scanned_member_slabs[0] is just a pointer to + * first_member_slab), above. All subsequent slabs will be allocated + * using the allocator. + */ + ScannedMember *scanned_member_slabs[MAX_SCANNED_MEMBER_SLAB + 1]; + unsigned which_slab = 0; /* the slab we are currently populating */ + unsigned in_slab_index = 0; /* number of members in the slab */ + size_t n_unknown = 0; + unsigned f; + unsigned j; + unsigned i_slab; + unsigned last_field_index = 0; + unsigned required_fields_bitmap_len; + unsigned char required_fields_bitmap_stack[16]; + unsigned char *required_fields_bitmap = required_fields_bitmap_stack; + protobuf_c_boolean required_fields_bitmap_alloced = FALSE; + + ASSERT_IS_MESSAGE_DESCRIPTOR(desc); + + if (allocator == NULL) + allocator = &protobuf_c__allocator; + + rv = do_alloc(allocator, desc->sizeof_message); + if (!rv) + return (NULL); + scanned_member_slabs[0] = first_member_slab; + + required_fields_bitmap_len = (desc->n_fields + 7) / 8; + if (required_fields_bitmap_len > sizeof(required_fields_bitmap_stack)) { + required_fields_bitmap = do_alloc(allocator, required_fields_bitmap_len); + if (!required_fields_bitmap) { + do_free(allocator, rv); + return (NULL); + } + required_fields_bitmap_alloced = TRUE; + } + memset(required_fields_bitmap, 0, required_fields_bitmap_len); + + /* + * Generated code always defines "message_init". However, we provide a + * fallback for (1) users of old protobuf-c generated-code that do not + * provide the function, and (2) descriptors constructed from some other + * source (most likely, direct construction from the .proto file). + */ + if (desc->message_init != NULL) + protobuf_c_message_init(desc, rv); + else + message_init_generic(desc, rv); + + while (rem > 0) { + uint32_t tag; + uint8_t wire_type; + size_t used = parse_tag_and_wiretype(rem, at, &tag, &wire_type); + const ProtobufCFieldDescriptor *field; + ScannedMember tmp; + + if (used == 0) { + PROTOBUF_C_UNPACK_ERROR("error parsing tag/wiretype at offset %u", + (unsigned) (at - data)); + goto error_cleanup_during_scan; + } + /* + * \todo Consider optimizing for field[1].id == tag, if field[1] + * exists! + */ + if (last_field == NULL || last_field->id != tag) { + /* lookup field */ + int field_index = + int_range_lookup(desc->n_field_ranges, + desc->field_ranges, + tag); + if (field_index < 0) { + field = NULL; + n_unknown++; + } else { + field = desc->fields + field_index; + last_field = field; + last_field_index = field_index; + } + } else { + field = last_field; + } + + if (field != NULL && field->label == PROTOBUF_C_LABEL_REQUIRED) + REQUIRED_FIELD_BITMAP_SET(last_field_index); + + at += used; + rem -= used; + tmp.tag = tag; + tmp.wire_type = wire_type; + tmp.field = field; + tmp.data = at; + tmp.length_prefix_len = 0; + + switch (wire_type) { + case PROTOBUF_C_WIRE_TYPE_VARINT: { + unsigned max_len = rem < 10 ? rem : 10; + unsigned i; + + for (i = 0; i < max_len; i++) + if ((at[i] & 0x80) == 0) + break; + if (i == max_len) { + PROTOBUF_C_UNPACK_ERROR("unterminated varint at offset %u", + (unsigned) (at - data)); + goto error_cleanup_during_scan; + } + tmp.len = i + 1; + break; + } + case PROTOBUF_C_WIRE_TYPE_64BIT: + if (rem < 8) { + PROTOBUF_C_UNPACK_ERROR("too short after 64bit wiretype at offset %u", + (unsigned) (at - data)); + goto error_cleanup_during_scan; + } + tmp.len = 8; + break; + case PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED: { + size_t pref_len; + + tmp.len = scan_length_prefixed_data(rem, at, &pref_len); + if (tmp.len == 0) { + /* NOTE: scan_length_prefixed_data calls UNPACK_ERROR */ + goto error_cleanup_during_scan; + } + tmp.length_prefix_len = pref_len; + break; + } + case PROTOBUF_C_WIRE_TYPE_32BIT: + if (rem < 4) { + PROTOBUF_C_UNPACK_ERROR("too short after 32bit wiretype at offset %u", + (unsigned) (at - data)); + goto error_cleanup_during_scan; + } + tmp.len = 4; + break; + default: + PROTOBUF_C_UNPACK_ERROR("unsupported tag %u at offset %u", + wire_type, (unsigned) (at - data)); + goto error_cleanup_during_scan; + } + + if (in_slab_index == (1UL << + (which_slab + FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2))) + { + size_t size; + + in_slab_index = 0; + if (which_slab == MAX_SCANNED_MEMBER_SLAB) { + PROTOBUF_C_UNPACK_ERROR("too many fields"); + goto error_cleanup_during_scan; + } + which_slab++; + size = sizeof(ScannedMember) + << (which_slab + FIRST_SCANNED_MEMBER_SLAB_SIZE_LOG2); + scanned_member_slabs[which_slab] = do_alloc(allocator, size); + if (scanned_member_slabs[which_slab] == NULL) + goto error_cleanup_during_scan; + } + scanned_member_slabs[which_slab][in_slab_index++] = tmp; + + if (field != NULL && field->label == PROTOBUF_C_LABEL_REPEATED) { + size_t *n = STRUCT_MEMBER_PTR(size_t, rv, + field->quantifier_offset); + if (wire_type == PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED && + (0 != (field->flags & PROTOBUF_C_FIELD_FLAG_PACKED) || + is_packable_type(field->type))) + { + size_t count; + if (!count_packed_elements(field->type, + tmp.len - + tmp.length_prefix_len, + tmp.data + + tmp.length_prefix_len, + &count)) + { + PROTOBUF_C_UNPACK_ERROR("counting packed elements"); + goto error_cleanup_during_scan; + } + *n += count; + } else { + *n += 1; + } + } + + at += tmp.len; + rem -= tmp.len; + } + + /* allocate space for repeated fields, also check that all required fields have been set */ + for (f = 0; f < desc->n_fields; f++) { + const ProtobufCFieldDescriptor *field = desc->fields + f; + if (field == NULL) { + continue; + } + if (field->label == PROTOBUF_C_LABEL_REPEATED) { + size_t siz = + sizeof_elt_in_repeated_array(field->type); + size_t *n_ptr = + STRUCT_MEMBER_PTR(size_t, rv, + field->quantifier_offset); + if (*n_ptr != 0) { + unsigned n = *n_ptr; + void *a; + *n_ptr = 0; + assert(rv->descriptor != NULL); +#define CLEAR_REMAINING_N_PTRS() \ + for(f++;f < desc->n_fields; f++) \ + { \ + field = desc->fields + f; \ + if (field->label == PROTOBUF_C_LABEL_REPEATED) \ + STRUCT_MEMBER (size_t, rv, field->quantifier_offset) = 0; \ + } + a = do_alloc(allocator, siz * n); + if (!a) { + CLEAR_REMAINING_N_PTRS(); + goto error_cleanup; + } + STRUCT_MEMBER(void *, rv, field->offset) = a; + } + } else if (field->label == PROTOBUF_C_LABEL_REQUIRED) { + if (field->default_value == NULL && + !REQUIRED_FIELD_BITMAP_IS_SET(f)) + { + CLEAR_REMAINING_N_PTRS(); + PROTOBUF_C_UNPACK_ERROR("message '%s': missing required field '%s'", + desc->name, field->name); + goto error_cleanup; + } + } + } +#undef CLEAR_REMAINING_N_PTRS + + /* allocate space for unknown fields */ + if (n_unknown) { + rv->unknown_fields = do_alloc(allocator, + n_unknown * sizeof(ProtobufCMessageUnknownField)); + if (rv->unknown_fields == NULL) + goto error_cleanup; + } + + /* do real parsing */ + for (i_slab = 0; i_slab <= which_slab; i_slab++) { + unsigned max = (i_slab == which_slab) ? + in_slab_index : (1UL << (i_slab + 4)); + ScannedMember *slab = scanned_member_slabs[i_slab]; + + for (j = 0; j < max; j++) { + if (!parse_member(slab + j, rv, allocator)) { + PROTOBUF_C_UNPACK_ERROR("error parsing member %s of %s", + slab->field ? slab->field->name : "*unknown-field*", + desc->name); + goto error_cleanup; + } + } + } + + /* cleanup */ + for (j = 1; j <= which_slab; j++) + do_free(allocator, scanned_member_slabs[j]); + if (required_fields_bitmap_alloced) + do_free(allocator, required_fields_bitmap); + return rv; + +error_cleanup: + protobuf_c_message_free_unpacked(rv, allocator); + for (j = 1; j <= which_slab; j++) + do_free(allocator, scanned_member_slabs[j]); + if (required_fields_bitmap_alloced) + do_free(allocator, required_fields_bitmap); + return NULL; + +error_cleanup_during_scan: + do_free(allocator, rv); + for (j = 1; j <= which_slab; j++) + do_free(allocator, scanned_member_slabs[j]); + if (required_fields_bitmap_alloced) + do_free(allocator, required_fields_bitmap); + return NULL; +} + +void +protobuf_c_message_free_unpacked(ProtobufCMessage *message, + ProtobufCAllocator *allocator) +{ + const ProtobufCMessageDescriptor *desc; + unsigned f; + + if (message == NULL) + return; + + desc = message->descriptor; + + ASSERT_IS_MESSAGE(message); + + if (allocator == NULL) + allocator = &protobuf_c__allocator; + message->descriptor = NULL; + for (f = 0; f < desc->n_fields; f++) { + if (0 != (desc->fields[f].flags & PROTOBUF_C_FIELD_FLAG_ONEOF) && + desc->fields[f].id != + STRUCT_MEMBER(uint32_t, message, desc->fields[f].quantifier_offset)) + { + /* This is not the selected oneof, skip it */ + continue; + } + + if (desc->fields[f].label == PROTOBUF_C_LABEL_REPEATED) { + size_t n = STRUCT_MEMBER(size_t, + message, + desc->fields[f].quantifier_offset); + void *arr = STRUCT_MEMBER(void *, + message, + desc->fields[f].offset); + + if (arr != NULL) { + if (desc->fields[f].type == PROTOBUF_C_TYPE_STRING) { + unsigned i; + for (i = 0; i < n; i++) + do_free(allocator, ((char **) arr)[i]); + } else if (desc->fields[f].type == PROTOBUF_C_TYPE_BYTES) { + unsigned i; + for (i = 0; i < n; i++) + do_free(allocator, ((ProtobufCBinaryData *) arr)[i].data); + } else if (desc->fields[f].type == PROTOBUF_C_TYPE_MESSAGE) { + unsigned i; + for (i = 0; i < n; i++) + protobuf_c_message_free_unpacked( + ((ProtobufCMessage **) arr)[i], + allocator + ); + } + do_free(allocator, arr); + } + } else if (desc->fields[f].type == PROTOBUF_C_TYPE_STRING) { + char *str = STRUCT_MEMBER(char *, message, + desc->fields[f].offset); + + if (str && str != desc->fields[f].default_value) + do_free(allocator, str); + } else if (desc->fields[f].type == PROTOBUF_C_TYPE_BYTES) { + void *data = STRUCT_MEMBER(ProtobufCBinaryData, message, + desc->fields[f].offset).data; + const ProtobufCBinaryData *default_bd; + + default_bd = desc->fields[f].default_value; + if (data != NULL && + (default_bd == NULL || + default_bd->data != data)) + { + do_free(allocator, data); + } + } else if (desc->fields[f].type == PROTOBUF_C_TYPE_MESSAGE) { + ProtobufCMessage *sm; + + sm = STRUCT_MEMBER(ProtobufCMessage *, message, + desc->fields[f].offset); + if (sm && sm != desc->fields[f].default_value) + protobuf_c_message_free_unpacked(sm, allocator); + } + } + + for (f = 0; f < message->n_unknown_fields; f++) + do_free(allocator, message->unknown_fields[f].data); + if (message->unknown_fields != NULL) + do_free(allocator, message->unknown_fields); + + do_free(allocator, message); +} + +void +protobuf_c_message_init(const ProtobufCMessageDescriptor * descriptor, + void *message) +{ + descriptor->message_init((ProtobufCMessage *) (message)); +} + +protobuf_c_boolean +protobuf_c_message_check(const ProtobufCMessage *message) +{ + unsigned i; + + if (!message || + !message->descriptor || + message->descriptor->magic != PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC) + { + return FALSE; + } + + for (i = 0; i < message->descriptor->n_fields; i++) { + const ProtobufCFieldDescriptor *f = message->descriptor->fields + i; + ProtobufCType type = f->type; + ProtobufCLabel label = f->label; + void *field = STRUCT_MEMBER_P (message, f->offset); + + if (f->flags & PROTOBUF_C_FIELD_FLAG_ONEOF) { + const uint32_t *oneof_case = STRUCT_MEMBER_P (message, f->quantifier_offset); + if (f->id != *oneof_case) { + continue; //Do not check if it is an unpopulated oneof member. + } + } + + if (label == PROTOBUF_C_LABEL_REPEATED) { + size_t *quantity = STRUCT_MEMBER_P (message, f->quantifier_offset); + + if (*quantity > 0 && *(void **) field == NULL) { + return FALSE; + } + + if (type == PROTOBUF_C_TYPE_MESSAGE) { + ProtobufCMessage **submessage = *(ProtobufCMessage ***) field; + unsigned j; + for (j = 0; j < *quantity; j++) { + if (!protobuf_c_message_check(submessage[j])) + return FALSE; + } + } else if (type == PROTOBUF_C_TYPE_STRING) { + char **string = *(char ***) field; + unsigned j; + for (j = 0; j < *quantity; j++) { + if (!string[j]) + return FALSE; + } + } else if (type == PROTOBUF_C_TYPE_BYTES) { + ProtobufCBinaryData *bd = *(ProtobufCBinaryData **) field; + unsigned j; + for (j = 0; j < *quantity; j++) { + if (bd[j].len > 0 && bd[j].data == NULL) + return FALSE; + } + } + + } else { /* PROTOBUF_C_LABEL_REQUIRED or PROTOBUF_C_LABEL_OPTIONAL */ + + if (type == PROTOBUF_C_TYPE_MESSAGE) { + ProtobufCMessage *submessage = *(ProtobufCMessage **) field; + if (label == PROTOBUF_C_LABEL_REQUIRED || submessage != NULL) { + if (!protobuf_c_message_check(submessage)) + return FALSE; + } + } else if (type == PROTOBUF_C_TYPE_STRING) { + char *string = *(char **) field; + if (label == PROTOBUF_C_LABEL_REQUIRED && string == NULL) + return FALSE; + } else if (type == PROTOBUF_C_TYPE_BYTES) { + protobuf_c_boolean *has = STRUCT_MEMBER_P (message, f->quantifier_offset); + ProtobufCBinaryData *bd = field; + if (label == PROTOBUF_C_LABEL_REQUIRED || *has == TRUE) { + if (bd->len > 0 && bd->data == NULL) + return FALSE; + } + } + } + } + + return TRUE; +} + +/* === services === */ + +typedef void (*GenericHandler) (void *service, + const ProtobufCMessage *input, + ProtobufCClosure closure, + void *closure_data); +void +protobuf_c_service_invoke_internal(ProtobufCService *service, + unsigned method_index, + const ProtobufCMessage *input, + ProtobufCClosure closure, + void *closure_data) +{ + GenericHandler *handlers; + GenericHandler handler; + + /* + * Verify that method_index is within range. If this fails, you are + * likely invoking a newly added method on an old service. (Although + * other memory corruption bugs can cause this assertion too.) + */ + assert(method_index < service->descriptor->n_methods); + + /* + * Get the array of virtual methods (which are enumerated by the + * generated code). + */ + handlers = (GenericHandler *) (service + 1); + + /* + * Get our method and invoke it. + * \todo Seems like handler == NULL is a situation that needs handling. + */ + handler = handlers[method_index]; + (*handler)(service, input, closure, closure_data); +} + +void +protobuf_c_service_generated_init(ProtobufCService *service, + const ProtobufCServiceDescriptor *descriptor, + ProtobufCServiceDestroy destroy) +{ + ASSERT_IS_SERVICE_DESCRIPTOR(descriptor); + service->descriptor = descriptor; + service->destroy = destroy; + service->invoke = protobuf_c_service_invoke_internal; + memset(service + 1, 0, descriptor->n_methods * sizeof(GenericHandler)); +} + +void protobuf_c_service_destroy(ProtobufCService *service) +{ + service->destroy(service); +} + +/* --- querying the descriptors --- */ + +const ProtobufCEnumValue * +protobuf_c_enum_descriptor_get_value_by_name(const ProtobufCEnumDescriptor *desc, + const char *name) +{ + unsigned start = 0; + unsigned count; + + if (desc == NULL || desc->values_by_name == NULL) + return NULL; + + count = desc->n_value_names; + + while (count > 1) { + unsigned mid = start + count / 2; + int rv = strcmp(desc->values_by_name[mid].name, name); + if (rv == 0) + return desc->values + desc->values_by_name[mid].index; + else if (rv < 0) { + count = start + count - (mid + 1); + start = mid + 1; + } else + count = mid - start; + } + if (count == 0) + return NULL; + if (strcmp(desc->values_by_name[start].name, name) == 0) + return desc->values + desc->values_by_name[start].index; + return NULL; +} + +const ProtobufCEnumValue * +protobuf_c_enum_descriptor_get_value(const ProtobufCEnumDescriptor *desc, + int value) +{ + int rv = int_range_lookup(desc->n_value_ranges, desc->value_ranges, value); + if (rv < 0) + return NULL; + return desc->values + rv; +} + +const ProtobufCFieldDescriptor * +protobuf_c_message_descriptor_get_field_by_name(const ProtobufCMessageDescriptor *desc, + const char *name) +{ + unsigned start = 0; + unsigned count; + const ProtobufCFieldDescriptor *field; + + if (desc == NULL || desc->fields_sorted_by_name == NULL) + return NULL; + + count = desc->n_fields; + + while (count > 1) { + unsigned mid = start + count / 2; + int rv; + field = desc->fields + desc->fields_sorted_by_name[mid]; + rv = strcmp(field->name, name); + if (rv == 0) + return field; + else if (rv < 0) { + count = start + count - (mid + 1); + start = mid + 1; + } else + count = mid - start; + } + if (count == 0) + return NULL; + field = desc->fields + desc->fields_sorted_by_name[start]; + if (strcmp(field->name, name) == 0) + return field; + return NULL; +} + +const ProtobufCFieldDescriptor * +protobuf_c_message_descriptor_get_field(const ProtobufCMessageDescriptor *desc, + unsigned value) +{ + int rv = int_range_lookup(desc->n_field_ranges,desc->field_ranges, value); + if (rv < 0) + return NULL; + return desc->fields + rv; +} + +const ProtobufCMethodDescriptor * +protobuf_c_service_descriptor_get_method_by_name(const ProtobufCServiceDescriptor *desc, + const char *name) +{ + unsigned start = 0; + unsigned count; + + if (desc == NULL || desc->method_indices_by_name == NULL) + return NULL; + + count = desc->n_methods; + + while (count > 1) { + unsigned mid = start + count / 2; + unsigned mid_index = desc->method_indices_by_name[mid]; + const char *mid_name = desc->methods[mid_index].name; + int rv = strcmp(mid_name, name); + + if (rv == 0) + return desc->methods + desc->method_indices_by_name[mid]; + if (rv < 0) { + count = start + count - (mid + 1); + start = mid + 1; + } else { + count = mid - start; + } + } + if (count == 0) + return NULL; + if (strcmp(desc->methods[desc->method_indices_by_name[start]].name, name) == 0) + return desc->methods + desc->method_indices_by_name[start]; + return NULL; +} diff --git a/fluent-bit/lib/fluent-otel-proto/proto_c/protobuf-c/protobuf-c.h b/fluent-bit/lib/fluent-otel-proto/proto_c/protobuf-c/protobuf-c.h new file mode 100755 index 000000000..5fa52da62 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/proto_c/protobuf-c/protobuf-c.h @@ -0,0 +1,1110 @@ +/* + * Copyright (c) 2008-2022, Dave Benson and the protobuf-c authors. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/*! \file + * \mainpage Introduction + * + * This is [protobuf-c], a C implementation of [Protocol Buffers]. + * + * This file defines the public API for the `libprotobuf-c` support library. + * This API includes interfaces that can be used directly by client code as well + * as the interfaces used by the code generated by the `protoc-c` compiler. + * + * The `libprotobuf-c` support library performs the actual serialization and + * deserialization of Protocol Buffers messages. It interacts with structures, + * definitions, and metadata generated by the `protoc-c` compiler from .proto + * files. + * + * \authors Dave Benson and the `protobuf-c` authors. + * + * \copyright 2008-2014. Licensed under the terms of the [BSD-2-Clause] license. + * + * [protobuf-c]: https://github.com/protobuf-c/protobuf-c + * [Protocol Buffers]: https://developers.google.com/protocol-buffers/ + * [BSD-2-Clause]: http://opensource.org/licenses/BSD-2-Clause + * + * \page gencode Generated Code + * + * For each enum, we generate a C enum. For each message, we generate a C + * structure which can be cast to a `ProtobufCMessage`. + * + * For each enum and message, we generate a descriptor object that allows us to + * implement a kind of reflection on the structures. + * + * First, some naming conventions: + * + * - The name of the type for enums and messages and services is camel case + * (meaning WordsAreCrammedTogether) except that double underscores are used + * to delimit scopes. For example, the following `.proto` file: + * +~~~{.proto} + package foo.bar; + message BazBah { + optional int32 val = 1; + } +~~~ + * + * would generate a C type `Foo__Bar__BazBah`. + * + * - Identifiers for functions and globals are all lowercase, with camel case + * words separated by single underscores. For example, one of the function + * prototypes generated by `protoc-c` for the above example: + * +~~~{.c} +Foo__Bar__BazBah * + foo__bar__baz_bah__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +~~~ + * + * - Identifiers for enum values contain an uppercase prefix which embeds the + * package name and the enum type name. + * + * - A double underscore is used to separate further components of identifier + * names. + * + * For example, in the name of the unpack function above, the package name + * `foo.bar` has become `foo__bar`, the message name BazBah has become + * `baz_bah`, and the method name is `unpack`. These are all joined with double + * underscores to form the C identifier `foo__bar__baz_bah__unpack`. + * + * We also generate descriptor objects for messages and enums. These are + * declared in the `.pb-c.h` files: + * +~~~{.c} +extern const ProtobufCMessageDescriptor foo__bar__baz_bah__descriptor; +~~~ + * + * The message structures all begin with `ProtobufCMessageDescriptor *` which is + * sufficient to allow them to be cast to `ProtobufCMessage`. + * + * For each message defined in a `.proto` file, we generate a number of + * functions and macros. Each function name contains a prefix based on the + * package name and message name in order to make it a unique C identifier. + * + * - `INIT`. Statically initializes a message object, initializing its + * descriptor and setting its fields to default values. Uninitialized + * messages cannot be processed by the protobuf-c library. + * +~~~{.c} +#define FOO__BAR__BAZ_BAH__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&foo__bar__baz_bah__descriptor), 0 } +~~~ + * - `init()`. Initializes a message object, initializing its descriptor and + * setting its fields to default values. Uninitialized messages cannot be + * processed by the protobuf-c library. + * +~~~{.c} +void foo__bar__baz_bah__init + (Foo__Bar__BazBah *message); +~~~ + * - `unpack()`. Unpacks data for a particular message format. Note that the + * `allocator` parameter is usually `NULL` to indicate that the system's + * `malloc()` and `free()` functions should be used for dynamically allocating + * memory. + * +~~~{.c} +Foo__Bar__BazBah * + foo__bar__baz_bah__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +~~~ + * + * - `free_unpacked()`. Frees a message object obtained with the `unpack()` + * method. Freeing `NULL` is allowed (the same as with `free()`). + * +~~~{.c} +void foo__bar__baz_bah__free_unpacked + (Foo__Bar__BazBah *message, + ProtobufCAllocator *allocator); +~~~ + * + * - `get_packed_size()`. Calculates the length in bytes of the serialized + * representation of the message object. + * +~~~{.c} +size_t foo__bar__baz_bah__get_packed_size + (const Foo__Bar__BazBah *message); +~~~ + * + * - `pack()`. Pack a message object into a preallocated buffer. Assumes that + * the buffer is large enough. (Use `get_packed_size()` first.) + * +~~~{.c} +size_t foo__bar__baz_bah__pack + (const Foo__Bar__BazBah *message, + uint8_t *out); +~~~ + * + * - `pack_to_buffer()`. Packs a message into a "virtual buffer". This is an + * object which defines an "append bytes" callback to consume data as it is + * serialized. + * +~~~{.c} +size_t foo__bar__baz_bah__pack_to_buffer + (const Foo__Bar__BazBah *message, + ProtobufCBuffer *buffer); +~~~ + * + * \page pack Packing and unpacking messages + * + * To pack a message, first compute the packed size of the message with + * protobuf_c_message_get_packed_size(), then allocate a buffer of at least + * that size, then call protobuf_c_message_pack(). + * + * Alternatively, a message can be serialized without calculating the final size + * first. Use the protobuf_c_message_pack_to_buffer() function and provide a + * ProtobufCBuffer object which implements an "append" method that consumes + * data. + * + * To unpack a message, call the protobuf_c_message_unpack() function. The + * result can be cast to an object of the type that matches the descriptor for + * the message. + * + * The result of unpacking a message should be freed with + * protobuf_c_message_free_unpacked(). + */ + +#ifndef PROTOBUF_C_H +#define PROTOBUF_C_H + +#include <assert.h> +#include <limits.h> +#include <stddef.h> +#include <stdint.h> + +#ifdef __cplusplus +# define PROTOBUF_C__BEGIN_DECLS extern "C" { +# define PROTOBUF_C__END_DECLS } +#else +# define PROTOBUF_C__BEGIN_DECLS +# define PROTOBUF_C__END_DECLS +#endif + +PROTOBUF_C__BEGIN_DECLS + +#if defined(_WIN32) && defined(PROTOBUF_C_USE_SHARED_LIB) +# ifdef PROTOBUF_C_EXPORT +# define PROTOBUF_C__API __declspec(dllexport) +# else +# define PROTOBUF_C__API __declspec(dllimport) +# endif +#else +# define PROTOBUF_C__API +#endif + +#if !defined(PROTOBUF_C__NO_DEPRECATED) && \ + ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) +# define PROTOBUF_C__DEPRECATED __attribute__((__deprecated__)) +#else +# define PROTOBUF_C__DEPRECATED +#endif + +#ifndef PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE + #define PROTOBUF_C__FORCE_ENUM_TO_BE_INT_SIZE(enum_name) \ + , _##enum_name##_IS_INT_SIZE = INT_MAX +#endif + +#define PROTOBUF_C__SERVICE_DESCRIPTOR_MAGIC 0x14159bc3 +#define PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC 0x28aaeef9 +#define PROTOBUF_C__ENUM_DESCRIPTOR_MAGIC 0x114315af + +/* Empty string used for initializers */ +#if defined(_WIN32) && defined(PROTOBUF_C_USE_SHARED_LIB) +static const char protobuf_c_empty_string[] = ""; +#else +extern const char protobuf_c_empty_string[]; +#endif + +/** + * \defgroup api Public API + * + * This is the public API for `libprotobuf-c`. These interfaces are stable and + * subject to Semantic Versioning guarantees. + * + * @{ + */ + +/** + * Values for the `flags` word in `ProtobufCFieldDescriptor`. + */ +typedef enum { + /** Set if the field is repeated and marked with the `packed` option. */ + PROTOBUF_C_FIELD_FLAG_PACKED = (1 << 0), + + /** Set if the field is marked with the `deprecated` option. */ + PROTOBUF_C_FIELD_FLAG_DEPRECATED = (1 << 1), + + /** Set if the field is a member of a oneof (union). */ + PROTOBUF_C_FIELD_FLAG_ONEOF = (1 << 2), +} ProtobufCFieldFlag; + +/** + * Message field rules. + * + * \see [Defining A Message Type] in the Protocol Buffers documentation. + * + * [Defining A Message Type]: + * https://developers.google.com/protocol-buffers/docs/proto#simple + */ +typedef enum { + /** A well-formed message must have exactly one of this field. */ + PROTOBUF_C_LABEL_REQUIRED, + + /** + * A well-formed message can have zero or one of this field (but not + * more than one). + */ + PROTOBUF_C_LABEL_OPTIONAL, + + /** + * This field can be repeated any number of times (including zero) in a + * well-formed message. The order of the repeated values will be + * preserved. + */ + PROTOBUF_C_LABEL_REPEATED, + + /** + * This field has no label. This is valid only in proto3 and is + * equivalent to OPTIONAL but no "has" quantifier will be consulted. + */ + PROTOBUF_C_LABEL_NONE, +} ProtobufCLabel; + +/** + * Field value types. + * + * \see [Scalar Value Types] in the Protocol Buffers documentation. + * + * [Scalar Value Types]: + * https://developers.google.com/protocol-buffers/docs/proto#scalar + */ +typedef enum { + PROTOBUF_C_TYPE_INT32, /**< int32 */ + PROTOBUF_C_TYPE_SINT32, /**< signed int32 */ + PROTOBUF_C_TYPE_SFIXED32, /**< signed int32 (4 bytes) */ + PROTOBUF_C_TYPE_INT64, /**< int64 */ + PROTOBUF_C_TYPE_SINT64, /**< signed int64 */ + PROTOBUF_C_TYPE_SFIXED64, /**< signed int64 (8 bytes) */ + PROTOBUF_C_TYPE_UINT32, /**< unsigned int32 */ + PROTOBUF_C_TYPE_FIXED32, /**< unsigned int32 (4 bytes) */ + PROTOBUF_C_TYPE_UINT64, /**< unsigned int64 */ + PROTOBUF_C_TYPE_FIXED64, /**< unsigned int64 (8 bytes) */ + PROTOBUF_C_TYPE_FLOAT, /**< float */ + PROTOBUF_C_TYPE_DOUBLE, /**< double */ + PROTOBUF_C_TYPE_BOOL, /**< boolean */ + PROTOBUF_C_TYPE_ENUM, /**< enumerated type */ + PROTOBUF_C_TYPE_STRING, /**< UTF-8 or ASCII string */ + PROTOBUF_C_TYPE_BYTES, /**< arbitrary byte sequence */ + PROTOBUF_C_TYPE_MESSAGE, /**< nested message */ +} ProtobufCType; + +/** + * Field wire types. + * + * \see [Message Structure] in the Protocol Buffers documentation. + * + * [Message Structure]: + * https://developers.google.com/protocol-buffers/docs/encoding#structure + */ +typedef enum { + PROTOBUF_C_WIRE_TYPE_VARINT = 0, + PROTOBUF_C_WIRE_TYPE_64BIT = 1, + PROTOBUF_C_WIRE_TYPE_LENGTH_PREFIXED = 2, + /* "Start group" and "end group" wire types are unsupported. */ + PROTOBUF_C_WIRE_TYPE_32BIT = 5, +} ProtobufCWireType; + +struct ProtobufCAllocator; +struct ProtobufCBinaryData; +struct ProtobufCBuffer; +struct ProtobufCBufferSimple; +struct ProtobufCEnumDescriptor; +struct ProtobufCEnumValue; +struct ProtobufCEnumValueIndex; +struct ProtobufCFieldDescriptor; +struct ProtobufCIntRange; +struct ProtobufCMessage; +struct ProtobufCMessageDescriptor; +struct ProtobufCMessageUnknownField; +struct ProtobufCMethodDescriptor; +struct ProtobufCService; +struct ProtobufCServiceDescriptor; + +typedef struct ProtobufCAllocator ProtobufCAllocator; +typedef struct ProtobufCBinaryData ProtobufCBinaryData; +typedef struct ProtobufCBuffer ProtobufCBuffer; +typedef struct ProtobufCBufferSimple ProtobufCBufferSimple; +typedef struct ProtobufCEnumDescriptor ProtobufCEnumDescriptor; +typedef struct ProtobufCEnumValue ProtobufCEnumValue; +typedef struct ProtobufCEnumValueIndex ProtobufCEnumValueIndex; +typedef struct ProtobufCFieldDescriptor ProtobufCFieldDescriptor; +typedef struct ProtobufCIntRange ProtobufCIntRange; +typedef struct ProtobufCMessage ProtobufCMessage; +typedef struct ProtobufCMessageDescriptor ProtobufCMessageDescriptor; +typedef struct ProtobufCMessageUnknownField ProtobufCMessageUnknownField; +typedef struct ProtobufCMethodDescriptor ProtobufCMethodDescriptor; +typedef struct ProtobufCService ProtobufCService; +typedef struct ProtobufCServiceDescriptor ProtobufCServiceDescriptor; + +/** Boolean type. */ +typedef int protobuf_c_boolean; + +typedef void (*ProtobufCClosure)(const ProtobufCMessage *, void *closure_data); +typedef void (*ProtobufCMessageInit)(ProtobufCMessage *); +typedef void (*ProtobufCServiceDestroy)(ProtobufCService *); + +/** + * Structure for defining a custom memory allocator. + */ +struct ProtobufCAllocator { + /** Function to allocate memory. */ + void *(*alloc)(void *allocator_data, size_t size); + + /** Function to free memory. */ + void (*free)(void *allocator_data, void *pointer); + + /** Opaque pointer passed to `alloc` and `free` functions. */ + void *allocator_data; +}; + +/** + * Structure for the protobuf `bytes` scalar type. + * + * The data contained in a `ProtobufCBinaryData` is an arbitrary sequence of + * bytes. It may contain embedded `NUL` characters and is not required to be + * `NUL`-terminated. + */ +struct ProtobufCBinaryData { + size_t len; /**< Number of bytes in the `data` field. */ + uint8_t *data; /**< Data bytes. */ +}; + +/** + * Structure for defining a virtual append-only buffer. Used by + * protobuf_c_message_pack_to_buffer() to abstract the consumption of serialized + * bytes. + * + * `ProtobufCBuffer` "subclasses" may be defined on the stack. For example, to + * write to a `FILE` object: + * +~~~{.c} +typedef struct { + ProtobufCBuffer base; + FILE *fp; +} BufferAppendToFile; + +static void +my_buffer_file_append(ProtobufCBuffer *buffer, + size_t len, + const uint8_t *data) +{ + BufferAppendToFile *file_buf = (BufferAppendToFile *) buffer; + fwrite(data, len, 1, file_buf->fp); // XXX: No error handling! +} +~~~ + * + * To use this new type of ProtobufCBuffer, it could be called as follows: + * +~~~{.c} +... +BufferAppendToFile tmp = {0}; +tmp.base.append = my_buffer_file_append; +tmp.fp = fp; +protobuf_c_message_pack_to_buffer(&message, &tmp); +... +~~~ + */ +struct ProtobufCBuffer { + /** Append function. Consumes the `len` bytes stored at `data`. */ + void (*append)(ProtobufCBuffer *buffer, + size_t len, + const uint8_t *data); +}; + +/** + * Simple buffer "subclass" of `ProtobufCBuffer`. + * + * A `ProtobufCBufferSimple` object is declared on the stack and uses a + * scratch buffer provided by the user for the initial allocation. It performs + * exponential resizing, using dynamically allocated memory. A + * `ProtobufCBufferSimple` object can be created and used as follows: + * +~~~{.c} +uint8_t pad[128]; +ProtobufCBufferSimple simple = PROTOBUF_C_BUFFER_SIMPLE_INIT(pad); +ProtobufCBuffer *buffer = (ProtobufCBuffer *) &simple; +~~~ + * + * `buffer` can now be used with `protobuf_c_message_pack_to_buffer()`. Once a + * message has been serialized to a `ProtobufCBufferSimple` object, the + * serialized data bytes can be accessed from the `.data` field. + * + * To free the memory allocated by a `ProtobufCBufferSimple` object, if any, + * call PROTOBUF_C_BUFFER_SIMPLE_CLEAR() on the object, for example: + * +~~~{.c} +PROTOBUF_C_BUFFER_SIMPLE_CLEAR(&simple); +~~~ + * + * \see PROTOBUF_C_BUFFER_SIMPLE_INIT + * \see PROTOBUF_C_BUFFER_SIMPLE_CLEAR + */ +struct ProtobufCBufferSimple { + /** "Base class". */ + ProtobufCBuffer base; + /** Number of bytes allocated in `data`. */ + size_t alloced; + /** Number of bytes currently stored in `data`. */ + size_t len; + /** Data bytes. */ + uint8_t *data; + /** Whether `data` must be freed. */ + protobuf_c_boolean must_free_data; + /** Allocator to use. May be NULL to indicate the system allocator. */ + ProtobufCAllocator *allocator; +}; + +/** + * Describes an enumeration as a whole, with all of its values. + */ +struct ProtobufCEnumDescriptor { + /** Magic value checked to ensure that the API is used correctly. */ + uint32_t magic; + + /** The qualified name (e.g., "namespace.Type"). */ + const char *name; + /** The unqualified name as given in the .proto file (e.g., "Type"). */ + const char *short_name; + /** Identifier used in generated C code. */ + const char *c_name; + /** The dot-separated namespace. */ + const char *package_name; + + /** Number elements in `values`. */ + unsigned n_values; + /** Array of distinct values, sorted by numeric value. */ + const ProtobufCEnumValue *values; + + /** Number of elements in `values_by_name`. */ + unsigned n_value_names; + /** Array of named values, including aliases, sorted by name. */ + const ProtobufCEnumValueIndex *values_by_name; + + /** Number of elements in `value_ranges`. */ + unsigned n_value_ranges; + /** Value ranges, for faster lookups by numeric value. */ + const ProtobufCIntRange *value_ranges; + + /** Reserved for future use. */ + void *reserved1; + /** Reserved for future use. */ + void *reserved2; + /** Reserved for future use. */ + void *reserved3; + /** Reserved for future use. */ + void *reserved4; +}; + +/** + * Represents a single value of an enumeration. + */ +struct ProtobufCEnumValue { + /** The string identifying this value in the .proto file. */ + const char *name; + + /** The string identifying this value in generated C code. */ + const char *c_name; + + /** The numeric value assigned in the .proto file. */ + int value; +}; + +/** + * Used by `ProtobufCEnumDescriptor` to look up enum values. + */ +struct ProtobufCEnumValueIndex { + /** Name of the enum value. */ + const char *name; + /** Index into values[] array. */ + unsigned index; +}; + +/** + * Describes a single field in a message. + */ +struct ProtobufCFieldDescriptor { + /** Name of the field as given in the .proto file. */ + const char *name; + + /** Tag value of the field as given in the .proto file. */ + uint32_t id; + + /** Whether the field is `REQUIRED`, `OPTIONAL`, or `REPEATED`. */ + ProtobufCLabel label; + + /** The type of the field. */ + ProtobufCType type; + + /** + * The offset in bytes of the message's C structure's quantifier field + * (the `has_MEMBER` field for optional members or the `n_MEMBER` field + * for repeated members or the case enum for oneofs). + */ + unsigned quantifier_offset; + + /** + * The offset in bytes into the message's C structure for the member + * itself. + */ + unsigned offset; + + /** + * A type-specific descriptor. + * + * If `type` is `PROTOBUF_C_TYPE_ENUM`, then `descriptor` points to the + * corresponding `ProtobufCEnumDescriptor`. + * + * If `type` is `PROTOBUF_C_TYPE_MESSAGE`, then `descriptor` points to + * the corresponding `ProtobufCMessageDescriptor`. + * + * Otherwise this field is NULL. + */ + const void *descriptor; /* for MESSAGE and ENUM types */ + + /** The default value for this field, if defined. May be NULL. */ + const void *default_value; + + /** + * A flag word. Zero or more of the bits defined in the + * `ProtobufCFieldFlag` enum may be set. + */ + uint32_t flags; + + /** Reserved for future use. */ + unsigned reserved_flags; + /** Reserved for future use. */ + void *reserved2; + /** Reserved for future use. */ + void *reserved3; +}; + +/** + * Helper structure for optimizing int => index lookups in the case + * where the keys are mostly consecutive values, as they presumably are for + * enums and fields. + * + * The data structures requires that the values in the original array are + * sorted. + */ +struct ProtobufCIntRange { + int start_value; + unsigned orig_index; + /* + * NOTE: the number of values in the range can be inferred by looking + * at the next element's orig_index. A dummy element is added to make + * this simple. + */ +}; + +/** + * An instance of a message. + * + * `ProtobufCMessage` is a light-weight "base class" for all messages. + * + * In particular, `ProtobufCMessage` doesn't have any allocation policy + * associated with it. That's because it's common to create `ProtobufCMessage` + * objects on the stack. In fact, that's what we recommend for sending messages. + * If the object is allocated from the stack, you can't really have a memory + * leak. + * + * This means that calls to functions like protobuf_c_message_unpack() which + * return a `ProtobufCMessage` must be paired with a call to a free function, + * like protobuf_c_message_free_unpacked(). + */ +struct ProtobufCMessage { + /** The descriptor for this message type. */ + const ProtobufCMessageDescriptor *descriptor; + /** The number of elements in `unknown_fields`. */ + unsigned n_unknown_fields; + /** The fields that weren't recognized by the parser. */ + ProtobufCMessageUnknownField *unknown_fields; +}; + +/** + * Describes a message. + */ +struct ProtobufCMessageDescriptor { + /** Magic value checked to ensure that the API is used correctly. */ + uint32_t magic; + + /** The qualified name (e.g., "namespace.Type"). */ + const char *name; + /** The unqualified name as given in the .proto file (e.g., "Type"). */ + const char *short_name; + /** Identifier used in generated C code. */ + const char *c_name; + /** The dot-separated namespace. */ + const char *package_name; + + /** + * Size in bytes of the C structure representing an instance of this + * type of message. + */ + size_t sizeof_message; + + /** Number of elements in `fields`. */ + unsigned n_fields; + /** Field descriptors, sorted by tag number. */ + const ProtobufCFieldDescriptor *fields; + /** Used for looking up fields by name. */ + const unsigned *fields_sorted_by_name; + + /** Number of elements in `field_ranges`. */ + unsigned n_field_ranges; + /** Used for looking up fields by id. */ + const ProtobufCIntRange *field_ranges; + + /** Message initialisation function. */ + ProtobufCMessageInit message_init; + + /** Reserved for future use. */ + void *reserved1; + /** Reserved for future use. */ + void *reserved2; + /** Reserved for future use. */ + void *reserved3; +}; + +/** + * An unknown message field. + */ +struct ProtobufCMessageUnknownField { + /** The tag number. */ + uint32_t tag; + /** The wire type of the field. */ + ProtobufCWireType wire_type; + /** Number of bytes in `data`. */ + size_t len; + /** Field data. */ + uint8_t *data; +}; + +/** + * Method descriptor. + */ +struct ProtobufCMethodDescriptor { + /** Method name. */ + const char *name; + /** Input message descriptor. */ + const ProtobufCMessageDescriptor *input; + /** Output message descriptor. */ + const ProtobufCMessageDescriptor *output; +}; + +/** + * Service. + */ +struct ProtobufCService { + /** Service descriptor. */ + const ProtobufCServiceDescriptor *descriptor; + /** Function to invoke the service. */ + void (*invoke)(ProtobufCService *service, + unsigned method_index, + const ProtobufCMessage *input, + ProtobufCClosure closure, + void *closure_data); + /** Function to destroy the service. */ + void (*destroy)(ProtobufCService *service); +}; + +/** + * Service descriptor. + */ +struct ProtobufCServiceDescriptor { + /** Magic value checked to ensure that the API is used correctly. */ + uint32_t magic; + + /** Service name. */ + const char *name; + /** Short version of service name. */ + const char *short_name; + /** C identifier for the service name. */ + const char *c_name; + /** Package name. */ + const char *package; + /** Number of elements in `methods`. */ + unsigned n_methods; + /** Method descriptors, in the order defined in the .proto file. */ + const ProtobufCMethodDescriptor *methods; + /** Sort index of methods. */ + const unsigned *method_indices_by_name; +}; + +/** + * Get the version of the protobuf-c library. Note that this is the version of + * the library linked against, not the version of the headers compiled against. + * + * \return A string containing the version number of protobuf-c. + */ +PROTOBUF_C__API +const char * +protobuf_c_version(void); + +/** + * Get the version of the protobuf-c library. Note that this is the version of + * the library linked against, not the version of the headers compiled against. + * + * \return A 32 bit unsigned integer containing the version number of + * protobuf-c, represented in base-10 as (MAJOR*1E6) + (MINOR*1E3) + PATCH. + */ +PROTOBUF_C__API +uint32_t +protobuf_c_version_number(void); + +/** + * The version of the protobuf-c headers, represented as a string using the same + * format as protobuf_c_version(). + */ +#define PROTOBUF_C_VERSION "1.4.1" + +/** + * The version of the protobuf-c headers, represented as an integer using the + * same format as protobuf_c_version_number(). + */ +#define PROTOBUF_C_VERSION_NUMBER 1004001 + +/** + * The minimum protoc-c version which works with the current version of the + * protobuf-c headers. + */ +#define PROTOBUF_C_MIN_COMPILER_VERSION 1000000 + +/** + * Look up a `ProtobufCEnumValue` from a `ProtobufCEnumDescriptor` by name. + * + * \param desc + * The `ProtobufCEnumDescriptor` object. + * \param name + * The `name` field from the corresponding `ProtobufCEnumValue` object to + * match. + * \return + * A `ProtobufCEnumValue` object. + * \retval NULL + * If not found or if the optimize_for = CODE_SIZE option was set. + */ +PROTOBUF_C__API +const ProtobufCEnumValue * +protobuf_c_enum_descriptor_get_value_by_name( + const ProtobufCEnumDescriptor *desc, + const char *name); + +/** + * Look up a `ProtobufCEnumValue` from a `ProtobufCEnumDescriptor` by numeric + * value. + * + * \param desc + * The `ProtobufCEnumDescriptor` object. + * \param value + * The `value` field from the corresponding `ProtobufCEnumValue` object to + * match. + * + * \return + * A `ProtobufCEnumValue` object. + * \retval NULL + * If not found. + */ +PROTOBUF_C__API +const ProtobufCEnumValue * +protobuf_c_enum_descriptor_get_value( + const ProtobufCEnumDescriptor *desc, + int value); + +/** + * Look up a `ProtobufCFieldDescriptor` from a `ProtobufCMessageDescriptor` by + * the name of the field. + * + * \param desc + * The `ProtobufCMessageDescriptor` object. + * \param name + * The name of the field. + * \return + * A `ProtobufCFieldDescriptor` object. + * \retval NULL + * If not found or if the optimize_for = CODE_SIZE option was set. + */ +PROTOBUF_C__API +const ProtobufCFieldDescriptor * +protobuf_c_message_descriptor_get_field_by_name( + const ProtobufCMessageDescriptor *desc, + const char *name); + +/** + * Look up a `ProtobufCFieldDescriptor` from a `ProtobufCMessageDescriptor` by + * the tag value of the field. + * + * \param desc + * The `ProtobufCMessageDescriptor` object. + * \param value + * The tag value of the field. + * \return + * A `ProtobufCFieldDescriptor` object. + * \retval NULL + * If not found. + */ +PROTOBUF_C__API +const ProtobufCFieldDescriptor * +protobuf_c_message_descriptor_get_field( + const ProtobufCMessageDescriptor *desc, + unsigned value); + +/** + * Determine the number of bytes required to store the serialised message. + * + * \param message + * The message object to serialise. + * \return + * Number of bytes. + */ +PROTOBUF_C__API +size_t +protobuf_c_message_get_packed_size(const ProtobufCMessage *message); + +/** + * Serialise a message from its in-memory representation. + * + * This function stores the serialised bytes of the message in a pre-allocated + * buffer. + * + * \param message + * The message object to serialise. + * \param[out] out + * Buffer to store the bytes of the serialised message. This buffer must + * have enough space to store the packed message. Use + * protobuf_c_message_get_packed_size() to determine the number of bytes + * required. + * \return + * Number of bytes stored in `out`. + */ +PROTOBUF_C__API +size_t +protobuf_c_message_pack(const ProtobufCMessage *message, uint8_t *out); + +/** + * Serialise a message from its in-memory representation to a virtual buffer. + * + * This function calls the `append` method of a `ProtobufCBuffer` object to + * consume the bytes generated by the serialiser. + * + * \param message + * The message object to serialise. + * \param buffer + * The virtual buffer object. + * \return + * Number of bytes passed to the virtual buffer. + */ +PROTOBUF_C__API +size_t +protobuf_c_message_pack_to_buffer( + const ProtobufCMessage *message, + ProtobufCBuffer *buffer); + +/** + * Unpack a serialised message into an in-memory representation. + * + * \param descriptor + * The message descriptor. + * \param allocator + * `ProtobufCAllocator` to use for memory allocation. May be NULL to + * specify the default allocator. + * \param len + * Length in bytes of the serialised message. + * \param data + * Pointer to the serialised message. + * \return + * An unpacked message object. + * \retval NULL + * If an error occurred during unpacking. + */ +PROTOBUF_C__API +ProtobufCMessage * +protobuf_c_message_unpack( + const ProtobufCMessageDescriptor *descriptor, + ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); + +/** + * Free an unpacked message object. + * + * This function should be used to deallocate the memory used by a call to + * protobuf_c_message_unpack(). + * + * \param message + * The message object to free. May be NULL. + * \param allocator + * `ProtobufCAllocator` to use for memory deallocation. May be NULL to + * specify the default allocator. + */ +PROTOBUF_C__API +void +protobuf_c_message_free_unpacked( + ProtobufCMessage *message, + ProtobufCAllocator *allocator); + +/** + * Check the validity of a message object. + * + * Makes sure all required fields (`PROTOBUF_C_LABEL_REQUIRED`) are present. + * Recursively checks nested messages. + * + * \retval TRUE + * Message is valid. + * \retval FALSE + * Message is invalid. + */ +PROTOBUF_C__API +protobuf_c_boolean +protobuf_c_message_check(const ProtobufCMessage *); + +/** Message initialiser. */ +#define PROTOBUF_C_MESSAGE_INIT(descriptor) { descriptor, 0, NULL } + +/** + * Initialise a message object from a message descriptor. + * + * \param descriptor + * Message descriptor. + * \param message + * Allocated block of memory of size `descriptor->sizeof_message`. + */ +PROTOBUF_C__API +void +protobuf_c_message_init( + const ProtobufCMessageDescriptor *descriptor, + void *message); + +/** + * Free a service. + * + * \param service + * The service object to free. + */ +PROTOBUF_C__API +void +protobuf_c_service_destroy(ProtobufCService *service); + +/** + * Look up a `ProtobufCMethodDescriptor` by name. + * + * \param desc + * Service descriptor. + * \param name + * Name of the method. + * + * \return + * A `ProtobufCMethodDescriptor` object. + * \retval NULL + * If not found or if the optimize_for = CODE_SIZE option was set. + */ +PROTOBUF_C__API +const ProtobufCMethodDescriptor * +protobuf_c_service_descriptor_get_method_by_name( + const ProtobufCServiceDescriptor *desc, + const char *name); + +/** + * Initialise a `ProtobufCBufferSimple` object. + */ +#define PROTOBUF_C_BUFFER_SIMPLE_INIT(array_of_bytes) \ +{ \ + { protobuf_c_buffer_simple_append }, \ + sizeof(array_of_bytes), \ + 0, \ + (array_of_bytes), \ + 0, \ + NULL \ +} + +/** + * Clear a `ProtobufCBufferSimple` object, freeing any allocated memory. + */ +#define PROTOBUF_C_BUFFER_SIMPLE_CLEAR(simp_buf) \ +do { \ + if ((simp_buf)->must_free_data) { \ + if ((simp_buf)->allocator != NULL) \ + (simp_buf)->allocator->free( \ + (simp_buf)->allocator, \ + (simp_buf)->data); \ + else \ + free((simp_buf)->data); \ + } \ +} while (0) + +/** + * The `append` method for `ProtobufCBufferSimple`. + * + * \param buffer + * The buffer object to append to. Must actually be a + * `ProtobufCBufferSimple` object. + * \param len + * Number of bytes in `data`. + * \param data + * Data to append. + */ +PROTOBUF_C__API +void +protobuf_c_buffer_simple_append( + ProtobufCBuffer *buffer, + size_t len, + const unsigned char *data); + +PROTOBUF_C__API +void +protobuf_c_service_generated_init( + ProtobufCService *service, + const ProtobufCServiceDescriptor *descriptor, + ProtobufCServiceDestroy destroy); + +PROTOBUF_C__API +void +protobuf_c_service_invoke_internal( + ProtobufCService *service, + unsigned method_index, + const ProtobufCMessage *input, + ProtobufCClosure closure, + void *closure_data); + +/**@}*/ + +PROTOBUF_C__END_DECLS + +#endif /* PROTOBUF_C_H */ diff --git a/fluent-bit/lib/fluent-otel-proto/src/CMakeLists.txt b/fluent-bit/lib/fluent-otel-proto/src/CMakeLists.txt new file mode 100644 index 000000000..4b85b8347 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/src/CMakeLists.txt @@ -0,0 +1,37 @@ +set(OTEL_C_FILES ${PROJECT_SOURCE_DIR}/proto_c/opentelemetry) + +set(src + fluent-otel.c + ${PROJECT_SOURCE_DIR}/proto_c/protobuf-c/protobuf-c.c + ) + +include_directories( + ${PROJECT_SOURCE_DIR}/include + ${PROJECT_BINARY_DIR} + ${PROJECT_SOURCE_DIR}/proto_c/ + ) + +if (FLUENT_PROTO_COMMON) + set(src ${src} ${OTEL_C_FILES}/proto/common/v1/common.pb-c.c) +endif() + +if (FLUENT_PROTO_RESOURCE) + set(src ${src} ${OTEL_C_FILES}/proto/resource/v1/resource.pb-c.c) +endif() + +if (FLUENT_PROTO_TRACE) + set(src ${src} ${OTEL_C_FILES}/proto/trace/v1/trace.pb-c.c) + set(src ${src} ${OTEL_C_FILES}/proto/collector/trace/v1/trace_service.pb-c.c) +endif() + +if (FLUENT_PROTO_LOGS) + set(src ${src} ${OTEL_C_FILES}/proto/logs/v1/logs.pb-c.c) + set(src ${src} ${OTEL_C_FILES}/proto/collector/logs/v1/logs_service.pb-c.c) +endif() + +if (FLUENT_PROTO_METRICS) + set(src ${src} ${OTEL_C_FILES}/proto/metrics/v1/metrics.pb-c.c) + set(src ${src} ${OTEL_C_FILES}/proto/collector/metrics/v1/metrics_service.pb-c.c) +endif() + +add_library(fluent-otel-proto STATIC ${src}) diff --git a/fluent-bit/lib/fluent-otel-proto/src/fluent-otel.c b/fluent-bit/lib/fluent-otel-proto/src/fluent-otel.c new file mode 100644 index 000000000..49ff9a099 --- /dev/null +++ b/fluent-bit/lib/fluent-otel-proto/src/fluent-otel.c @@ -0,0 +1,62 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ + +/* Fluent Bit + * ========== + * Copyright (C) 2022 The Fluent Bit Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <stdio.h> +#include <fluent-otel-proto/fluent-otel.h> + +/* just a way to expose some helper functions */ +void fluent_otel_info() +{ + + printf("- opentelemetry proto 'common' : "); +#ifdef FLUENT_OTEL_HAVE_COMMON + printf("%10s", "found\n"); +#else + printf("%10s", "not found (enable it with -DFLUENT_PROTO_COMMON)\n"); +#endif + + printf("- opentelemetry proto 'resource': "); +#ifdef FLUENT_OTEL_HAVE_RESOURCE + printf("%10s", "found\n"); +#else + printf("%10s", "not found (enable it with -DFLUENT_PROTO_RESOURCE)\n"); +#endif + + printf("- opentelemetry proto 'trace' : "); +#ifdef FLUENT_OTEL_HAVE_TRACE + printf("%10s", "found\n"); +#else + printf("%10s", "not found (enable it with -DFLUENT_PROTO_TRACE)\n"); +#endif + + printf("- opentelemetry proto 'logs' : "); +#ifdef FLUENT_OTEL_HAVE_LOGS + printf("%10s", "found\n"); +#else + printf("%10s", "not found (enable it with -DFLUENT_PROTO_LOGS)\n"); +#endif + + printf("- opentelemetry proto 'metrics' : "); +#ifdef FLUENT_OTEL_HAVE_METRICS + printf("%10s", "found\n"); +#else + printf("%10s", "not found (enable it with -DFLUENT_PROTO_METRICS)\n"); +#endif + +} |