├── .github
├── dummy
└── workflows
│ ├── containers.yml
│ └── docs.yml
├── ifex
├── models
│ ├── DBus
│ │ └── __init__.py
│ ├── common
│ │ └── __init__.py
│ ├── protobuf
│ │ ├── __init__.py
│ │ ├── grpc_parser.py
│ │ └── README.md
│ ├── __init__.py
│ └── ifex
│ │ ├── __init__.py
│ │ └── types.yml
├── transformers
│ └── __init__.py
├── input_filters
│ ├── franca
│ │ └── __init__.py
│ ├── protobuf
│ │ └── __init__.py
│ └── __init__.py
├── output_filters
│ ├── DBus
│ │ └── __init__.py
│ ├── protobuf
│ │ ├── __init__.py
│ │ └── templates
│ │ │ ├── FieldOption.j2
│ │ │ ├── Range.j2
│ │ │ ├── EnumField.j2
│ │ │ ├── Reserved.j2
│ │ │ ├── Import.j2
│ │ │ ├── MapField.j2
│ │ │ ├── Service.j2
│ │ │ ├── Oneof.j2
│ │ │ ├── RPC.j2
│ │ │ ├── Field.j2
│ │ │ ├── Option.j2
│ │ │ ├── Enumeration.j2
│ │ │ ├── Proto.j2
│ │ │ └── Message.j2
│ ├── templates
│ │ ├── D-Bus
│ │ │ ├── Argument.tpl
│ │ │ ├── Include.tpl
│ │ │ ├── Option.tpl
│ │ │ ├── Typedef.tpl
│ │ │ ├── Error.tpl
│ │ │ ├── Property.tpl
│ │ │ ├── Member.tpl
│ │ │ ├── Enumeration.tpl
│ │ │ ├── Event.tpl
│ │ │ ├── Namespace.tpl
│ │ │ ├── AST.tpl
│ │ │ ├── Interface.tpl
│ │ │ ├── Struct.tpl
│ │ │ └── Method.tpl
│ │ ├── simple
│ │ │ ├── Argument-simple_doc.html
│ │ │ ├── Error-simple_doc.html
│ │ │ ├── Member-simple_doc.html
│ │ │ ├── AST-simple_doc.tpl
│ │ │ └── simple_overview.tpl
│ │ └── __init__.py
│ ├── __init__.py
│ ├── schema
│ │ ├── __init__.py
│ │ ├── pretty_print_json.py
│ │ └── LICENSE.json-schema
│ └── README.md
├── layer_types
│ ├── Timing
│ │ ├── example-core.ilay
│ │ └── example-timing.ilay
│ ├── ValueConstraint
│ │ └── example.ilay
│ └── utils
│ │ └── identify_layer.py
└── __init__.py
├── scripts
├── docker_ifexgen_dbus
├── bashrc.venv
├── .bashrc
├── install_python_version_in_pyenv.sh
├── install_pyenv.sh
├── docker_ifexgen
└── pyenv_run_test.sh
├── tests
├── generic_test.py
├── testdefs
│ ├── proto_lark1
│ │ ├── expect_success
│ │ ├── function
│ │ ├── inputs
│ │ └── module
│ ├── proto_lark2
│ │ ├── expect_success
│ │ ├── function
│ │ ├── inputs
│ │ └── module
│ └── protobuf_in_out_roundtrip
│ │ ├── compare_results
│ │ ├── module
│ │ ├── function
│ │ ├── inputs
│ │ └── one
│ │ ├── results
│ │ └── one.out
│ │ └── proto_roundtrip.py
├── test.ifex.sample
│ ├── result
│ └── template
├── test.ifex.variant
│ ├── result
│ ├── template
│ └── input.yaml
├── __init__.py
├── protobuf
│ └── unit_test_files
│ │ ├── grpc
│ │ ├── def_to_proto_editions_test.proto
│ │ ├── def_to_proto_public_import_test.proto
│ │ ├── def_to_proto_regular_import_test.proto
│ │ ├── test_import_empty_srcs.proto
│ │ ├── test_cpp.proto
│ │ ├── utf8_test_proto2.proto
│ │ ├── hello_dep.proto
│ │ ├── empty2.proto
│ │ ├── frame_fuzzer.proto
│ │ ├── simplest.proto
│ │ ├── data.proto
│ │ ├── package_options_import2.proto
│ │ ├── imported-with-dash.proto
│ │ ├── package_options_import.proto
│ │ ├── empty_service.proto
│ │ ├── simple_messages.proto
│ │ ├── bar.proto
│ │ ├── same.proto
│ │ ├── simpler.proto
│ │ ├── same_package_service_name.proto
│ │ ├── service.proto
│ │ ├── test-dash-filename.proto
│ │ ├── editions_test.proto
│ │ ├── requests.proto
│ │ ├── complicated.proto
│ │ ├── same_ruby_package_service_name.proto
│ │ ├── m_double_2d.proto
│ │ ├── bar_with_wkt.proto
│ │ ├── channel_args_fuzzer.proto
│ │ ├── testcodegen.proto
│ │ ├── package_options.proto
│ │ ├── unary_stream_benchmark.proto
│ │ ├── namespaced_dependency.proto
│ │ ├── clientonly.proto
│ │ ├── echo.proto
│ │ ├── serveronly.proto
│ │ ├── end2end_test_fuzzer.proto
│ │ ├── fuzzer.proto
│ │ ├── clientandserver.proto
│ │ ├── greet.proto
│ │ ├── subpackage.proto
│ │ ├── fuzzing_channel_args.proto
│ │ ├── required_fields_test.proto
│ │ ├── echo_duplicate.proto
│ │ ├── proto3_test.proto
│ │ ├── empty.proto
│ │ ├── empty2_extensions.proto
│ │ ├── report_qps_scenario_service.proto
│ │ ├── fuzz_config_vars.proto
│ │ ├── proxy-service.proto
│ │ ├── test_responses.proto
│ │ ├── client_control.proto
│ │ ├── required_fields_editions_test.proto
│ │ ├── keyvaluestore.proto
│ │ ├── test_payload.proto
│ │ ├── prime.proto
│ │ ├── avl_fuzzer.proto
│ │ ├── simple.proto
│ │ ├── fuzzing_event_engine.proto
│ │ ├── second.proto
│ │ ├── another.proto
│ │ ├── hello.world.proto
│ │ ├── depnothing.proto
│ │ ├── compiler.proto
│ │ ├── hpack_parser_fuzzer.proto
│ │ ├── namespacetest.proto
│ │ ├── payloads.proto
│ │ ├── depservice.proto
│ │ ├── hellostreamingworld.proto
│ │ ├── services.proto
│ │ ├── work_queue_fuzzer.proto
│ │ ├── depmethod.proto
│ │ ├── file.proto
│ │ ├── inter_activity_mutex_test.proto
│ │ ├── auth_sample.proto
│ │ ├── utf8_test.proto
│ │ ├── namespaced_example.proto
│ │ ├── package_options_ruby_style.proto
│ │ ├── chunked_vector_fuzzer.proto
│ │ ├── phone.proto
│ │ ├── hpack_sync_fuzzer.proto
│ │ ├── flow_control_fuzzer.proto
│ │ ├── metrics.proto
│ │ ├── memory_quota_fuzzer.proto
│ │ └── transport_security_common.proto
│ │ ├── protobuf
│ │ ├── unittest_delimited_import.proto
│ │ ├── unittest_string_type.proto
│ │ ├── unittest_lite_edition_2024.proto
│ │ ├── late_loaded_option_user.proto
│ │ ├── unittest_import_public.proto
│ │ ├── late_loaded_option.proto
│ │ ├── unittest_import_public_lite.proto
│ │ ├── any_test.proto
│ │ ├── unittest_legacy_features.proto
│ │ ├── only_one_enum_test.proto
│ │ ├── unittest_arena.proto
│ │ ├── unittest_proto3_extensions.proto
│ │ ├── unittest_invalid_features.proto
│ │ ├── unittest_lite_imports_nonlite.proto
│ │ ├── unittest_no_generic_services.proto
│ │ ├── unittest_extension_set.proto
│ │ ├── unittest_import_lite.proto
│ │ ├── map_proto3_unittest.proto
│ │ ├── unittest_preserve_unknown_enum2.proto
│ │ ├── unittest_drop_unknown_fields.proto
│ │ ├── unittest_embed_optimize_for.proto
│ │ ├── unittest_string_view.proto
│ │ ├── unittest_optimize_for.proto
│ │ ├── unittest_mset_wire_format.proto
│ │ ├── unittest_preserve_unknown_enum.proto
│ │ ├── unittest_import.proto
│ │ ├── unittest_lazy_dependencies_enum.proto
│ │ └── unittest_lazy_dependencies_custom_option.proto
│ │ ├── README.md
│ │ └── LICENSES
│ │ └── MIT
├── merge_tree
│ ├── two
│ ├── four
│ ├── three
│ ├── async
│ ├── five
│ ├── one
│ ├── one+three
│ ├── four+five
│ └── one+two
├── test.proto.1
│ ├── input
│ └── result
├── generic_testrunner.sh
├── README.md
└── gen_proto_test.py
├── docs
├── .gitignore
├── .vitepress
│ └── theme
│ │ ├── custom.css
│ │ └── index.ts
├── package.json
├── generate-types-doc.py
├── Dockerfile
├── developers-manual
│ ├── index.md
│ └── mapping-documents
│ │ └── index.md
├── Dockerfile.generator
├── docker-compose.yml
├── index.md
├── create-toc.py
└── generate-docs.sh
├── distribution
├── __init__.py
├── entrypoints
│ ├── __init__.py
│ ├── protobuf_ifex.py
│ ├── generator_dbus.py
│ └── generator.py
└── docker
│ ├── Dockerfile.alpine
│ ├── Dockerfile.ubuntu
│ └── README.md
├── .gitmodules
├── helpers
├── dbus
│ └── c++
│ │ └── sdbus-c++-xml2cpp
│ │ ├── bashrc
│ │ ├── Dockerfile
│ │ ├── build.sh
│ │ ├── README.md
│ │ ├── sdbus-c++-xml2cpp-generate
│ │ └── Makefile
├── README.md
└── test_convert_uservices.sh
├── requirements-dev.txt
├── requirements.txt
├── .dockerignore
├── tox.ini
├── MANIFEST.in
├── Pipfile
└── DCO.txt
/.github/dummy:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ifex/models/DBus/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ifex/models/common/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ifex/models/protobuf/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ifex/transformers/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ifex/input_filters/franca/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ifex/output_filters/DBus/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ifex/input_filters/protobuf/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/scripts/docker_ifexgen_dbus:
--------------------------------------------------------------------------------
1 | docker_ifexgen
--------------------------------------------------------------------------------
/tests/generic_test.py:
--------------------------------------------------------------------------------
1 | generic_testrunner.py
--------------------------------------------------------------------------------
/tests/testdefs/proto_lark1/expect_success:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/testdefs/proto_lark2/expect_success:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/Argument.tpl:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/Include.tpl:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/Option.tpl:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/Typedef.tpl:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ifex/models/protobuf/grpc_parser.py:
--------------------------------------------------------------------------------
1 | protobuf_lark.py
--------------------------------------------------------------------------------
/tests/testdefs/protobuf_in_out_roundtrip/compare_results:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tests/testdefs/proto_lark1/function:
--------------------------------------------------------------------------------
1 | get_ast_from_proto_file
2 |
--------------------------------------------------------------------------------
/tests/testdefs/proto_lark2/function:
--------------------------------------------------------------------------------
1 | get_ast_from_proto_file
2 |
--------------------------------------------------------------------------------
/tests/testdefs/proto_lark2/inputs:
--------------------------------------------------------------------------------
1 | ../../protobuf/unit_test_files/grpc
--------------------------------------------------------------------------------
/tests/testdefs/protobuf_in_out_roundtrip/module:
--------------------------------------------------------------------------------
1 | proto_roundtrip.py
--------------------------------------------------------------------------------
/tests/testdefs/proto_lark1/inputs:
--------------------------------------------------------------------------------
1 | ../../protobuf/unit_test_files/protobuf
--------------------------------------------------------------------------------
/tests/testdefs/protobuf_in_out_roundtrip/function:
--------------------------------------------------------------------------------
1 | proto_roundtrip
2 |
--------------------------------------------------------------------------------
/tests/testdefs/proto_lark1/module:
--------------------------------------------------------------------------------
1 | ../../../ifex/models/protobuf/protobuf_lark.py
--------------------------------------------------------------------------------
/tests/testdefs/proto_lark2/module:
--------------------------------------------------------------------------------
1 | ../../../ifex/models/protobuf/protobuf_lark.py
--------------------------------------------------------------------------------
/docs/.gitignore:
--------------------------------------------------------------------------------
1 | .vitepress/dist
2 | .vitepress/cache
3 | node_modules
4 | **/*.generated.md
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/FieldOption.j2:
--------------------------------------------------------------------------------
1 | ({{ item.name }}) = "{{ item.value }}"
2 |
--------------------------------------------------------------------------------
/scripts/bashrc.venv:
--------------------------------------------------------------------------------
1 | alias ll='ls -alF'
2 |
3 | # Activate venv
4 | . /ifex/venv/bin/activate
5 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/Error.tpl:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/tests/test.ifex.sample/result:
--------------------------------------------------------------------------------
1 | NAME:named_service
2 | DESCRIPTION SHOULD BE HERE: <<--This is it.-->>
3 |
--------------------------------------------------------------------------------
/tests/test.ifex.variant/result:
--------------------------------------------------------------------------------
1 | NAME:named_service
2 | DESCRIPTION SHOULD BE HERE: <<--This is it.-->>
3 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/simple/Argument-simple_doc.html:
--------------------------------------------------------------------------------
1 | {{item.datatype}} {{ item.name }}
2 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/simple/Error-simple_doc.html:
--------------------------------------------------------------------------------
1 | {{item.datatype}} {{ item.description }}
2 |
--------------------------------------------------------------------------------
/tests/test.ifex.sample/template:
--------------------------------------------------------------------------------
1 | NAME:{{item.name}}
2 | DESCRIPTION SHOULD BE HERE: <<--{{item.description}}-->>
3 |
--------------------------------------------------------------------------------
/tests/test.ifex.variant/template:
--------------------------------------------------------------------------------
1 | NAME:{{item.name}}
2 | DESCRIPTION SHOULD BE HERE: <<--{{item.description}}-->>
3 |
--------------------------------------------------------------------------------
/tests/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2022 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
--------------------------------------------------------------------------------
/distribution/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2025 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
--------------------------------------------------------------------------------
/ifex/models/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2025 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
--------------------------------------------------------------------------------
/ifex/input_filters/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2025 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
--------------------------------------------------------------------------------
/ifex/models/ifex/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2022 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
--------------------------------------------------------------------------------
/ifex/output_filters/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2022 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
--------------------------------------------------------------------------------
/distribution/entrypoints/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2022 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
--------------------------------------------------------------------------------
/docs/.vitepress/theme/custom.css:
--------------------------------------------------------------------------------
1 | :root {
2 | --vp-c-brand-1: #28819d;
3 | --vp-c-brand-2: #2f94b6;
4 | --vp-c-brand-3: #28819d;
5 | }
6 |
--------------------------------------------------------------------------------
/docs/.vitepress/theme/index.ts:
--------------------------------------------------------------------------------
1 | import DefaultTheme from "vitepress/theme";
2 | import "./custom.css";
3 |
4 | export default DefaultTheme;
5 |
--------------------------------------------------------------------------------
/ifex/output_filters/schema/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2022 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/__init__.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2022 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
4 |
5 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/simple/Member-simple_doc.html:
--------------------------------------------------------------------------------
1 | {{item.datatype}} {{item.name}}[{{item.arraysize}}] {{ item.description }}
2 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "ifex/input_filters/franca/pyfranca"]
2 | path = ifex/input_filters/franca/pyfranca
3 | url = https://github.com/gunnarx/pyfranca
4 |
--------------------------------------------------------------------------------
/helpers/dbus/c++/sdbus-c++-xml2cpp/bashrc:
--------------------------------------------------------------------------------
1 | # bashrc to make interactive use in container feasible
2 | alias ls -alF
3 | export PATH="/sdbus-cpp/build/tools/:$PATH"
4 |
--------------------------------------------------------------------------------
/scripts/.bashrc:
--------------------------------------------------------------------------------
1 | alias ll='ls -alF'
2 | export PYENV_ROOT="$HOME/.pyenv"
3 | command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
4 | eval "$(pyenv init -)"
5 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/Range.j2:
--------------------------------------------------------------------------------
1 | {% if item.single_value %}
2 | {{ item.single_value }}
3 | {% else %}
4 | {{ item.range_start }} to {{ item.range_end }}
5 | {% endif %}
6 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/EnumField.j2:
--------------------------------------------------------------------------------
1 | {{ item.name }} = {{ item.value }}{% if item.options %}
2 | {% for option in item.options %}
3 | {{ gen(option) }}
4 | {% endfor %}
5 | {% endif %};
6 |
--------------------------------------------------------------------------------
/requirements-dev.txt:
--------------------------------------------------------------------------------
1 | iniconfig>=1.1.1
2 | packaging>=21.3
3 | pluggy>=1.0.0
4 | ply>=3.11
5 | py>=1.11.0
6 | pyparsing>=3.0.9
7 | pytest>=7.4.4
8 | setuptools
9 | six>=1.16.0
10 | tomli>=2.0.1
11 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | Jinja2>=3.1.3
2 | MarkupSafe>=2.1.1
3 | PyYAML>=6.0
4 | attrs>=23.2.0
5 | dacite>=1.6.0
6 | jsonschema<4.18
7 | lark>=1.1.9
8 | lxml>=5.0.0
9 | oyaml>=1.0
10 | inflection>=0.5.1
11 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/Reserved.j2:
--------------------------------------------------------------------------------
1 | reserved {
2 | {% for range in item.ranges %}
3 | {{ gen(range) }};
4 | {% endfor %}
5 | {% for name in item.strfieldnames %}
6 | "{{ name }}";
7 | {% endfor %}
8 | }
9 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | # Ignore everything
2 | *
3 |
4 | # Except this...
5 | !ifex/
6 | !distribution/
7 | !scripts/
8 | !tests/
9 | !setup.py
10 | !README.md
11 | !requirements.txt
12 | !requirements-dev.txt
13 | !tox.ini
14 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/Import.j2:
--------------------------------------------------------------------------------
1 | {% if item.weak %}
2 | import weak "{{ item.path }}";
3 | {% elif item.public %}
4 | import public "{{ item.path }}";
5 | {% else %}
6 | import "{{ item.path }}";
7 | {% endif %}
8 |
--------------------------------------------------------------------------------
/tox.ini:
--------------------------------------------------------------------------------
1 | [tox]
2 | envlist = py36, py37, py38, py39, py310, py311
3 |
4 | [testenv]
5 | allowlist_externals = make, pytest
6 | commands =
7 | pytest -v tests
8 | install_command = pip install {opts} {packages}
9 | deps =
10 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/MapField.j2:
--------------------------------------------------------------------------------
1 | map<{{ item.keytype }}, {{ item.valuetype }}> {{ item.name }}{% if item.options %}
2 | {% for option in item.options %}
3 | {{ gen(option) }}
4 | {% endfor %}
5 | {% endif %} = 0;
6 |
--------------------------------------------------------------------------------
/docs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "docs:dev": "vitepress dev",
4 | "docs:build": "vitepress build",
5 | "docs:preview": "vitepress preview"
6 | },
7 | "devDependencies": {
8 | "vitepress": "1.6.4"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/Property.tpl:
--------------------------------------------------------------------------------
1 | {% if item.description != None %}
2 |
3 | {% endif %}
4 |
5 |
--------------------------------------------------------------------------------
/ifex/layer_types/Timing/example-core.ilay:
--------------------------------------------------------------------------------
1 | namespaces:
2 | - name: _
3 | interface:
4 | - name: DataLayer
5 | properties:
6 | - name: this
7 | type: string
8 | - name: that
9 | type: int32
10 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/Member.tpl:
--------------------------------------------------------------------------------
1 | {% if item.description != None %}
2 |
3 | {% else %}
4 |
5 | {% endif %}
6 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/Service.j2:
--------------------------------------------------------------------------------
1 | service {{ item.name }} {
2 | {% for rpc in item.rpcs %}
3 | {{ gen(rpc) }}
4 | {% endfor %}
5 | {% if item.options %}
6 | {% for option in item.options %}
7 | {{ gen(option) }}
8 | {% endfor %}
9 | {% endif %}
10 | }
11 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/Oneof.j2:
--------------------------------------------------------------------------------
1 | oneof {{ item.name }} {
2 | {% for field in item.fields %}
3 | {{ gen(field) }}
4 | {% endfor %}
5 | {% if item.options %}
6 | {% for option in item.options %}
7 | {{ gen(option) }}
8 | {% endfor %}
9 | {% endif %}
10 | }
11 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/Enumeration.tpl:
--------------------------------------------------------------------------------
1 | {% if item.description != None %}
2 |
3 | {% endif %}
4 |
5 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/Event.tpl:
--------------------------------------------------------------------------------
1 | {% if item.description != "" %}{% endif %}
2 |
3 | {% for x in item.input: %}
4 |
5 | {% endfor %}
6 |
7 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/def_to_proto_editions_test.proto:
--------------------------------------------------------------------------------
1 | edition = "2023";
2 |
3 | package pkg;
4 |
5 | message EditionsMessage {
6 | int32 required_field = 1 [features.field_presence = LEGACY_REQUIRED];
7 | EditionsMessage delimited_field = 2 [features.message_encoding = DELIMITED];
8 | }
9 |
--------------------------------------------------------------------------------
/ifex/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Interface Exchange Framework (IFEX) - Python Library
3 |
4 | IFEX is a general interface description and transformation technology to
5 | integrate/unify/translate different IDLs, and provide tools and methods to
6 | facilitate system integration using popular IPC/RPC protocols.
7 | """
8 |
--------------------------------------------------------------------------------
/helpers/dbus/c++/sdbus-c++-xml2cpp/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM debian:bullseye-slim
2 | RUN apt-get update && apt-get install -y git build-essential cmake pkg-config libsystemd-dev libexpat-dev
3 | COPY bashrc /root/.bashrc
4 | COPY build.sh .
5 | RUN ./build.sh
6 | WORKDIR /work
7 | CMD /sdbus-cpp/build/tools/sdbus-c++-xml2cpp
8 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include README.md
2 | include LICENSE
3 | include requirements.txt
4 | include DCO.txt
5 | recursive-include ifex *.py *.yaml *.yml *.json *.jinja2 *.j2
6 | recursive-include distribution *.py
7 | recursive-exclude tests *
8 | recursive-exclude docs *
9 | recursive-exclude .git *
10 | recursive-exclude .github *
11 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/RPC.j2:
--------------------------------------------------------------------------------
1 | rpc {{ item.name }}({% if item.input_stream %}stream {% endif %}{{ item.input }}) returns ({% if item.return_stream %}stream {% endif %}{{ item.returns }})
2 | {%- if item.options %} {
3 | {% for option in item.options %}
4 | {{ gen(option) }}
5 | {% endfor %}
6 | }
7 | {%- endif %}
8 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/Field.j2:
--------------------------------------------------------------------------------
1 | {% if item.repeated %}repeated {% endif %}{% if item.optional %}optional {% endif %}{{ item.datatype }} {{ item.name }} = 0
2 | {%- if item.options %}
3 | [
4 | {% for option in item.options %}
5 | {{ gen(option) }}{{ "" if loop.last else ", " }}
6 | {% endfor %}
7 | ]
8 | {% endif %};
9 |
10 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/Option.j2:
--------------------------------------------------------------------------------
1 | {% if item.structuredoptions != None %}
2 | option ({{ item.name }}) = {
3 | {% for o in item.structuredoptions %}
4 | {{ o.name }} : {{ o.value }}{{ "" if loop.last else ", " }}
5 | {% endfor %}
6 | };
7 | {% else %}
8 | option {{ item.name }} = {{ gen_str_or_int(item.value) }}
9 | {%- endif %}
10 |
--------------------------------------------------------------------------------
/tests/merge_tree/two:
--------------------------------------------------------------------------------
1 | # Overlay, adding an output parameter to existing method m1
2 | name: Overlay_Example
3 | filetype: IFEX Core IDL
4 | namespaces:
5 | - name: common.namespace
6 | methods:
7 | - name: m1
8 | input:
9 | - name: +new_param
10 | datatype: string[]
11 | output:
12 | - name: out_param
13 | datatype: string
14 |
--------------------------------------------------------------------------------
/helpers/dbus/c++/sdbus-c++-xml2cpp/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -xe
2 |
3 | if [ ! -d sdbus-cpp ] ; then
4 | git clone --depth=1 https://github.com/Kistler-Group/sdbus-cpp
5 | fi
6 | cd sdbus-cpp
7 | rm -rf build
8 | mkdir -p build
9 | cd build
10 | cmake .. -DCMAKE_BUILD_TYPE=Release -DSDBUSCPP_BUILD_CODEGEN=ON
11 | cmake --build .
12 | tools/sdbus-c++-xml2cpp -h
13 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/simple/AST-simple_doc.tpl:
--------------------------------------------------------------------------------
1 | AST: {{item.name}}
2 | {{item.minor_version}}
3 | {{item.major_version}}
4 | Descr: {{item.description}}
5 | Includes:
6 | {% for i in item.includes: %}
7 | File: {{i.file}} ({{i.description}})
8 | {% endfor %}
9 | {% for n in item.namespaces: %}
10 | {{ gen(n) }}
11 | {% endfor %}
12 |
--------------------------------------------------------------------------------
/tests/merge_tree/four:
--------------------------------------------------------------------------------
1 | name: Original
2 | filetype: IFEX Core IDL
3 | namespaces:
4 | - name: common.namespace
5 | typedefs:
6 | - name: VariType
7 | datatypes:
8 | - int32
9 | - uint16
10 | - string[]
11 | - name: VariType2
12 | datatype: variant
13 | methods:
14 | - name: m1
15 | input:
16 | - name: var
17 | datatype: VariType
18 |
--------------------------------------------------------------------------------
/tests/merge_tree/three:
--------------------------------------------------------------------------------
1 | # Overlay, adding an output parameter to existing method m1
2 | name: Overlay_Example with removal
3 | filetype: IFEX Core IDL
4 | namespaces:
5 | - name: common.namespace
6 | methods:
7 | - name: -m2
8 | - name: m1
9 | input:
10 | - name: -second_param
11 | - name: new_param
12 | datatype: string
13 | arraysize: 42
14 | - name: -foo
15 |
--------------------------------------------------------------------------------
/tests/merge_tree/async:
--------------------------------------------------------------------------------
1 | # New layer (different information) to add sync/async info to method
2 | name: Async/Sync layer example
3 | filetype: Async specifier
4 | namespaces:
5 | - name: common.namespace
6 | methods:
7 | - name: m2
8 | async: false
9 | - name: m1
10 | async: true
11 | methods:
12 | - name: common.other.namespace
13 | methods:
14 | - name: m1
15 | async: false
16 |
--------------------------------------------------------------------------------
/ifex/layer_types/Timing/example-timing.ilay:
--------------------------------------------------------------------------------
1 | # vim: et sw=2
2 | schema: Timing/schema.json
3 | namespaces:
4 | - name: _
5 | interface:
6 | name: DataLayer
7 | properties:
8 | - name: this
9 | min_period: 2ms
10 | max_period: 10ms
11 | - name: that
12 | max_frequency: 1000Hz
13 | events:
14 | - name: myOp
15 | methods:
16 | - name: myOp
17 |
--------------------------------------------------------------------------------
/tests/merge_tree/five:
--------------------------------------------------------------------------------
1 | name: Overlay extending variant type
2 | filetype: IFEX Core IDL
3 | namespaces:
4 | - name: common.namespace
5 | typedefs:
6 | - name: VariType
7 | datatypes:
8 | - -uint16 # (Removal)
9 | - +map
10 | - NewType
11 | - name: VariType2
12 | datatype: string # Replace type
13 | - name: New
14 | description: A new type
15 | datatypes:
16 | - uint8
17 |
--------------------------------------------------------------------------------
/docs/generate-types-doc.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | # SPDX-FileCopyrightText: Copyright (c) 2023 Novaspring AB
4 | # SPDX-License-Identifier: MPL-2.0
5 |
6 | from ifex.models.ifex.ifex_ast import FundamentalTypes
7 |
8 | print("|Name|Description|Min value|Max value|")
9 | print("|----|-----------|---------|---------|")
10 | for line in [f"|{t[0]} | {t[1]} | {t[2]} | {t[3]}|" for t in FundamentalTypes.ptypes]:
11 | print(line)
12 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/Enumeration.j2:
--------------------------------------------------------------------------------
1 | enum {{ item.name }} {
2 | {%+ for field in item.fields %}
3 | {{ gen(field) }}
4 | {% endfor %}
5 | {% if item.options %}
6 | {% for option in item.options %}
7 | {{ gen(option) }}
8 | {% endfor %}
9 |
10 | {% endif %}
11 | {% if item.reservations %}
12 | {% for reserved in item.reservations %}
13 | {{ gen(reserved) }}
14 | {% endfor %}
15 |
16 | {% endif %} }
17 |
--------------------------------------------------------------------------------
/tests/merge_tree/one:
--------------------------------------------------------------------------------
1 | name: Original
2 | filetype: IFEX Core IDL
3 | namespaces:
4 | - name: common.namespace
5 | methods:
6 | - name: m2
7 | # (empty)
8 | - name: m1
9 | input:
10 | - name: first_param
11 | datatype: int32
12 | - name: second_param
13 | datatype: map
14 | - name: other.namespace
15 | methods:
16 | - name: m1
17 | input:
18 | - name: bar
19 | datatype: int32
20 |
--------------------------------------------------------------------------------
/tests/merge_tree/one+three:
--------------------------------------------------------------------------------
1 | name: Overlay_Example with removal
2 | namespaces:
3 | - name: common.namespace
4 | methods:
5 | - name: m1
6 | input:
7 | - name: first_param
8 | datatype: int32
9 | - name: new_param
10 | datatype: string
11 | arraysize: 42
12 | - name: other.namespace
13 | methods:
14 | - name: m1
15 | input:
16 | - name: bar
17 | datatype: int32
18 | filetype: IFEX Core IDL
19 |
--------------------------------------------------------------------------------
/tests/test.proto.1/input:
--------------------------------------------------------------------------------
1 | package common;
2 |
3 | option java_package = "org.covesa.uservice.common";
4 |
5 | option java_multiple_files = "true";
6 |
7 | message HealthState { enum State { S_UNSPECIFIED = 0;
8 | S_OK = 1; S_SERVICE_SOON = 2;
9 | S_SERVICE_NOW = 3;
10 | S_DISABLED = 4;
11 | S_FAULT_PRESENT = 5; S_UNSUPPORTED = 6;
12 | }
13 |
14 | optional int32 remaining_life = 0;
15 | State state = 0;
16 |
17 |
18 | }
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tests/test.proto.1/result:
--------------------------------------------------------------------------------
1 | package common;
2 |
3 | option java_package = "org.covesa.uservice.common"
4 | option java_multiple_files = "true"
5 |
6 | message HealthState {
7 | enum State {
8 | S_UNSPECIFIED = 0;
9 | S_OK = 1;
10 | S_SERVICE_SOON = 2;
11 | S_SERVICE_NOW = 3;
12 | S_DISABLED = 4;
13 | S_FAULT_PRESENT = 5;
14 | S_UNSUPPORTED = 6;
15 | }
16 | optional int32 remaining_life = 0;
17 | State state = 0;
18 | }
19 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/def_to_proto_public_import_test.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2023 Google LLC. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | syntax = "proto3";
9 |
10 | package pkg;
11 |
12 | message PublicImportMessage {}
13 |
--------------------------------------------------------------------------------
/Pipfile:
--------------------------------------------------------------------------------
1 | [[source]]
2 | url = "https://pypi.org/simple"
3 | verify_ssl = true
4 | name = "pypi"
5 |
6 | [packages]
7 | dacite = ">=1.6.0"
8 | jinja2 = ">=3.1.3"
9 | jsonschema = "<4.18"
10 | lark = "==1.1.9"
11 | lxml = "==4.9.3"
12 | oyaml = "==1.0"
13 | pyparsing = "==3.0.9"
14 | pytest = ">=7.4.4"
15 | pyyaml = ">=6.0"
16 | setuptools = ">=75.0"
17 | wheel = "*"
18 |
19 | [dev-packages]
20 | twine = "*"
21 | build = "*"
22 |
23 | [requires]
24 | python_version = "3.10"
25 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/Namespace.tpl:
--------------------------------------------------------------------------------
1 | {% if item.interface != None %}
2 | {{gen(item.interface)}}
3 | {% endif %}
4 |
5 | {# Definition of named structs and other datatypes have little meaning in D-Bus, but we can generate some comments about them: #}
6 | {% for x in item.structs %}
7 | {{gen(x)}}
8 | {% endfor %}
9 |
10 | {% for x in item.typedefs %}
11 | {{gen(x)}}
12 | {% endfor %}
13 |
14 | {% for x in item.enumerations %}
15 | {{gen(x)}}
16 | {% endfor %}
17 |
--------------------------------------------------------------------------------
/tests/testdefs/protobuf_in_out_roundtrip/inputs/one:
--------------------------------------------------------------------------------
1 | package common;
2 |
3 | option java_package = "org.covesa.uservice.common";
4 |
5 | option java_multiple_files = "true";
6 |
7 | message HealthState { enum State { S_UNSPECIFIED = 0;
8 | S_OK = 1; S_SERVICE_SOON = 2;
9 | S_SERVICE_NOW = 3;
10 | S_DISABLED = 4;
11 | S_FAULT_PRESENT = 5; S_UNSUPPORTED = 6;
12 | }
13 |
14 | optional int32 remaining_life = 0;
15 | State state = 0;
16 |
17 |
18 | }
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tests/testdefs/protobuf_in_out_roundtrip/results/one.out:
--------------------------------------------------------------------------------
1 | package common;
2 |
3 | option java_package = "org.covesa.uservice.common"
4 | option java_multiple_files = "true"
5 |
6 | message HealthState {
7 | enum State {
8 | S_UNSPECIFIED = 0;
9 | S_OK = 1;
10 | S_SERVICE_SOON = 2;
11 | S_SERVICE_NOW = 3;
12 | S_DISABLED = 4;
13 | S_FAULT_PRESENT = 5;
14 | S_UNSUPPORTED = 6;
15 | }
16 | optional int32 remaining_life = 0;
17 | State state = 0;
18 | }
19 |
--------------------------------------------------------------------------------
/tests/merge_tree/four+five:
--------------------------------------------------------------------------------
1 | name: Overlay extending variant type
2 | namespaces:
3 | - name: common.namespace
4 | methods:
5 | - name: m1
6 | input:
7 | - name: var
8 | datatype: VariType
9 | typedefs:
10 | - name: VariType
11 | datatypes:
12 | - NewType
13 | - int32
14 | - map
15 | - string[]
16 | - name: VariType2
17 | datatype: string
18 | - name: New
19 | datatypes:
20 | - uint8
21 | description: A new type
22 | filetype: IFEX Core IDL
23 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/def_to_proto_regular_import_test.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2023 Google LLC. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | syntax = "proto3";
9 |
10 | package pkg;
11 |
12 | message RegularImportMessage {}
13 |
14 | enum Proto3Enum {
15 | PROTO3_ENUM_ZERO = 0;
16 | }
17 |
--------------------------------------------------------------------------------
/tests/merge_tree/one+two:
--------------------------------------------------------------------------------
1 | name: Overlay_Example
2 | namespaces:
3 | - name: common.namespace
4 | methods:
5 | - name: m2
6 | - name: m1
7 | input:
8 | - name: first_param
9 | datatype: int32
10 | - name: second_param
11 | datatype: map
12 | - name: new_param
13 | datatype: string[]
14 | output:
15 | - name: out_param
16 | datatype: string
17 | - name: other.namespace
18 | methods:
19 | - name: m1
20 | input:
21 | - name: bar
22 | datatype: int32
23 | filetype: IFEX Core IDL
24 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_delimited_import.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2023";
9 |
10 | package editions_unittest;
11 |
12 | option java_multiple_files = true;
13 |
14 | message MessageImport {
15 | int32 a = 1;
16 | int32 b = 2;
17 | }
18 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/AST.tpl:
--------------------------------------------------------------------------------
1 | {# Collect namespace names for naming of interface. (This does not generate any text) #}
2 | {% for n in item.namespaces %}
3 | {{ add_namespace(n) }}
4 | {% endfor %}
5 |
6 | {# Start of generation here #}
7 |
10 |
11 | {% for n in item.namespaces %}
12 | {{ gen(n) }}
13 | {% endfor %}
14 |
15 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/Interface.tpl:
--------------------------------------------------------------------------------
1 |
2 | {% for x in item.methods + item.properties + item.events %}
3 | {{ gen(x) }}
4 | {% endfor %}
5 |
6 | {# Definition of named structs and other datatypes have little meaning in D-Bus, but we can generate some comments about them: #}
7 | {% for x in item.structs %}
8 | {{gen(x)}}
9 | {% endfor %}
10 |
11 | {% for x in item.typedefs %}
12 | {{gen(x)}}
13 | {% endfor %}
14 |
15 | {% for x in item.enumerations %}
16 | {{gen(x)}}
17 | {% endfor %}
18 |
19 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_string_type.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2023";
9 |
10 | package proto2_unittest;
11 |
12 | import "google/protobuf/cpp_features.proto";
13 |
14 | message EntryProto {
15 | bytes value = 3 [features.(pb.cpp).string_type = CORD];
16 | }
17 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/Struct.tpl:
--------------------------------------------------------------------------------
1 | {% if item.description != None %}
2 |
3 | {% endif %}
4 |
5 |
6 | {% for m in item.members %}
7 | {% if m.description != None %}
8 |
9 | {% else %}
10 |
11 | {% endif %}
12 | {% endfor %}
13 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_lite_edition_2024.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2024";
9 |
10 | package proto2_unittest;
11 |
12 | option optimize_for = LITE_RUNTIME;
13 |
14 | enum EnumNameStringView {
15 | ENUM_NAME_STRING_VIEW_DEFAULT = 0;
16 | ENUM_NAME_STRING_VIEW_ANOTHER_VALUE = 1;
17 | }
18 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/late_loaded_option_user.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2023";
9 |
10 | package proto2_unittest;
11 |
12 | import "google/protobuf/late_loaded_option.proto";
13 |
14 | message LateLoadedOptionUser {
15 | option (proto2_unittest.LateLoadedOption.ext) = {
16 | value: 1
17 | };
18 | }
19 |
--------------------------------------------------------------------------------
/tests/testdefs/protobuf_in_out_roundtrip/proto_roundtrip.py:
--------------------------------------------------------------------------------
1 | # Simple round-trip to test both proto parser and output generator
2 | from ifex.models.protobuf import protobuf_lark as protobuf_parser
3 | from ifex.output_filters.protobuf import grpc_generator
4 | import os
5 |
6 | def proto_roundtrip(file):
7 | template_dir = os.path.join(os.path.dirname(grpc_generator.__file__), "templates")
8 | ast_root = protobuf_parser.get_ast_from_proto_file(file)
9 | generated = grpc_generator.ast_to_text(ast_root, template_dir)
10 | return generated
11 |
12 | if __name__ == '__main__':
13 | test_gen()
14 |
15 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_import_public.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | // Author: liujisi@google.com (Pherl Liu)
9 |
10 | syntax = "proto2";
11 |
12 | package proto2_unittest_import;
13 |
14 | option java_package = "com.google.protobuf.test";
15 |
16 | message PublicImportMessage {
17 | optional int32 e = 1;
18 | }
19 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/test_import_empty_srcs.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2023 Google LLC. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | syntax = "proto2";
9 |
10 | package upb_test;
11 |
12 | import "upb/test/test.proto";
13 | import "upb/test/test_cpp.proto";
14 |
15 | message ContainsImported {
16 | optional MessageName message_name = 1;
17 | optional upb.test.TestMessage test_message = 2;
18 | }
19 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/late_loaded_option.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2023";
9 |
10 | package proto2_unittest;
11 |
12 | import "google/protobuf/descriptor.proto";
13 |
14 | message LateLoadedOption {
15 | int32 value = 1;
16 |
17 | extend google.protobuf.MessageOptions {
18 | LateLoadedOption ext = 95126892;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_import_public_lite.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | // Author: liujisi@google.com (Pherl Liu)
9 |
10 | edition = "2023";
11 |
12 | package proto2_unittest_import;
13 |
14 | option optimize_for = LITE_RUNTIME;
15 | option java_package = "com.google.protobuf";
16 |
17 | message PublicImportMessageLite {
18 | int32 e = 1;
19 | }
20 |
--------------------------------------------------------------------------------
/docs/Dockerfile:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2025 Mercedes-Benz Tech Innovation GmbH
2 | # SPDX-License-Identifier: MPL-2.0
3 |
4 | # VitePress documentation server
5 | FROM node:24-bullseye-slim
6 |
7 | # Set the working directory
8 | WORKDIR /app
9 |
10 | COPY package*.json ./
11 |
12 | # Clean npm cache and install dependencies
13 | RUN npm cache clean --force && npm install --legacy-peer-deps
14 |
15 | # Copy the rest of the documentation files
16 | COPY . .
17 |
18 | # Expose the port VitePress uses
19 | EXPOSE 5173
20 |
21 | # Default command to run VitePress in dev mode
22 | CMD ["npm", "run", "docs:dev", "--", "--host", "0.0.0.0", "--port", "5173"]
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/test_cpp.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2023 Google LLC. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | syntax = "proto2";
9 |
10 | package upb.test;
11 |
12 | message TestMessage {
13 | optional int32 i32 = 1 [default = 5];
14 | repeated int32 r_i32 = 2;
15 | optional string str = 3 [default = "abc"];
16 | repeated string r_str = 4;
17 | optional TestMessage msg = 5;
18 | repeated TestMessage r_msg = 6;
19 | }
20 |
--------------------------------------------------------------------------------
/tests/generic_testrunner.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Execute generic_testrunner on each def found under testdefs/
4 |
5 | # Normalize current working directory
6 | cd "$(dirname "$0")"
7 |
8 | echo "Sourcing venv/bin/activate, if it exists"
9 | [ -x ../venv/bin/activate ] && . ../venv/bin/activate
10 |
11 | /bin/ls testdefs | while read x ; do
12 | if [ -d "testdefs/$x" ] ; then
13 | echo '================================================================================'
14 | echo "Testdef $x:"
15 | echo '================================================================================'
16 | python generic_testrunner.py "testdefs/$x"
17 | echo
18 | fi
19 | done
20 |
--------------------------------------------------------------------------------
/docs/developers-manual/index.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | This manual is useful primarily for implementation of new IFEX tools, but sometimes also for people who use the tools and then develop software based on the output that was generated to/from IFEX. Before reading the developers' manual, make sure you have read the [IFEX Core IDL specification](../specification/index.md) and [FAQ](../faq/index.md).
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/any_test.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | syntax = "proto3";
9 |
10 | package proto2_unittest;
11 |
12 | import "google/protobuf/any.proto";
13 |
14 | option java_outer_classname = "TestAnyProto";
15 |
16 | message TestAny {
17 | int32 int32_value = 1;
18 | google.protobuf.Any any_value = 2;
19 | repeated google.protobuf.Any repeated_any_value = 3;
20 | string text = 4;
21 | }
22 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/utf8_test_proto2.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2023 Google LLC. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | syntax = "proto2";
9 |
10 | package upb_test;
11 |
12 | message TestUtf8Proto2Bytes {
13 | optional bytes data = 1;
14 | }
15 |
16 | message TestUtf8RepeatedProto2Bytes {
17 | optional bytes data = 1;
18 | }
19 |
20 | message TestUtf8Proto2String {
21 | optional string data = 1;
22 | }
23 |
24 | message TestUtf8RepeatedProto2String {
25 | repeated string data = 1;
26 | }
27 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_legacy_features.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | // Test that features with legacy descriptor helpers get properly converted.
9 |
10 | edition = "2023";
11 |
12 | package legacy_features_unittest;
13 |
14 | message TestEditionsMessage {
15 | int32 required_field = 1 [features.field_presence = LEGACY_REQUIRED];
16 | TestEditionsMessage delimited_field = 2
17 | [features.message_encoding = DELIMITED];
18 | }
19 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/only_one_enum_test.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2023";
9 |
10 | package proto2_unittest;
11 |
12 | option optimize_for = LITE_RUNTIME;
13 |
14 | // A file with only a single enum, without any use of it.
15 | // This is useful for testing enum specific codegen that is not directly related
16 | // to field codegen.
17 |
18 | enum OnlyOneEnum {
19 | ONLY_ONE_ENUM_DEFAULT = 0;
20 | ONLY_ONE_ENUM_VALID = 10;
21 | }
22 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/Proto.j2:
--------------------------------------------------------------------------------
1 | {% if item.package %}
2 | package {{ item.package }};
3 |
4 | {% endif %}
5 | {% if item.imports %}
6 | {% for import in item.imports %}
7 | {{ gen(import) }}
8 | {% endfor %}
9 |
10 | {% endif %}
11 | {% if item.options %}
12 | {% for option in item.options %}
13 | {{ gen(option) }}
14 | {% endfor %}
15 |
16 | {% endif %}
17 | {% if item.messages %}
18 | {% for message in item.messages %}
19 | {{ gen(message) }}
20 | {% endfor %}
21 |
22 | {% endif %}
23 | {% if item.enums %}
24 | {% for enum in item.enums %}
25 | {{ gen(enum) }}
26 | {% endfor %}
27 |
28 | {% endif %}
29 | {% if item.services %}
30 | {% for service in item.services %}
31 | {{ gen(service) }}
32 | {% endfor %}
33 |
34 | {% endif %}
35 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_arena.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2023";
9 |
10 | package proto2_arena_unittest;
11 |
12 | // Use expanded encoding for repeated fields by default (proto2 behavior).
13 | option features.repeated_field_encoding = EXPANDED;
14 | option cc_enable_arenas = true;
15 |
16 | message NestedMessage {
17 | int32 d = 1;
18 | }
19 |
20 | message ArenaMessage {
21 | repeated NestedMessage repeated_nested_message = 1;
22 | }
23 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_proto3_extensions.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | syntax = "proto3";
9 |
10 | package protobuf_unittest;
11 |
12 | import "google/protobuf/descriptor.proto";
13 |
14 | option java_outer_classname = "UnittestProto3Extensions";
15 |
16 | // For testing proto3 extension behaviors.
17 | message Proto3FileExtensions {
18 | extend google.protobuf.FileOptions {
19 | int32 singular_int = 1001;
20 | repeated int32 repeated_int = 1002;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/docs/Dockerfile.generator:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2025 Mercedes-Benz Tech Innovation GmbH
2 | # SPDX-License-Identifier: MPL-2.0
3 |
4 | # Python-based container for generating documentation from IFEX models
5 | FROM python:3.11-slim
6 |
7 | # Set the working directory
8 | WORKDIR /app
9 |
10 | # Copy Python requirements and install dependencies
11 | COPY requirements*.txt ./
12 | RUN pip install --no-cache-dir -r requirements.txt && pip install --no-cache-dir -r requirements-dev.txt
13 |
14 | # Copy the entire IFEX project (needed for models imports)
15 | COPY . .
16 |
17 | # Set working directory to docs for output
18 | WORKDIR /app/docs
19 |
20 | # Default command runs the generation script with bash (no chmod needed)
21 | CMD ["bash", "generate-docs.sh"]
22 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/hello_dep.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package helloworld;
18 |
19 | message HelloDep {
20 | repeated int64 numbers = 1;
21 | }
22 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_invalid_features.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2023 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | syntax = "proto2";
9 |
10 | package pb;
11 |
12 | import "google/protobuf/descriptor.proto";
13 |
14 | extend google.protobuf.FeatureSet {
15 | optional TestInvalidFeatures test_invalid = 9996;
16 | }
17 |
18 | message TestInvalidFeatures {
19 | repeated int32 repeated_feature = 1 [
20 | retention = RETENTION_RUNTIME,
21 | targets = TARGET_TYPE_FIELD,
22 | edition_defaults = { edition: EDITION_2023, value: "3" }
23 | ];
24 | }
25 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/empty2.proto:
--------------------------------------------------------------------------------
1 |
2 | // Copyright 2016 gRPC authors.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 |
16 | syntax = "proto2";
17 |
18 | package grpc.testing.proto2;
19 |
20 | message EmptyWithExtensions {
21 | extensions 100 to 999;
22 | }
23 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/frame_fuzzer.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2021 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package frame_fuzzer;
18 |
19 | message Test {
20 | bytes header = 1;
21 | bytes payload = 2;
22 | }
23 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/simplest.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package simplest;
18 |
19 | message SimplestMessage {
20 | int64 i_definitely_dont_exist = 1;
21 | };
22 |
23 |
--------------------------------------------------------------------------------
/ifex/output_filters/protobuf/templates/Message.j2:
--------------------------------------------------------------------------------
1 | message {{ item.name }} {
2 | {% if item.enums %}
3 | {% for enum in item.enums %}
4 | {{ gen(enum) }}
5 | {% endfor %}
6 |
7 | {%- endif %}
8 | {% if item.fields %}
9 | {% for field in item.fields %}
10 | {{ gen(field) }}
11 | {%- endfor %}
12 |
13 | {%- endif %}
14 | {% if item.messages %}
15 | {% for msg in item.messages %}
16 | {{ gen(msg) }}
17 | {%- endfor %}
18 |
19 | {%- endif %}
20 | {% if item.options %}
21 | {% for option in item.options %}
22 | {{ gen(option) }}
23 | {%- endfor %}
24 |
25 | {% endif %}
26 | {% if item.oneofs %}
27 | {% for oneof in item.oneofs %}
28 | {{ gen(oneof) }}
29 | {%- endfor %}
30 |
31 | {%- endif %}
32 | {% if item.reservations %}
33 | {% for reserved in item.reservations %}
34 | {{ gen(reserved) }}
35 | {%- endfor %}
36 | {%- endif %}}
37 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/data.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2018 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc.testing.package_with_underscore.data;
18 |
19 | message Request {
20 | }
21 |
22 | message Response {
23 | }
24 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/package_options_import2.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2020 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc.foo;
18 |
19 | option ruby_package = "B::Other";
20 |
21 | message Foo {
22 | message Bar { }
23 | }
24 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/imported-with-dash.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2017 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | syntax = "proto3";
15 |
16 | package grpc.testing;
17 |
18 | option objc_class_prefix = "RMT";
19 |
20 | message TestMessageImported {
21 | int32 phony = 1;
22 | }
23 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/package_options_import.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc.testing;
18 |
19 | // For sanity checking package definitions
20 | option ruby_package = "A::Other";
21 |
22 | message Thing { }
23 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_lite_imports_nonlite.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | // Author: kenton@google.com (Kenton Varda)
9 | //
10 | // Tests that a "lite" message can import a regular message.
11 |
12 | syntax = "proto2";
13 |
14 | package proto2_unittest;
15 |
16 | import "google/protobuf/unittest.proto";
17 |
18 | option optimize_for = LITE_RUNTIME;
19 |
20 | message TestLiteImportsNonlite {
21 | optional TestAllTypes message = 1;
22 |
23 | // Verifies that transitive required fields generates valid code.
24 | optional TestRequired message_with_required = 2;
25 | }
26 |
--------------------------------------------------------------------------------
/distribution/entrypoints/protobuf_ifex.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2024 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
4 | # User-invocation script for protobuf-to-ifex
5 |
6 | from ifex.input_filters.protobuf import protobuf_to_ifex
7 | import argparse
8 |
9 | def protobuf_to_ifex_run():
10 |
11 | parser = argparse.ArgumentParser(description='Runs Protobuf to IFEX translator.')
12 | parser.add_argument('input', metavar='file.proto', type=str, help='path to input .proto file')
13 |
14 | try:
15 | args = parser.parse_args()
16 | proto_ast = protobuf_to_ifex.proto_ast_from_input(args.input)
17 | ifex_ast = protobuf_to_ifex.proto_to_ifex(proto_ast)
18 | print(protobuf_to_ifex.ifex_ast_as_yaml(ifex_ast))
19 |
20 | except Exception as e:
21 | print(f"ERROR: Conversion error resulting from {args.input}: {e}")
22 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/empty_service.proto:
--------------------------------------------------------------------------------
1 |
2 | // Copyright 2018 gRPC authors.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 |
16 | syntax = "proto3";
17 |
18 | package grpc.testing;
19 |
20 | // A service that has zero methods.
21 | // See https://github.com/grpc/grpc/issues/15574
22 | service EmptyService {
23 | }
24 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_no_generic_services.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | // Author: kenton@google.com (Kenton Varda)
9 |
10 | syntax = "proto2";
11 |
12 | package proto2_unittest.no_generic_services_test;
13 |
14 |
15 | // *_generic_services are false by default.
16 |
17 | message TestMessage {
18 | optional int32 a = 1;
19 | extensions 1000 to max;
20 | }
21 |
22 | enum TestEnum {
23 | FOO = 1;
24 | }
25 |
26 | extend TestMessage {
27 | optional int32 test_extension = 1000;
28 | }
29 |
30 | service TestService {
31 | rpc Foo(TestMessage) returns (TestMessage);
32 | }
33 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/simple_messages.proto:
--------------------------------------------------------------------------------
1 |
2 | // Copyright 2018 gRPC authors.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 |
16 | syntax = "proto3";
17 |
18 | package grpc.testing;
19 |
20 | message SimpleRequest {}
21 |
22 | message SimpleResponse {}
23 |
24 | message StringValue {
25 | string message = 1;
26 | }
27 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/bar.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package tests.unit.data.foo.bar;
18 |
19 | message BarMessage {
20 | string a = 1;
21 | };
22 |
23 | service Bar {
24 | rpc GetBar(BarMessage) returns (BarMessage);
25 | };
26 |
--------------------------------------------------------------------------------
/.github/workflows/containers.yml:
--------------------------------------------------------------------------------
1 | name: Container Tests
2 | on: [pull_request]
3 |
4 | jobs:
5 | build_and_test_containers:
6 | runs-on: ubuntu-22.04
7 | steps:
8 | - uses: actions/checkout@v2
9 |
10 | - name: Build containers
11 | run: |
12 | cd distribution/docker
13 | make build_alpine
14 | make build_ubuntu
15 |
16 | - name: Test Interactive Commands
17 | run: |
18 | cd distribution/docker
19 | variant=alpine make run_interactivity_test
20 | variant=ubuntu make run_interactivity_test_pyenv
21 |
22 | - name: Run unit tests in Ubuntu container
23 | run: |
24 | cd distribution/docker
25 | make run_ubuntu_test
26 |
27 | - name: Run unit tests in Alpine container
28 | run: |
29 | cd distribution/docker
30 | make run_alpine_test
31 |
32 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/same.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2016 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc_protoc_plugin.invocation_testing;
18 |
19 | message Request {}
20 | message Response {}
21 |
22 | service TestService {
23 | rpc Call(Request) returns (Response);
24 | }
25 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/simpler.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | // Copyright 2020 The gRPC authors.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 |
17 | package simpler;
18 |
19 | import "simplest.proto";
20 |
21 | message SimplerMessage {
22 | int64 do_i_even_exist = 1;
23 | simplest.SimplestMessage simplest_message = 2;
24 | };
25 |
26 |
--------------------------------------------------------------------------------
/helpers/README.md:
--------------------------------------------------------------------------------
1 | # Helpers
2 |
3 | This directory contains tools that are developed outside of the IFEX project but are useful to process either the input or output files that are involved in the translation or code generation created by the IFEX tools.
4 |
5 | The purpose is to make it easy to access useful companion tools for IFEX processing and in some cases they are required parts of processing pipelines. It can be things like linters, formatters and compilers.
6 |
7 | The inclusion of these tools into the IFEX git repository should be light-weight and could use different methods, such as:
8 |
9 | - A git submodule referencing the git repository for the program
10 | - A script that helps to download and install the program
11 | - A document that explains how to manually find and install the program
12 |
13 | Configuration files (typical for linters, formatters, etc.) might also be included near each tool.
14 |
15 |
--------------------------------------------------------------------------------
/scripts/install_python_version_in_pyenv.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -x
2 |
3 | # SPDX-FileCopyrightText: Copyright (c) 2023 Novaspring AB
4 | # SPDX-License-Identifier: MPL-2.0
5 | #
6 | # This file is part of IFEX project
7 | # ---------------------------------------------------------------------------
8 |
9 | # Go to project directory
10 | cd "$(dirname "$0")"
11 | cd ..
12 |
13 | if [ -z "$1" ] ; then
14 | echo "usage: $0 "
15 | exit 1
16 | fi
17 |
18 | # Fallback version is local to this file, and basically the setup is buggy if it needs to be used.
19 | FALLBACK_VERSION=3.10.10
20 | VERSION=${1:-$FALLBACK_VERSION}
21 |
22 | # initialize standard pyenv environment
23 | export PYENV_ROOT="$HOME/.pyenv"
24 | command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
25 | eval "$(pyenv init -)"
26 |
27 | # Install the required version using pyenv.
28 | pyenv install --skip-existing $VERSION
29 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/same_package_service_name.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2020 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package same_name;
18 |
19 | service SameName {
20 | rpc Health(Request) returns (Status);
21 | }
22 |
23 | message Status {
24 | string msg = 1;
25 | }
26 |
27 | message Request {}
28 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/service.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2018 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc.testing.package_with_underscore.service;
18 |
19 | import "package_with_underscore/data.proto";
20 |
21 | service MyService {
22 | rpc TestOne(data.Request) returns (data.Response) {}
23 | }
24 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/test-dash-filename.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2017 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | syntax = "proto3";
15 |
16 | package grpc.testing;
17 |
18 | option objc_class_prefix = "RMT";
19 |
20 | import "imported-with-dash.proto";
21 |
22 | message TestMessage {
23 | int32 phony = 1;
24 | }
25 |
26 | service PhonyService {
27 | }
28 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/editions_test.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2023 Google LLC. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2023";
9 |
10 | package upb.test_2023;
11 |
12 | message EditionsMessage {
13 | int32 plain_field = 1;
14 | int32 implicit_presence_field = 2 [features.field_presence = IMPLICIT];
15 | int32 required_field = 3 [features.field_presence = LEGACY_REQUIRED];
16 | EditionsMessage delimited_field = 4 [features.message_encoding = DELIMITED];
17 | EditionsEnum enum_field = 5;
18 | repeated int32 unpacked_field = 6
19 | [features.repeated_field_encoding = EXPANDED];
20 | }
21 |
22 | enum EditionsEnum {
23 | option features.enum_type = CLOSED;
24 |
25 | ONE = 1;
26 | }
27 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/requests.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2015 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package tests_of_grpc_testing;
18 |
19 | message Up {
20 | int32 first_up_field = 1;
21 | }
22 |
23 | message Charm {
24 | int32 first_charm_field = 1;
25 | }
26 |
27 | message Top {
28 | int32 first_top_field = 1;
29 | }
30 |
--------------------------------------------------------------------------------
/distribution/entrypoints/generator_dbus.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2023 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
4 | # User-invocation script for D-Bus generation
5 | # (small wrapper around the main implementation)
6 |
7 | from ifex.models.ifex.ifex_parser import get_ast_from_yaml_file
8 | from ifex.output_filters.DBus import dbus_generator
9 | import argparse, dacite
10 |
11 | def ifex_dbus_generator_run():
12 | parser = argparse.ArgumentParser(description='Runs IFEX to D-Bus XML translator.')
13 | parser.add_argument('input', metavar='ifex-input-file', type=str, help='path to input IFEX (YAML) file')
14 |
15 | try:
16 | args = parser.parse_args()
17 | dbus_generator.main_generate(args.input)
18 |
19 | except dacite.UnexpectedDataError as e:
20 | print(f"ERROR: Read error resulting from {filename}: {e}")
21 |
22 | if __name__ == "__main__":
23 | ifex_dbus_generator_run()
24 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/complicated.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package test.complicated;
18 |
19 | import "simplest.proto";
20 |
21 | message ComplicatedMessage {
22 | bool yes = 1;
23 | bool no = 2;
24 | bool why = 3;
25 | simplest.SimplestMessage simplest_message = 4;
26 | };
27 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_extension_set.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | // Author: kenton@google.com (Kenton Varda)
9 | // Based on original Protocol Buffers design by
10 | // Sanjay Ghemawat, Jeff Dean, and others.
11 | //
12 | // This file contains messages for testing extensions.
13 |
14 | syntax = "proto2";
15 |
16 | package proto2_unittest;
17 |
18 | option optimize_for = SPEED;
19 | option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
20 |
21 | // A message with message_set_wire_format.
22 | message TestExtensionSet {
23 | extensions 4 to max;
24 | }
25 |
26 | message TestExtensionSetContainer {
27 | optional TestExtensionSet extension = 1;
28 | }
29 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/same_ruby_package_service_name.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2020 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package other_name;
18 |
19 | option ruby_package = "SameName2";
20 |
21 | service SameName2 {
22 | rpc Health(Request) returns (Status);
23 | }
24 |
25 | message Status {
26 | string msg = 1;
27 | }
28 |
29 | message Request {}
30 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_import_lite.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | // Author: kenton@google.com (Kenton Varda)
9 | //
10 | // This is like unittest_import.proto but with optimize_for = LITE_RUNTIME.
11 |
12 | edition = "2023";
13 |
14 | package proto2_unittest_import;
15 |
16 | import public "google/protobuf/unittest_import_public_lite.proto";
17 |
18 | option optimize_for = LITE_RUNTIME;
19 | option java_package = "com.google.protobuf";
20 |
21 | message ImportMessageLite {
22 | int32 d = 1;
23 | }
24 |
25 | enum ImportEnumLite {
26 | option features.enum_type = CLOSED;
27 |
28 | IMPORT_LITE_FOO = 7;
29 | IMPORT_LITE_BAR = 8;
30 | IMPORT_LITE_BAZ = 9;
31 | }
32 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/m_double_2d.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 The gRPC Authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc_tools_tests.integration_tests.test_characters_in_name_numbers;
18 |
19 | message MDouble2D
20 | {
21 | double x = 1;
22 | double y = 2;
23 | }
24 |
25 | service MyService {
26 | rpc MyFunction (MDouble2D) returns (MDouble2D) {}
27 | }
28 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/bar_with_wkt.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package tests.unit.data.foo.bar;
18 |
19 | import "google/protobuf/any.proto";
20 |
21 | message BarMessage {
22 | string a = 1;
23 | google.protobuf.Any b = 2;
24 | };
25 |
26 | service Bar {
27 | rpc GetBar(BarMessage) returns (BarMessage);
28 | };
29 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/channel_args_fuzzer.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2022 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package channel_args;
18 |
19 | message ResourceQuota {}
20 |
21 | message ChannelArg {
22 | string key = 1;
23 | oneof value {
24 | string str = 2;
25 | int64 i = 3;
26 | ResourceQuota resource_quota = 4;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/testcodegen.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The gRPC Authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | // Test that codegen works well in case the .csproj has .proto files
16 | // of the same name, but under different directories (see #17672).
17 | syntax = "proto3";
18 |
19 | package grpc_csharp_distribtest.duplicate_proto;
20 |
21 | message MessageFromDuplicateProto {
22 | string name = 1;
23 | }
24 |
--------------------------------------------------------------------------------
/ifex/output_filters/schema/pretty_print_json.py:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: MPL-2.0
2 |
3 | # =======================================================================
4 | # (C) 2023 MBition GmbH
5 | # Author: Gunnar Andersson
6 | #
7 | # This Source Code Form is subject to the terms of the Mozilla Public
8 | # License, v. 2.0. If a copy of the MPL was not distributed with this
9 | # file, You can obtain one at https://mozilla.org/MPL/2.0/.
10 | # =======================================================================
11 |
12 |
13 | """
14 | Read JSON, dump it out in pretty/indented format
15 | """
16 |
17 | # Generally I prefer the 'jq' tool for this but it seems more consistent
18 | # to use a python solution even if it means adding json package as a new
19 | # dependency.
20 |
21 | import json
22 | import sys
23 |
24 | # Not much error-checking here. Just use it correctly.
25 | input_file = sys.argv[1]
26 | with open(input_file, 'r') as file:
27 | print(json.dumps(json.load(file), indent=2))
28 |
--------------------------------------------------------------------------------
/ifex/models/protobuf/README.md:
--------------------------------------------------------------------------------
1 | # Protobuf parser/input processing
2 |
3 | ## Dependencies:
4 | - Lark parser framework
5 |
6 | ## Files
7 | - `protobuf.grammar` - Protobuf syntax definition in Lark format
8 | - `protobuf_lark.py` - Input parser, creates Protobuf AST
9 | - `protobuf_ast.py` - Dataclass definitions for a Protobuf AST
10 |
11 | ## How to run
12 |
13 | Go to input_filters/protobuf directory to find the converter.
14 |
15 | For simple conversions or tests, the protobuf_to_ifex.py has a main method and
16 | can be run as a script directly. It will print out the result as IFEX Core IDL
17 | in YAML text:
18 |
19 | ```
20 | python protobuf_to_ifex.py
21 | ```
22 |
23 | For developing on top of this module, for example in a direct translation to other format without the IFEX text format as an intermediiate: Import and use the function `proto_ast_from_input(protofile)` followed by `protobuf_to_ifex(proto_ast)` on that result. The latter returns an IFEX AST that can be further processed.
24 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/package_options.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2018 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc.testing;
18 |
19 | // For sanity checking package definitions
20 | option ruby_package = "Grpc.Testing.Package.Options";
21 |
22 | message TestRequest { }
23 |
24 | message TestResponse { }
25 |
26 | service TestService {
27 | rpc GetTest(TestRequest) returns (TestResponse) { }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/unary_stream_benchmark.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 The gRPC Authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | syntax = "proto3";
15 |
16 | message BenchmarkRequest {
17 | int32 message_size = 1;
18 | int32 response_count = 2;
19 | }
20 |
21 | message BenchmarkResponse {
22 | bytes response = 1;
23 | }
24 |
25 | service UnaryStreamBenchmarkService {
26 | rpc Benchmark(BenchmarkRequest) returns (stream BenchmarkResponse);
27 | }
28 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/namespaced_dependency.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | option java_multiple_files = true;
18 | option java_package = "io.grpc.examples.namespaced";
19 | option java_outer_classname = "NamespacedDependencyProtos";
20 | option objc_class_prefix = "NEP";
21 |
22 | package upper.example;
23 |
24 |
25 | message NamespacedDependency {
26 | int32 value = 1;
27 | }
28 |
--------------------------------------------------------------------------------
/docs/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2025 Mercedes-Benz Tech Innovation GmbH
2 | # SPDX-License-Identifier: MPL-2.0
3 | services:
4 | generate-docs:
5 | build:
6 | context: .. # Build from parent directory to access Python modules
7 | dockerfile: docs/Dockerfile.generator
8 | volumes:
9 | - .:/app/docs # Mount docs folder for output
10 | working_dir: /app/docs
11 |
12 | vitepress:
13 | build:
14 | context: .
15 | dockerfile: Dockerfile
16 | ports:
17 | - "5173:5173"
18 | volumes:
19 | - .:/app
20 | - /app/node_modules
21 | command: npm run docs:dev -- --host 0.0.0.0 --port 5173
22 | depends_on:
23 | generate-docs:
24 | condition: service_completed_successfully
25 |
26 | preview:
27 | build:
28 | context: .
29 | dockerfile: Dockerfile
30 | ports:
31 | - "4173:4173"
32 | volumes:
33 | - .:/app
34 | - /app/node_modules
35 | command: npm run docs:preview -- --host 0.0.0.0 --port 4173
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/clientonly.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 The gRPC Authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc_tools_tests.integration_tests.test_grpc_services;
18 |
19 | import "messages.proto";
20 |
21 | // For testing client only code generation.
22 | service ClientOnly {
23 | // Sends a greeting
24 | rpc SayHello (HelloRequest) returns (HelloReply) {}
25 | rpc SayHelloSlowly (HelloRequest) returns (HelloReply) {}
26 | }
27 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/echo.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2015 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package echo;
18 |
19 | service EchoServer {
20 | rpc Echo (EchoRequest) returns (EchoReply) {}
21 | }
22 |
23 | // The request message containing the user's name.
24 | message EchoRequest {
25 | string request = 1;
26 | }
27 |
28 | // The response message containing the greetings
29 | message EchoReply {
30 | string response = 1;
31 | }
32 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/serveronly.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 The gRPC Authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc_tools_tests.integration_tests.test_grpc_services;
18 |
19 | import "messages.proto";
20 |
21 | // For testing server only code generation.
22 | service ServerOnly {
23 | // Sends a greeting
24 | rpc SayHello (HelloRequest) returns (HelloReply) {}
25 | rpc SayHelloSlowly (HelloRequest) returns (HelloReply) {}
26 | }
27 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/end2end_test_fuzzer.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package core_end2end_test_fuzzer;
18 |
19 | import "test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto";
20 | import "test/core/test_util/fuzz_config_vars.proto";
21 |
22 | message Msg {
23 | fuzzing_event_engine.Actions event_engine_actions = 10;
24 | grpc.testing.FuzzConfigVars config_vars = 11;
25 | }
26 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/fuzzer.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package yodel;
18 |
19 | import "test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto";
20 | import "test/core/test_util/fuzz_config_vars.proto";
21 |
22 | message Msg {
23 | fuzzing_event_engine.Actions event_engine_actions = 10;
24 | grpc.testing.FuzzConfigVars config_vars = 11;
25 | repeated uint64 rng = 12;
26 | }
27 |
--------------------------------------------------------------------------------
/scripts/install_pyenv.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -x
2 |
3 | # SPDX-FileCopyrightText: Copyright (c) 2023 Novaspring AB
4 | # SPDX-License-Identifier: MPL-2.0
5 | #
6 | # This file is part of IFEX project
7 | # ---------------------------------------------------------------------------
8 |
9 | # Installation as documented at: https://github.com/pyenv/pyenv#readme
10 | # BUT(!) obviously running a script downloaded from the internet can be risky.
11 | # We use it primarily in setting up development containers but that does not
12 | # make it risk-free.
13 |
14 | # Use this automated method at your own risk. Otherwise, study the script
15 | # first, or take other measures to install the required tools!
16 |
17 | curl https://pyenv.run | sh
18 |
19 | grep -Fq PYENV_ROOT "$HOME/.bashrc" || {
20 | echo 'NOTE! Adding PYENV setup to $HOME/.bashrc!'
21 | touch "$HOME/.bashrc"
22 | cat <<"EOT" >>"$HOME/.bashrc"
23 | # pyenv environment
24 | export PYENV_ROOT="$HOME/.pyenv"
25 | command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
26 | eval "$(pyenv init -)"
27 | EOT
28 | }
29 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/clientandserver.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 The gRPC Authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc_tools_tests.integration_tests.test_grpc_services;
18 |
19 | import "messages.proto";
20 |
21 | // For testing client and server code generation.
22 | service ClientAndServer {
23 | // Sends a greeting
24 | rpc SayHello (HelloRequest) returns (HelloReply) {}
25 | rpc SayHelloSlowly (HelloRequest) returns (HelloReply) {}
26 | }
27 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/greet.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2022 The gRPC Authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | option csharp_namespace = "GrpcGreeter";
18 |
19 | package grpc_tools_tests.integration_tests.test_proto_outside_project;
20 |
21 | service Greeter {
22 | rpc SayHello (Greet.HelloRequest) returns (Greet.HelloReply);
23 | }
24 |
25 | message HelloRequest {
26 | string name = 1;
27 | }
28 |
29 | message HelloReply {
30 | string message = 1;
31 | }
32 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/map_proto3_unittest.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2023";
9 |
10 | // Treat all fields as implicit present by default (proto3 behavior).
11 | option features.field_presence = IMPLICIT;
12 |
13 | // This file contains definitions that have different behavior in proto3.
14 |
15 | // We don't put this in a package within proto2 because we need to make sure
16 | // that the generated code doesn't depend on being in the proto2 namespace.
17 | // In map_test_util.h we do "using namespace unittest = proto2_unittest".
18 | package proto3_unittest;
19 |
20 | message TestProto3BytesMap {
21 | map map_bytes = 1;
22 | map map_string = 2;
23 | }
24 |
25 | message TestI32StrMap {
26 | map m_32_str = 1;
27 | }
28 |
--------------------------------------------------------------------------------
/ifex/layer_types/ValueConstraint/example.ilay:
--------------------------------------------------------------------------------
1 | namespaces:
2 | - name: _
3 | interface:
4 | name: MyTimedProperties
5 | methods:
6 | - name: special_method
7 | input:
8 | - name: important_value
9 | min_value: -4.714
10 | max_value: -4.512
11 | output:
12 | # Example '*' wildcard = match all names. Constrain all output parameters
13 | # to < 400 (obviously this assumes they are all number types)
14 | - name: '*'
15 | min_value: 400
16 | returns:
17 | - name: constrainted_return_value
18 | min_value: 1
19 | max_value: 2
20 | events:
21 | - name: temp_alert
22 | input:
23 | # Example: Name not specified => Match *all* input arguments with the Temperature
24 | - datatype: Temperature
25 | min_value: -273.15
26 |
27 | properties:
28 | - name: '*'
29 | min_value: 2ms
30 | max_value: 10ms
31 | action: log
32 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/subpackage.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2021 The gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | option java_multiple_files = true;
18 | option java_package = "io.grpc.examples.subpackage";
19 | option java_outer_classname = "SubpackageProto";
20 | option objc_class_prefix = "SP";
21 |
22 | package subpackage;
23 |
24 | import "proto/my.proto";
25 |
26 | message Subpackaged {
27 | string name = 1;
28 | somewhere_else.MyMessage msg = 2;
29 | }
30 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/fuzzing_channel_args.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc.testing;
18 |
19 | message ResourceQuota {}
20 |
21 | message FuzzingChannelArg {
22 | string key = 1;
23 | oneof value {
24 | string str = 2;
25 | int64 i = 3;
26 | ResourceQuota resource_quota = 4;
27 | }
28 | }
29 |
30 | message FuzzingChannelArgs {
31 | repeated FuzzingChannelArg args = 1;
32 | }
33 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/required_fields_test.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2023 Google LLC. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | syntax = "proto2";
9 |
10 | package upb_util_test;
11 |
12 | message EmptyMessage {}
13 |
14 | message HasRequiredField {
15 | required int32 required_int32 = 1;
16 | }
17 |
18 | message TestRequiredFields {
19 | required EmptyMessage required_message = 1;
20 | optional TestRequiredFields optional_message = 2;
21 | repeated HasRequiredField repeated_message = 3;
22 | map map_int32_message = 4;
23 | map map_int64_message = 5;
24 | map map_uint32_message = 6;
25 | map map_uint64_message = 7;
26 | map map_bool_message = 8;
27 | map map_string_message = 9;
28 | }
29 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/echo_duplicate.proto:
--------------------------------------------------------------------------------
1 |
2 | // Copyright 2015 gRPC authors.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 |
16 | // This is a partial copy of echo.proto with a different package name.
17 |
18 | syntax = "proto3";
19 |
20 | import "src/proto/grpc/testing/echo_messages.proto";
21 |
22 | package grpc.testing.duplicate;
23 |
24 | service EchoTestService {
25 | rpc Echo(grpc.testing.EchoRequest) returns (grpc.testing.EchoResponse);
26 | rpc ResponseStream(EchoRequest) returns (stream EchoResponse);
27 | }
28 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/proto3_test.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2023 Google LLC. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | syntax = "proto3";
9 |
10 | package upb.test;
11 |
12 | import "google/protobuf/descriptor.proto";
13 |
14 | extend google.protobuf.MessageOptions {
15 | optional string my_option = 51235;
16 | }
17 |
18 | message MyMessage3 {
19 | option (my_option) = "Hello world!";
20 | }
21 |
22 | message TestMessage3 {
23 | optional int32 i32 = 1;
24 | repeated int32 r_i32 = 2;
25 | optional string str = 3;
26 | repeated string r_str = 4;
27 | optional TestMessage3 msg = 5;
28 | repeated TestMessage3 r_msg = 6;
29 | }
30 |
31 | // See the InitialFieldOneOf test in test_mini_table_oneof.cc.
32 | message TestOneOfInitialField {
33 | oneof oneof_field {
34 | int32 a = 1;
35 | uint32 b = 2;
36 | }
37 |
38 | float c = 3;
39 | }
40 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_preserve_unknown_enum2.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2023";
9 |
10 | package proto2_preserve_unknown_enum_unittest;
11 |
12 | // Treat all enums as closed and use expanded encoding for repeated fields by
13 | // default (proto2 behavior).
14 | option features.enum_type = CLOSED;
15 | option features.repeated_field_encoding = EXPANDED;
16 |
17 | enum MyEnum {
18 | FOO = 0;
19 | BAR = 1;
20 | BAZ = 2;
21 | }
22 |
23 | message MyMessage {
24 | MyEnum e = 1;
25 | repeated MyEnum repeated_e = 2;
26 | repeated MyEnum repeated_packed_e = 3
27 | [features.repeated_field_encoding = PACKED];
28 | repeated MyEnum repeated_packed_unexpected_e = 4; // not packed
29 | oneof o {
30 | MyEnum oneof_e_1 = 5;
31 | MyEnum oneof_e_2 = 6;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_drop_unknown_fields.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2023";
9 |
10 | package unittest_drop_unknown_fields;
11 |
12 | // Treat all fields as implicit present by default (proto3 behavior).
13 | option features.field_presence = IMPLICIT;
14 | option objc_class_prefix = "DropUnknowns";
15 | option csharp_namespace = "Google.Protobuf.TestProtos";
16 |
17 | message Foo {
18 | enum NestedEnum {
19 | FOO = 0;
20 | BAR = 1;
21 | BAZ = 2;
22 | }
23 | int32 int32_value = 1;
24 | NestedEnum enum_value = 2;
25 | }
26 |
27 | message FooWithExtraFields {
28 | enum NestedEnum {
29 | FOO = 0;
30 | BAR = 1;
31 | BAZ = 2;
32 | MOO = 3;
33 | }
34 | int32 int32_value = 1;
35 | NestedEnum enum_value = 2;
36 | int32 extra_int32_value = 3;
37 | }
38 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/empty.proto:
--------------------------------------------------------------------------------
1 |
2 | // Copyright 2015 gRPC authors.
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 |
16 | syntax = "proto3";
17 |
18 | package grpc.testing;
19 |
20 | // An empty message that you can re-use to avoid defining duplicated empty
21 | // messages in your project. A typical example is to use it as argument or the
22 | // return value of a service API. For instance:
23 | //
24 | // service Foo {
25 | // rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { };
26 | // };
27 | //
28 | message Empty {}
29 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/empty2_extensions.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2016 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto2";
16 |
17 | import "src/proto/grpc/testing/proto2/empty2.proto";
18 |
19 | package grpc.testing.proto2;
20 |
21 | // Fill emptiness with music.
22 | extend grpc.testing.proto2.EmptyWithExtensions {
23 | optional int64 Deadmau5 = 124;
24 | optional float Madeon = 125;
25 | optional string AboveAndBeyond = 126;
26 | optional bool Tycho = 127;
27 | optional fixed64 Pendulum = 128;
28 | }
29 |
--------------------------------------------------------------------------------
/tests/test.ifex.variant/input.yaml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2022 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
4 | name: named_service
5 | description: This is it.
6 | major_version: 3
7 | minor_version: 0
8 |
9 | namespaces:
10 | - name: first_nested
11 | description: first namespace description
12 |
13 | methods:
14 | - name: another_method
15 | description: this is yet another sample method
16 | input:
17 | - name: arg1
18 | datatype: variant
19 |
20 | structs:
21 | - name: MyStruct
22 | members:
23 | - name: x
24 | datatype: uint32
25 | - name: y
26 | datatype: string
27 |
28 | typedefs:
29 | - name: MyVariant
30 | description: Test of typedefed variant
31 | datatypes:
32 | - MyStruct
33 | - string
34 | - uint32
35 | - name: MyVariant2
36 | description: Test 2 of typedefed variant
37 | datatype: variant
38 |
39 |
--------------------------------------------------------------------------------
/docs/developers-manual/mapping-documents/index.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | # Mapping documents
8 |
9 | By "mapping" we mean to describe how we may interpret and ultimately translate IFEX to or from another interface description environment, or a particular output format (computing environment, protocol, programming language, etc.). It can be such things as listing the "features" of IFEX and seeing how we may implement those features in the target environment (or the opposite direction, listing the features of the other environment and how IFEX can meet them).
10 |
11 | General documents describe our general strategy for approaching mappings.
12 |
13 | Individual documents describe particular target (or source) standards.
14 |
15 | - [D-Bus](./d-bus.md)
16 | - [Protobuf/gRPC](./static-mapping-protobuf.md)
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/report_qps_scenario_service.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2015 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | // An integration test service that covers all the method signature permutations
16 | // of unary/streaming requests/responses.
17 | syntax = "proto3";
18 |
19 | import "src/proto/grpc/testing/control.proto";
20 |
21 | package grpc.testing;
22 |
23 | service ReportQpsScenarioService {
24 | // Report results of a QPS test benchmark scenario.
25 | rpc ReportScenario(ScenarioResult) returns (Void);
26 | }
27 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/fuzz_config_vars.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | //
16 | // Automatically generated by tools/codegen/core/gen_config_vars.py
17 | //
18 |
19 | syntax = "proto3";
20 |
21 | package grpc.testing;
22 |
23 | message FuzzConfigVars {
24 | optional bool enable_fork_support = 61008869;
25 | optional string dns_resolver = 76817901;
26 | optional string verbosity = 68420950;
27 | optional string experiments = 510817011;
28 | optional string trace = 291231137;
29 | };
30 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/proxy-service.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2017 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | import "src/proto/grpc/testing/control.proto";
18 | import "src/proto/grpc/testing/stats.proto";
19 |
20 | package grpc.testing;
21 |
22 | message ProxyStat {
23 | double latency = 1;
24 | }
25 |
26 | service ProxyClientService {
27 | rpc GetConfig(Void) returns (ClientConfig);
28 | rpc ReportTime(stream ProxyStat) returns (Void);
29 | rpc ReportHist(stream HistogramData) returns (Void);
30 | }
31 |
32 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/test_responses.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2015 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | import "tests/protoc_plugin/protos/payload/test_payload.proto";
18 |
19 | package grpc_protoc_plugin;
20 |
21 | message SimpleResponse {
22 | Payload payload = 1;
23 | }
24 |
25 | message StreamingInputCallResponse {
26 | // Aggregated size of payloads received from the client.
27 | int32 aggregated_payload_size = 1;
28 | }
29 |
30 | message StreamingOutputCallResponse {
31 | Payload payload = 1;
32 | }
33 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/client_control.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2015 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package client_control;
18 |
19 | service ClientController {
20 | rpc DoEchoRpc (DoEchoRpcRequest) returns (Void) {}
21 | rpc Shutdown(Void) returns (Void) {}
22 | }
23 |
24 | message DoEchoRpcRequest {
25 | string request = 1;
26 | }
27 |
28 | message Void{}
29 |
30 | service ParentController {
31 | rpc SetClientControllerPort(Port) returns (Void) {}
32 | }
33 |
34 | message Port {
35 | int32 port = 1;
36 | }
37 |
--------------------------------------------------------------------------------
/helpers/test_convert_uservices.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # A small test script to use https://github.com/COVESA/uservices
4 | # as a quite comprehensive input test suite, (it is defined in protobuf/gRPC IDL)
5 | # and convert as much as possible using the protobuf/grpc->IFEX converter
6 |
7 | # Normalize current directory
8 | cd "$(dirname "$0")"
9 |
10 | P2I=../input_filters/protobuf_to_ifex.py
11 |
12 | # Clone if not existing
13 | if [ ! -d uservices ] ; then
14 | (set -x ; git clone https://github.com/COVESA/uservices)
15 | fi
16 |
17 | rm -f .failed .ok
18 | touch .failed .ok
19 | rm -rf .output
20 | mkdir -p .output
21 |
22 | echo "Running protobuf_to_ifex on all uservices proto files"
23 | find uservices/ -name '*.proto' | while read f ; do
24 | echo "=== $f ==="
25 | ifexname="$(echo "$(basename "$f")" | sed 's/.proto/.ifex/g')"
26 | python $P2I "$f" >".output/$ifexname"
27 | if [ $? -eq 0 ] ; then
28 | echo "$f" >>.ok
29 | else
30 | echo "$f" >>.failed
31 | fi
32 | done
33 |
34 | # Results
35 | echo "Success:"
36 | cat .ok
37 | echo
38 | echo "Fail:"
39 | cat .failed
40 |
41 | echo "Result files are in .output/"
42 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/required_fields_editions_test.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2023 Google LLC. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2023";
9 |
10 | package upb_util_2023_test;
11 |
12 | message EmptyMessage {}
13 |
14 | message HasRequiredField {
15 | int32 required_int32 = 1 [features.field_presence = LEGACY_REQUIRED];
16 | }
17 |
18 | message TestRequiredFields {
19 | EmptyMessage required_message = 1 [features.field_presence = LEGACY_REQUIRED];
20 | TestRequiredFields optional_message = 2;
21 | repeated HasRequiredField repeated_message = 3;
22 | map map_int32_message = 4;
23 | map map_int64_message = 5;
24 | map map_uint32_message = 6;
25 | map map_uint64_message = 7;
26 | map map_bool_message = 8;
27 | map map_string_message = 9;
28 | }
29 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_embed_optimize_for.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | // Author: kenton@google.com (Kenton Varda)
9 | // Based on original Protocol Buffers design by
10 | // Sanjay Ghemawat, Jeff Dean, and others.
11 | //
12 | // A proto file which imports a proto file that uses optimize_for = CODE_SIZE.
13 |
14 | syntax = "proto2";
15 |
16 | package proto2_unittest;
17 |
18 | import "google/protobuf/unittest_optimize_for.proto";
19 |
20 | // We optimize for speed here, but we are importing a proto that is optimized
21 | // for code size.
22 | option optimize_for = SPEED;
23 |
24 | message TestEmbedOptimizedForSize {
25 | // Test that embedding a message which has optimize_for = CODE_SIZE into
26 | // one optimized for speed works.
27 | optional TestOptimizedForSize optional_message = 1;
28 | repeated TestOptimizedForSize repeated_message = 2;
29 | }
30 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/keyvaluestore.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2018 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package keyvaluestore;
18 |
19 | // A simple key-value storage service
20 | service KeyValueStore {
21 | // Provides a value for each key request
22 | rpc GetValues (stream Request) returns (stream Response) {}
23 | }
24 |
25 | // The request message containing the key
26 | message Request {
27 | string key = 1;
28 | }
29 |
30 | // The response message containing the value associated with the key
31 | message Response {
32 | string value = 1;
33 | }
34 |
--------------------------------------------------------------------------------
/scripts/docker_ifexgen:
--------------------------------------------------------------------------------
1 | #!/bin/sh -e
2 |
3 | # SPDX-FileCopyrightText: Copyright (c) 2023 Novaspring AB
4 | # SPDX-License-Identifier: MPL-2.0
5 | #
6 | # This file is part of IFEX project
7 | # ---------------------------------------------------------------------------
8 |
9 | IMAGE_NAME=ifex_local/ifex_alpine
10 | CTR_NAME=ifex-docker
11 |
12 | # Normalize directory location
13 | cd "$(dirname "$0")" # (the directory this script is in)
14 | cd ..
15 |
16 | command="$(basename "$0")"
17 | case $command in
18 | docker_ifexgen)
19 | runcmd=ifexgen ;;
20 | docker_ifexgen_dbus)
21 | runcmd=ifexgen_dbus ;;
22 | *)
23 | echo FAIL && exit 1 ;;
24 | esac
25 |
26 | if ! docker images | grep -F -q "$IMAGE_NAME"; then
27 | echo Image never built from Dockerfile -- building...
28 | cd docker && make build
29 | fi
30 |
31 | if docker ps -a | grep -F -q "$CTR_NAME"; then
32 | echo Removing old container $CTR_NAME
33 | docker rm "$CTR_NAME"
34 | fi
35 |
36 | # SELINUX required flag
37 | fgrep -Fq redhat /etc/os-release && ZFLAG=:z || ZFLAG=
38 |
39 | set -x
40 | docker run --rm -ti -v $PWD:/work${ZFLAG} --name "$CTR_NAME" "$IMAGE_NAME" /ifex/venv/bin/$runcmd "$@"
41 |
42 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/test_payload.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2016 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc_protoc_plugin;
18 |
19 | enum PayloadType {
20 | // Compressable text format.
21 | COMPRESSABLE= 0;
22 |
23 | // Uncompressable binary format.
24 | UNCOMPRESSABLE = 1;
25 |
26 | // Randomly chosen from all other formats defined in this enum.
27 | RANDOM = 2;
28 | }
29 |
30 | message Payload {
31 | PayloadType payload_type = 1;
32 | oneof payload_body {
33 | string payload_compressable = 2;
34 | bytes payload_uncompressable = 3;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/prime.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package prime;
18 |
19 | // A candidate integer for primality testing.
20 | message PrimeCandidate {
21 | // The candidate.
22 | int64 candidate = 1;
23 | }
24 |
25 | // The primality of the requested integer candidate.
26 | message Primality {
27 | // Is the candidate prime?
28 | bool isPrime = 1;
29 | }
30 |
31 | // Service to check primality.
32 | service PrimeChecker {
33 | // Determines the primality of an integer.
34 | rpc check (PrimeCandidate) returns (Primality) {}
35 | }
36 |
--------------------------------------------------------------------------------
/scripts/pyenv_run_test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh -xe
2 |
3 | # SPDX-FileCopyrightText: Copyright (c) 2023 Novaspring AB
4 | # SPDX-License-Identifier: MPL-2.0
5 | #
6 | # This file is part of IFEX project
7 | # ---------------------------------------------------------------------------
8 |
9 | # Normalize directory location
10 | cd "$(dirname "$0")" # (the directory this script is in)
11 | cd ..
12 |
13 | PYTHON_VERSION=$(cat .python-version)
14 |
15 | # This is a simple script that will set up a virtual python environment and run
16 | # the test suite in one operation.
17 |
18 | # Set up python environment install prerequisites and the IFEX module itself
19 | python -m venv venv
20 | set +x
21 | source venv/bin/activate
22 | set -x
23 | pyenv install --skip-existing $PYTHON_VERSION
24 | pyenv local $PYTHON_VERSION
25 | python -m pip install -r requirements.txt
26 | python -m pip install pyyaml jinja2 pytest anytree
27 |
28 | # Run setup.py but via pip, to install IFEX module in develop mode
29 | pip install --editable . # (a.k.a. setup.py develop mode)
30 |
31 | # Let's check
32 | python --version
33 |
34 | # Run specifically only our own tests. (Sometimes other modules with tests are in the working directory)
35 | pytest tests/
36 |
37 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_string_view.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2023";
9 |
10 | package proto2_unittest;
11 |
12 | import "google/protobuf/cpp_features.proto";
13 |
14 | option java_multiple_files = true;
15 | option optimize_for = SPEED;
16 | option features.(pb.cpp).string_type = VIEW;
17 |
18 | // NEXT_TAG = 6;
19 | message TestStringView {
20 | string singular_string = 1;
21 | bytes singular_bytes = 2;
22 | string implicit_presence = 5 [features.field_presence = IMPLICIT];
23 |
24 | repeated string repeated_string = 3;
25 | repeated bytes repeated_bytes = 4;
26 | }
27 |
28 | message TestStringViewExtension {
29 | extensions 1 to max;
30 | }
31 |
32 | extend TestStringViewExtension {
33 | string singular_string_view_extension = 1;
34 | bytes singular_bytes_view_extension = 2;
35 |
36 | repeated string repeated_string_view_extension = 3;
37 | repeated bytes repeated_bytes_view_extension = 4;
38 | }
39 |
--------------------------------------------------------------------------------
/tests/README.md:
--------------------------------------------------------------------------------
1 | This directory contains tests to be run by pytest
2 |
3 | To run them, it should be possible to run pytest in the project root:
4 | ```bash
5 | $ pytest -v
6 | ```
7 |
8 | The gen_test.py file will run a few basic tests and it will also run
9 | generation tests defined in subdirectories with the following name patterns
10 | through individual tests:
11 | ```
12 | test.
13 | exception.test.
14 | ```
15 |
16 | In each of these directories, three files are expected:
17 |
18 | ```
19 | input.yml
20 | template
21 | result
22 | ```
23 |
24 | (Actually, in the exception case, the result is actually not needed since
25 | it is supposed to fail before comparing the result)
26 |
27 | The code will read `input.yml` and generate output using `template`, and then
28 | compare it to `result`.
29 |
30 | Directories named `test.` are required to successfully generate
31 | something that is identical to `result`
32 |
33 | Directories named `exception.test.` are expected to throw an
34 | exception during parsing. In other words a failure during parsing means a
35 | successful test, and otherwise the test fails. (Future change: possibly
36 | support exceptions during generation stage also).
37 |
38 |
39 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/avl_fuzzer.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2021 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package avl_fuzzer;
18 |
19 | message Empty{}
20 |
21 | message Action {
22 | int32 key = 1;
23 | oneof action {
24 | int32 set = 2;
25 | Empty get = 3;
26 | Empty del = 4;
27 | }
28 | }
29 |
30 | message KeyValue {
31 | int32 key = 1;
32 | int32 value = 2;
33 | }
34 |
35 | message Compares {
36 | repeated KeyValue left = 1;
37 | repeated KeyValue right = 2;
38 | }
39 |
40 | message Msg {
41 | repeated Action actions = 2;
42 | repeated Compares compares = 3;
43 | }
44 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/D-Bus/Method.tpl:
--------------------------------------------------------------------------------
1 | {% if item.description != None %}
2 | {# Here is how real doc tags can be created #}
3 | {# But comments are enough if the XML will not be used to generated docs #}
4 | {# {{item.description.strip(" \t\n")}} #}
5 |
6 | {% endif %}
7 |
8 |
9 | {% for arg in item.input %}
10 | {% if arg.description != None %}
11 |
12 | {% endif %}
13 |
14 | {% endfor %}
15 |
16 | {% for arg in item.output %}
17 | {% if arg.description != None %}
18 |
19 | {% endif %}
20 |
21 | {% endfor %}
22 |
23 | {% for arg in item.errors %}
24 | {% if arg.description != None %}
25 |
26 | {% else %}
27 |
28 | {% endif %}
29 | {% endfor %}
30 |
31 |
32 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/simple.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package simple;
18 |
19 | import "simpler.proto";
20 |
21 | message SimpleMessage {
22 | string msg = 1;
23 | oneof personal_or_business {
24 | bool personal = 2;
25 | bool business = 3;
26 | };
27 | simpler.SimplerMessage simpler_message = 4;
28 | };
29 |
30 | message SimpleMessageRequest {
31 | SimpleMessage simple_msg = 1;
32 | };
33 |
34 | message SimpleMessageResponse {
35 | bool understood = 1;
36 | };
37 |
38 | service SimpleMessageService {
39 | rpc Tell(SimpleMessageRequest) returns (SimpleMessageResponse);
40 | };
41 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/fuzzing_event_engine.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2021 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package fuzzing_event_engine;
18 |
19 | message Actions {
20 | reserved 1;
21 | // How much to delay each task by, in nanoseconds.
22 | repeated uint64 run_delay = 2;
23 | // Order in which to bind port numbers.
24 | // After this ports are assigned in order, from 1 to 65535.
25 | repeated uint32 assign_ports = 3;
26 | // Write size constraints for each connection, in order of creation.
27 | repeated Connection connections = 4;
28 | };
29 |
30 | message Connection {
31 | repeated uint32 write_size = 1;
32 | };
33 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/second.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2022 The gRPC Authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc_tools_tests.integration_tests.test_multiple_protos.second;
18 |
19 | // The greeting service definition.
20 | service Greeter {
21 | // Sends a greeting
22 | rpc SayHello (HelloRequest) returns (HelloReply) {}
23 | rpc SayHelloSlowly (HelloRequest) returns (HelloReply) {}
24 | }
25 |
26 | // The request message containing the user's name.
27 | message HelloRequest {
28 | string name = 1;
29 | int32 delay = 2;
30 | }
31 |
32 | // The response message containing the greetings
33 | message HelloReply {
34 | string message = 1;
35 | }
36 |
--------------------------------------------------------------------------------
/helpers/dbus/c++/sdbus-c++-xml2cpp/README.md:
--------------------------------------------------------------------------------
1 | # sdbus-c++-xml2cpp
2 |
3 | This is a code generator from the
4 | [sdbus-cpp](https://github.com/Kistler-Group/sdbus-cpp) project.
5 |
6 | **sdbus-cpp** is a C++ binding for D-Bus, which is layered on top of sdbus, a
7 | D-Bus implementation by the systemd project.
8 |
9 | **sdbus-c++-xml2cpp** translates a D-Bus interface description in D-Bus
10 | introspection format (XML) into C++ proxy and adapter/stub code.
11 |
12 | For **IFEX** this means we do not need to generate C++ code to interface with a
13 | D-Bus library like sdbus - instead the D-Bus XML introspection format is
14 | generated from IFEX to describe the interface, and a code generator like this
15 | one can then be used to get C++ code.
16 |
17 | This directory contains only a container description to compile and "package"
18 | the `sdbus-c++-xml2cpp` tool into something that can be run with docker.
19 | Alternatively, the `build.sh` script can be reused in another setup. It
20 | encodes the few commands to compile the `sdbus-cpp` project, specifically with
21 | the code generator included. The script does not install the dependencies
22 | needed to compile sdbus-cpp since that requires distro-specific commands
23 | anyway => Look at the Dockerfile for what is needed.
24 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/another.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2022 The gRPC Authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc_tools_tests.integration_tests.test_multiple_protos.another;
18 |
19 | // The greeting service definition.
20 | service Greeter {
21 | // Sends a greeting
22 | rpc SayHello (HelloRequest) returns (HelloReply) {}
23 | rpc SayHelloSlowly (HelloRequest) returns (HelloReply) {}
24 | }
25 |
26 | // The request message containing the user's name.
27 | message HelloRequest {
28 | string name = 1;
29 | int32 delay = 2;
30 | }
31 |
32 | // The response message containing the greetings
33 | message HelloReply {
34 | string message = 1;
35 | }
36 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/hello.world.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2022 The gRPC Authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc_tools_tests.integration_tests.test_characters_in_name_dot;
18 |
19 | // The greeting service definition.
20 | service Greeter {
21 | // Sends a greeting
22 | rpc SayHello (HelloRequest) returns (HelloReply) {}
23 | rpc SayHelloSlowly (HelloRequest) returns (HelloReply) {}
24 | }
25 |
26 | // The request message containing the user's name.
27 | message HelloRequest {
28 | string name = 1;
29 | int32 delay = 2;
30 | }
31 |
32 | // The response message containing the greetings
33 | message HelloReply {
34 | string message = 1;
35 | }
36 |
--------------------------------------------------------------------------------
/docs/index.md:
--------------------------------------------------------------------------------
1 | ---
2 | layout: home
3 |
4 | hero:
5 | name: "Interface Exchange Framework (IFEX)"
6 | text: "Swiss army knife for interfaces"
7 | tagline: "For unifying interfaces and streamlining integration with other IDL and transformation technology."
8 | actions:
9 | - theme: brand
10 | text: Getting started
11 | link: /specification
12 | - theme: alt
13 | text: FAQ
14 | link: /faq
15 |
16 | features:
17 | - title: Versatile IDL
18 | details: The IDL can be used as a one-and-all source format for interface definitions. The flexible core model with its composable layers makes it a strong candidate for being the most capable interface description available.
19 | icon: 🛠️
20 | - title: Layered extensibility
21 | details: "Provides a flexible mechanism for extending interface definitions through composable layers, ensuring compatibility with various tools and protocols while maintaining a clean separation of concerns."
22 | icon: 🧩
23 | - title: "Unified transformation technology"
24 | details: "Enables seamless integration and translation between different IDLs with tools designed to support popular IPC/RPC protocols and diverse deployment technologies, simplifying system integration."
25 | icon: 🔄
26 | ---
27 |
28 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/depnothing.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package test.csharp.codegen.simple.proto.depnothing;
18 |
19 | // The greeting service definition - with nothing deprecated
20 | service Greeter {
21 | // Sends a greeting
22 | rpc SayHello (HelloRequest) returns (HelloReply) {}
23 |
24 | rpc SayHelloStreamReply (HelloRequest) returns (stream HelloReply) {}
25 | }
26 |
27 | // The request message containing the user's name.
28 | message HelloRequest {
29 | string name = 1;
30 | }
31 |
32 | // The response message containing the greetings
33 | message HelloReply {
34 | string message = 1;
35 | }
36 |
37 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/compiler.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2022 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | import "google/protobuf/any.proto";
18 | import "google/protobuf/api.proto";
19 | import "google/protobuf/compiler/plugin.proto";
20 | import "google/protobuf/descriptor.proto";
21 | import "google/protobuf/duration.proto";
22 | import "google/protobuf/empty.proto";
23 | import "google/protobuf/field_mask.proto";
24 | import "google/protobuf/source_context.proto";
25 | import "google/protobuf/struct.proto";
26 | import "google/protobuf/timestamp.proto";
27 | import "google/protobuf/type.proto";
28 | import "google/protobuf/wrappers.proto";
29 |
30 | package test_compiler;
31 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/hpack_parser_fuzzer.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2021 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package hpack_parser_fuzzer;
18 |
19 | import "test/core/test_util/fuzz_config_vars.proto";
20 |
21 | message Empty {}
22 |
23 | message Frame {
24 | bool end_of_headers = 1;
25 | bool end_of_stream = 2;
26 | bool priority = 3;
27 | int32 stop_buffering_after_segments = 4;
28 | int32 max_metadata_length = 5;
29 | repeated bytes parse = 6;
30 | int32 absolute_max_metadata_length = 7;
31 | }
32 |
33 | message Msg {
34 | repeated Frame frames = 2;
35 | grpc.testing.FuzzConfigVars config_vars = 3;
36 | repeated uint64 random_numbers = 4;
37 | }
38 |
--------------------------------------------------------------------------------
/ifex/output_filters/README.md:
--------------------------------------------------------------------------------
1 | # generators directory
2 |
3 | This directory is intended to host output (generation) implementations for
4 | different code programming languages and description formats.
5 |
6 | It is only required to implement new generators for 'advanced' cases that need
7 | to some intermediate to advanced logic in python code. Some simple cases might
8 | be possible to generate using the generic `ifexgen` binary, combined with
9 | output (jinja) templates.
10 |
11 | Sometimes simple logic is already emedded in jinja-templates, like this for
12 | example: `{% for x in list %} ... {% endfor %}`, and also simple if-conditionals.
13 |
14 | It is however recommended to use separate python modules for advanced cases.
15 | For all cases that require a particular set of input files (for example
16 | additional input layers), it is at minimum needed to make a new python file to
17 | act as an entry-point (executable) for that type of output. The same python
18 | file, or related modules, can provide useful helper functions that the
19 | jinja-templates can call.
20 |
21 | ## See also
22 |
23 | Simpler formats can be created directly with the generic generator (`ifexgen`)
24 | and jinja-templates only -- the templates can be found in their associated
25 | sub-directory below `templates/`.
26 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/namespacetest.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package test.csharp.codegen.basenamespace.test;
18 |
19 | option csharp_namespace = "Example.V1.CodegenTest";
20 |
21 | // The greeting service definition.
22 | service Greeter {
23 | // Sends a greeting
24 | rpc SayHello (HelloRequest) returns (HelloReply) {}
25 |
26 | rpc SayHelloStreamReply (HelloRequest) returns (stream HelloReply) {}
27 | }
28 |
29 | // The request message containing the user's name.
30 | message HelloRequest {
31 | string name = 1;
32 | }
33 |
34 | // The response message containing the greetings
35 | message HelloReply {
36 | string message = 1;
37 | }
38 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/payloads.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2015 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc.testing;
18 |
19 | message ByteBufferParams {
20 | int32 req_size = 1;
21 | int32 resp_size = 2;
22 | }
23 |
24 | message SimpleProtoParams {
25 | int32 req_size = 1;
26 | int32 resp_size = 2;
27 | }
28 |
29 | message ComplexProtoParams {
30 | // TODO (vpai): Fill this in once the details of complex, representative
31 | // protos are decided
32 | }
33 |
34 | message PayloadConfig {
35 | oneof payload {
36 | ByteBufferParams bytebuf_params = 1;
37 | SimpleProtoParams simple_params = 2;
38 | ComplexProtoParams complex_params = 3;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/depservice.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package test.csharp.codegen.simple.proto.depservice;
18 |
19 | // Service with service-level deprecation
20 | service GreeterServiceLevelDep {
21 | option deprecated = true; // service level option
22 | // Sends a greeting
23 | rpc SayHello (HelloRequest) returns (HelloReply) {}
24 |
25 | rpc SayHelloStreamReply (HelloRequest) returns (stream HelloReply) {}
26 | }
27 |
28 | // The request message containing the user's name.
29 | message HelloRequest {
30 | string name = 1;
31 | }
32 |
33 | // The response message containing the greetings
34 | message HelloReply {
35 | string message = 1;
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/hellostreamingworld.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2015 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | option java_package = "ex.grpc";
18 | option objc_class_prefix = "HSW";
19 |
20 | package hellostreamingworld;
21 |
22 | // The greeting service definition.
23 | service MultiGreeter {
24 | // Sends multiple greetings
25 | rpc sayHello (HelloRequest) returns (stream HelloReply) {}
26 | }
27 |
28 | // The request message containing the user's name and how many greetings
29 | // they want.
30 | message HelloRequest {
31 | string name = 1;
32 | string num_greetings = 2;
33 | }
34 |
35 | // A response message containing a greeting
36 | message HelloReply {
37 | string message = 1;
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/services.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2017 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | import "tests/testing/proto/requests.proto";
18 |
19 | package tests_of_grpc_testing;
20 |
21 | message Down {
22 | int32 first_down_field = 1;
23 | }
24 |
25 | message Strange {
26 | int32 first_strange_field = 1;
27 | }
28 |
29 | message Bottom {
30 | int32 first_bottom_field = 1;
31 | }
32 |
33 | service FirstService {
34 | rpc UnUn(Up) returns (Down);
35 | rpc UnStre(Charm) returns (stream Strange);
36 | rpc StreUn(stream Charm) returns (Strange);
37 | rpc StreStre(stream Top) returns (stream Bottom);
38 | }
39 |
40 | service SecondService {
41 | rpc UnStre(Strange) returns (stream Charm);
42 | }
43 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/work_queue_fuzzer.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2022 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | syntax = "proto3";
15 |
16 | package work_queue_fuzzer;
17 |
18 | enum CallbackType {
19 | CALLBACK_TYPE_CLOSURE = 0;
20 | CALLBACK_TYPE_ANY_INVOCABLE = 1;
21 | }
22 |
23 | message Add {
24 | CallbackType type = 1;
25 | int32 key = 2;
26 | }
27 |
28 | message PopMostRecent {
29 | }
30 |
31 | message PopOldest {
32 | }
33 |
34 | message Empty {
35 | }
36 |
37 | message Action {
38 | oneof action_type {
39 | Add add = 1;
40 | PopMostRecent pop_most_recent = 2;
41 | PopOldest pop_oldest = 3;
42 | Empty empty = 4;
43 | }
44 | }
45 |
46 | message Msg {
47 | repeated Action actions = 1;
48 | }
49 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_optimize_for.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | // Author: kenton@google.com (Kenton Varda)
9 | // Based on original Protocol Buffers design by
10 | // Sanjay Ghemawat, Jeff Dean, and others.
11 | //
12 | // A proto file which uses optimize_for = CODE_SIZE.
13 |
14 | syntax = "proto2";
15 |
16 | package proto2_unittest;
17 |
18 | import "google/protobuf/unittest.proto";
19 |
20 | option optimize_for = CODE_SIZE;
21 |
22 | message TestOptimizedForSize {
23 | optional int32 i = 1;
24 | optional ForeignMessage msg = 19;
25 |
26 | extensions 1000 to max;
27 |
28 | extend TestOptimizedForSize {
29 | optional int32 test_extension = 1234;
30 | optional TestRequiredOptimizedForSize test_extension2 = 1235;
31 | }
32 |
33 | oneof foo {
34 | int32 integer_field = 2;
35 | string string_field = 3;
36 | }
37 | }
38 |
39 | message TestRequiredOptimizedForSize {
40 | required int32 x = 1;
41 | }
42 |
43 | message TestOptionalOptimizedForSize {
44 | optional TestRequiredOptimizedForSize o = 1;
45 | }
46 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_mset_wire_format.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | // Author: kenton@google.com (Kenton Varda)
9 | // Based on original Protocol Buffers design by
10 | // Sanjay Ghemawat, Jeff Dean, and others.
11 | //
12 | // This file contains messages for testing message_set_wire_format.
13 |
14 | syntax = "proto2";
15 |
16 | package proto2_wireformat_unittest;
17 |
18 | option cc_enable_arenas = true;
19 | option optimize_for = SPEED;
20 | option csharp_namespace = "Google.ProtocolBuffers.TestProtos";
21 |
22 | // A message with message_set_wire_format.
23 | message TestMessageSet {
24 | option message_set_wire_format = true;
25 |
26 | extensions 4 to 529999999;
27 |
28 | extensions 530000000 to max
29 | [declaration = {
30 | number: 1952731290,
31 | full_name: ".proto2_unittest_v1api.TestMessageSetExtension3.message_set_extension",
32 | type: ".proto2_unittest_v1api.TestMessageSetExtension3"
33 | }];
34 | }
35 |
36 | message TestMessageSetWireFormatContainer {
37 | optional TestMessageSet message_set = 1;
38 | }
39 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/depmethod.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package test.csharp.codegen.simple.proto.depmethod;
18 |
19 | // Service with method deprecation
20 | service GreeterMethodLevelDep {
21 | // Sends a greeting - method is deprecated
22 | rpc SayHello (HelloRequest) returns (HelloReply) {
23 | option deprecated = true; // method level option
24 | }
25 |
26 | rpc SayHelloStreamReply (HelloRequest) returns (stream HelloReply) {}
27 | }
28 |
29 | // The request message containing the user's name.
30 | message HelloRequest {
31 | string name = 1;
32 | }
33 |
34 | // The response message containing the greetings
35 | message HelloReply {
36 | string message = 1;
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/file.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2022 The gRPC Authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | // This file has the same name as another proto file but
18 | // in a different directory
19 |
20 | package grpc_tools_tests.integration_tests.test_multiple_protos.duplicate_name;
21 |
22 | // The greeting service definition.
23 | service Greeter {
24 | // Sends a greeting
25 | rpc SayHello (HelloRequest) returns (HelloReply) {}
26 | rpc SayHelloSlowly (HelloRequest) returns (HelloReply) {}
27 | }
28 |
29 | // The request message containing the user's name.
30 | message HelloRequest {
31 | string name = 1;
32 | int32 delay = 2;
33 | }
34 |
35 | // The response message containing the greetings
36 | message HelloReply {
37 | string message = 1;
38 | }
39 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/inter_activity_mutex_test.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2025 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package inter_activity_mutex_test;
18 |
19 | message Op {
20 | message Poll {
21 | uint32 id = 1;
22 | }
23 |
24 | message Drop {
25 | uint32 id = 1;
26 | }
27 |
28 | message Acquire {
29 | uint32 id = 1;
30 | }
31 |
32 | message AcquireWhen {
33 | uint32 id = 1;
34 | uint32 when = 2;
35 | }
36 |
37 | message DropLock {}
38 |
39 | message SetLock {
40 | uint32 value = 1;
41 | }
42 |
43 | oneof type {
44 | Poll poll = 1;
45 | Drop drop = 2;
46 | Acquire acquire = 3;
47 | AcquireWhen acquire_when = 4;
48 | DropLock drop_lock = 5;
49 | SetLock set_lock = 6;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/docs/create-toc.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | import sys, os, re
4 |
5 | def h_to_link(h, n):
6 | hashes = '#' * n
7 | m = re.search('^' + hashes + ' (.*)', h)
8 | if m:
9 | text = m[1]
10 | indent = ' ' * 4 * (n-1)
11 | # lower case, remove non-alphabetic and replace space with -
12 | link = "".join(c for c in text if c.isalpha() or c == ' ').lower().replace(' ','-')
13 | # If we used a : in the heading, remove it from TOC because it looks bad
14 | return f"{indent}- [{text.rstrip(':')}](#{link}) "
15 | return None
16 |
17 | # Read given file, or from STDIN
18 | if len(sys.argv) == 1:
19 | lines = sys.stdin.readlines()
20 | else:
21 | with open(sys.argv[1], "r") as f:
22 | lines = f.readlines()
23 |
24 | # Remove code blocks so that # inside code is not misinterpreted as a heading:
25 | nocode_lines = []
26 | in_block = False
27 | for line in lines:
28 | if line.startswith('```'):
29 | in_block = not in_block
30 | if not in_block:
31 | nocode_lines.append(line)
32 |
33 | headings = [h for h in nocode_lines if re.search('^#', h)]
34 |
35 | import subprocess
36 | print(f"Documentation generated from: {subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode('utf-8')}")
37 |
38 | for tocline in [h_to_link(h, n) for h in headings for n in range(1,5) if h_to_link(h, n)]:
39 | print(tocline)
40 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/auth_sample.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2015 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc.testing;
18 |
19 | option objc_class_prefix = "AUTH";
20 |
21 | // Unary request.
22 | message Request {
23 | // Whether Response should include username.
24 | bool fill_username = 4;
25 |
26 | // Whether Response should include OAuth scope.
27 | bool fill_oauth_scope = 5;
28 | }
29 |
30 | // Unary response, as configured by the request.
31 | message Response {
32 | // The user the request came from, for verifying authentication was
33 | // successful.
34 | string username = 2;
35 | // OAuth scope.
36 | string oauth_scope = 3;
37 | }
38 |
39 | service TestService {
40 | // One request followed by one response.
41 | rpc UnaryCall(Request) returns (Response);
42 | }
43 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/utf8_test.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2023 Google LLC. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | syntax = "proto3";
9 |
10 | package upb_test;
11 |
12 | message TestUtf8Bytes {
13 | optional bytes data = 1;
14 | }
15 |
16 | message TestUtf8Proto3String {
17 | optional string data = 1;
18 | }
19 |
20 | message TestUtf8RepeatedProto3String {
21 | repeated string data = 1;
22 | }
23 |
24 | // copybara:strip_begin(enforce_utf8 option is not respected in OSS)
25 | message TestUtf8Proto3StringMixed {
26 | optional string data = 1;
27 |
28 | // Add other fields with different enforce_utf8 values, to ensure we can
29 | // handle the mix.
30 | optional string other_data = 2;
31 | }
32 |
33 | message TestUtf8Proto3StringEnforceUtf8False {
34 | optional string data = 1;
35 | }
36 |
37 | message TestUtf8RepeatedProto3StringEnforceUtf8False {
38 | repeated string data = 1;
39 | }
40 |
41 | message TestUtf8Proto3StringEnforceUtf8FalseMixed {
42 | optional string data = 1;
43 |
44 | // Add other fields with different enforce_utf8 values, to ensure we can
45 | // handle the mix.
46 | optional string other_data = 2;
47 | }
48 | // copybara:strip_end
49 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/namespaced_example.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | option java_multiple_files = true;
18 | option java_package = "io.grpc.examples.namespaced";
19 | option java_outer_classname = "NamespacedExampleProtos";
20 | option objc_class_prefix = "NEP";
21 |
22 | package upper.example;
23 |
24 | // TODO: dependencies are still broken
25 | // Need to do something like this: https://packaging.python.org/guides/packaging-namespace-packages/
26 | // import "upper/example/namespaced_dependency.proto";
27 |
28 | message NamespacedExample {
29 | string value = 1;
30 |
31 | // TODO: dependencies are still broken
32 | // NamespacedDependency dependency = 2;
33 | }
34 |
35 | service NamespacedService {
36 | rpc SayHello (NamespacedExample) returns (NamespacedExample) {}
37 | }
38 |
39 |
--------------------------------------------------------------------------------
/distribution/docker/Dockerfile.alpine:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2023 Novaspring AB
2 | # SPDX-License-Identifier: MPL-2.0
3 | #
4 | # This file is part of IFEX project
5 | # ---------------------------------------------------------------------------
6 |
7 | # Official python image has an alpine-based version. It's easiest to
8 | # use it directly instead of building from source with pyenv.
9 | FROM python:3.12-alpine
10 |
11 | # Install extras
12 | RUN apk add sudo bash
13 |
14 | # Prepare user
15 | RUN addgroup ifex
16 | RUN adduser -D -G ifex ifex
17 | RUN adduser ifex wheel
18 |
19 | # Prepare directories
20 | RUN mkdir /ifex /work
21 |
22 | # Python packages are installed in virtual environment under /ifex
23 | COPY . /ifex
24 | WORKDIR /ifex
25 | RUN python -m venv venv
26 | RUN chown -R ifex:ifex /ifex /home/ifex
27 | USER ifex
28 | RUN . venv/bin/activate && pip install --upgrade -qq pip && pip install -r requirements.txt && pip install -r requirements-dev.txt
29 | RUN . venv/bin/activate && pip install -e .
30 |
31 | # Test that binaries can be found
32 | RUN . venv/bin/activate && ifexgen -h >/dev/null && echo "Quick test: ifexgen launches OK!"
33 | RUN . venv/bin/activate && ifexgen_dbus -h >/dev/null && echo "Quick test: ifexgen_dbus launches OK!"
34 |
35 | # Make sure venv is enabled when starting interactive bash
36 | COPY scripts/bashrc.venv /home/ifex/.bashrc
37 |
38 | # /work should be bind-mounted when container is started
39 | WORKDIR /work
40 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/package_options_ruby_style.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2019 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc.testing;
18 |
19 | import "grpc/testing/package_options_import.proto";
20 | import "grpc/testing/package_options_import2.proto";
21 |
22 | // For sanity checking package definitions
23 | option ruby_package = "RPC::Test::New::Package::Options";
24 |
25 | message AnotherTestRequest { }
26 |
27 | message AnotherTestResponse { }
28 |
29 | message Foo { }
30 |
31 | message Bar {
32 | message Baz { }
33 | }
34 |
35 | service AnotherTestService {
36 | rpc GetTest(AnotherTestRequest) returns (AnotherTestResponse) { }
37 | rpc OtherTest(Thing) returns (Thing) { }
38 | rpc PackageTest(grpc.testing.Thing) returns (grpc.foo.Foo.Bar) { }
39 | rpc FooTest(Foo) returns (Foo) { }
40 | rpc NestedMessageTest(Foo) returns (Bar.Baz) { }
41 | }
42 |
--------------------------------------------------------------------------------
/distribution/entrypoints/generator.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2022 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
4 | from ifex.models.ifex.ifex_generator import jinja_env
5 | from ifex.models.ifex.ifex_generator import gen
6 | from ifex.models.ifex.ifex_parser import get_ast_from_yaml_file
7 | import argparse, dacite
8 |
9 | def ifex_generator_run():
10 | parser = argparse.ArgumentParser(description='Runs generic IFEX code generator with given template(s).')
11 | parser.add_argument('input', metavar='ifex-input-file', type=str, help='path to input IFEX (YAML) file')
12 | parser.add_argument('-d','--template-directory', dest='templatedir', metavar='templates-dir-name', type=str, required=True,
13 | help='choose output type by stating the template directory, as an absolute path or a sub-directory of templates/')
14 | parser.add_argument('template', metavar='root-template', type=str, nargs='?',
15 | help='Top-level template file name (default : first file starting with AST_....)')
16 |
17 | try:
18 | args = parser.parse_args()
19 | except dacite.UnexpectedDataError as e:
20 | print(f"ERROR: Read error resulting from {filename}: {e}")
21 |
22 | ast = get_ast_from_yaml_file(args.input)
23 |
24 | jinja_env.__init__(args.templatedir)
25 | jinja_env.set_template_env( gen=gen )
26 | print(gen(ast))
27 |
28 |
29 | if __name__ == "__main__":
30 | ifex_generator_run()
31 |
--------------------------------------------------------------------------------
/DCO.txt:
--------------------------------------------------------------------------------
1 | Developer Certificate of Origin
2 | Version 1.1
3 |
4 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
5 |
6 | Everyone is permitted to copy and distribute verbatim copies of this
7 | license document, but changing it is not allowed.
8 |
9 |
10 | Developer's Certificate of Origin 1.1
11 |
12 | By making a contribution to this project, I certify that:
13 |
14 | (a) The contribution was created in whole or in part by me and I
15 | have the right to submit it under the open source license
16 | indicated in the file; or
17 |
18 | (b) The contribution is based upon previous work that, to the best
19 | of my knowledge, is covered under an appropriate open source
20 | license and I have the right under that license to submit that
21 | work with modifications, whether created in whole or in part
22 | by me, under the same open source license (unless I am
23 | permitted to submit under a different license), as indicated
24 | in the file; or
25 |
26 | (c) The contribution was provided directly to me by some other
27 | person who certified (a), (b) or (c) and I have not modified
28 | it.
29 |
30 | (d) I understand and agree that this project and the contribution
31 | are public and that a record of the contribution (including all
32 | personal information I submit with it, including my sign-off) is
33 | maintained indefinitely and may be redistributed consistent with
34 | this project or the open source license(s) involved.
35 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/chunked_vector_fuzzer.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2021 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | syntax = "proto3";
15 |
16 | package chunked_vector_fuzzer;
17 |
18 | message EmplaceBack {
19 | int32 vector = 1;
20 | int32 value = 2;
21 | }
22 |
23 | message PopBack {
24 | int32 vector = 1;
25 | }
26 |
27 | message Copy {
28 | int32 from = 1;
29 | int32 to = 2;
30 | }
31 |
32 | message ClearVector {
33 | int32 vector = 1;
34 | }
35 |
36 | message RemoveIf {
37 | int32 vector = 1;
38 | int32 value = 2;
39 | }
40 |
41 | message Action {
42 | oneof action_type {
43 | EmplaceBack emplace_back = 1;
44 | PopBack pop_back = 2;
45 | Copy copy = 3;
46 | Copy move = 4;
47 | ClearVector clear = 5;
48 | Copy swap = 6;
49 | RemoveIf remove_if = 7;
50 | }
51 | }
52 |
53 | message Msg {
54 | repeated Action actions = 1;
55 | }
56 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_preserve_unknown_enum.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | edition = "2023";
9 |
10 | package proto3_preserve_unknown_enum_unittest;
11 |
12 | // Treat all fields as implicit present by default (proto3 behavior).
13 | option features.field_presence = IMPLICIT;
14 | option objc_class_prefix = "UnknownEnums";
15 | option csharp_namespace = "Google.Protobuf.TestProtos";
16 |
17 | enum MyEnum {
18 | FOO = 0;
19 | BAR = 1;
20 | BAZ = 2;
21 | }
22 |
23 | enum MyEnumPlusExtra {
24 | E_FOO = 0;
25 | E_BAR = 1;
26 | E_BAZ = 2;
27 | E_EXTRA = 3;
28 | }
29 |
30 | message MyMessage {
31 | MyEnum e = 1;
32 | repeated MyEnum repeated_e = 2;
33 | repeated MyEnum repeated_packed_e = 3;
34 | repeated MyEnumPlusExtra repeated_packed_unexpected_e = 4; // not packed
35 | oneof o {
36 | MyEnum oneof_e_1 = 5;
37 | MyEnum oneof_e_2 = 6;
38 | }
39 | }
40 |
41 | message MyMessagePlusExtra {
42 | MyEnumPlusExtra e = 1;
43 | repeated MyEnumPlusExtra repeated_e = 2;
44 | repeated MyEnumPlusExtra repeated_packed_e = 3;
45 | repeated MyEnumPlusExtra repeated_packed_unexpected_e = 4;
46 | oneof o {
47 | MyEnumPlusExtra oneof_e_1 = 5;
48 | MyEnumPlusExtra oneof_e_2 = 6;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/.github/workflows/docs.yml:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2025 Mercedes-Benz Tech Innovation GmbH
2 | # SPDX-License-Identifier: MPL-2.0
3 |
4 | name: Build Documentation
5 |
6 | on:
7 | workflow_dispatch:
8 | push:
9 | branches: [ master ]
10 | pull_request:
11 | branches: [ master ]
12 |
13 | concurrency:
14 | group: ${{ github.event.repository.name }}-${{ github.workflow }}
15 | cancel-in-progress: true
16 |
17 | jobs:
18 | build-docs:
19 | runs-on: ubuntu-latest
20 |
21 | steps:
22 | - name: Checkout repository
23 | uses: actions/checkout@v4
24 |
25 | - name: Setup Pages
26 | id: pages
27 | uses: actions/configure-pages@v5
28 |
29 | - name: Build documentation
30 | run: |
31 | cd docs
32 | make build
33 |
34 | - name: Upload documentation artifacts
35 | uses: actions/upload-pages-artifact@v4
36 | with:
37 | path: docs/.vitepress/dist/
38 |
39 | deploy:
40 | if: github.ref == 'refs/heads/master'
41 | runs-on: [ubuntu-latest]
42 | # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
43 | permissions:
44 | pages: write # to deploy to Pages
45 | id-token: write # to verify the deployment originates from an appropriate source
46 | environment:
47 | name: github-pages
48 | url: ${{ steps.deployment.outputs.page_url }}
49 | needs: build-docs
50 | steps:
51 | - name: Deploy to GitHub Pages
52 | id: deployment
53 | uses: actions/deploy-pages@v4
54 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/phone.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2020 The gRPC Authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package grpc.testing;
18 |
19 | message CallInfo {
20 | string session_id = 1;
21 | string media = 2;
22 | }
23 |
24 | message CallState {
25 | enum State {
26 | // The default state.
27 | UNDEFINED = 0;
28 | // The call is newly created.
29 | NEW = 1;
30 | // The call is connected.
31 | ACTIVE = 6;
32 | // The call is finished.
33 | ENDED = 7;
34 | }
35 | State state = 2;
36 | }
37 |
38 | message StreamCallRequest {
39 | string phone_number = 1;
40 | }
41 |
42 | message StreamCallResponse {
43 | oneof stream_call_response {
44 | CallInfo call_info = 1;
45 | CallState call_state = 2;
46 | }
47 | }
48 |
49 | service Phone {
50 | // Makes a phone call and communicate states via a stream.
51 | rpc StreamCall(stream StreamCallRequest) returns (stream StreamCallResponse);
52 | }
53 |
--------------------------------------------------------------------------------
/ifex/output_filters/schema/LICENSE.json-schema:
--------------------------------------------------------------------------------
1 | Copyright (c) 2022 IETF Trust and the persons identified as the document authors. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4 |
5 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6 | 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.
7 | Neither the name of Internet Society, IETF or IETF Trust, nor the names of specific contributors, may be used to endorse or promote products derived from this software without specific prior written permission.
8 | 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.
9 |
--------------------------------------------------------------------------------
/distribution/docker/Dockerfile.ubuntu:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2023 Novaspring AB
2 | # SPDX-License-Identifier: MPL-2.0
3 | #
4 | # This file is part of IFEX project
5 | # ---------------------------------------------------------------------------
6 |
7 | FROM ubuntu:24.04
8 |
9 | # Install what's needed to compile python from source using pyenv
10 | RUN apt-get update && apt-get install -y bash build-essential curl git libbz2-dev libffi-dev liblzma-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libssl-dev llvm lzma-dev make ncurses-dev python3-openssl python3 sudo tk-dev wget xz-utils zlib1g-dev
11 |
12 | # Prepare directories
13 | RUN mkdir /ifex /work
14 |
15 | # See .dockerignore file for which files are being copied into container
16 | COPY . /ifex/
17 | RUN chown -R ubuntu:ubuntu /ifex
18 | WORKDIR /ifex
19 | USER ubuntu
20 | ENV PATH "/home/ubuntu/.pyenv/bin:/usr/bin:/bin"
21 | RUN scripts/install_pyenv.sh
22 | RUN scripts/install_python_version_in_pyenv.sh 3.12
23 | RUN pyenv global 3.12
24 | RUN eval "$(pyenv init -)" && pip install --upgrade pip
25 | RUN eval "$(pyenv init -)" && pip install -r requirements.txt && pip install -r requirements-dev.txt
26 | RUN eval "$(pyenv init -)" && pip install -e .
27 |
28 | # Test that binaries can be found
29 | RUN eval "$(pyenv init -)" && ifexgen -h >/dev/null && echo "Quick test: ifexgen launches OK!"
30 | RUN eval "$(pyenv init -)" && ifexgen_dbus -h >/dev/null && echo "Quick test: ifexgen_dbus launches OK!"
31 |
32 | # /work should be bind-mounted when container is started
33 | WORKDIR /work
34 |
--------------------------------------------------------------------------------
/helpers/dbus/c++/sdbus-c++-xml2cpp/sdbus-c++-xml2cpp-generate:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Wrapper to call "dockerized" sdbus-c++-xml2cpp tool
4 |
5 | # Settings:
6 | # docker, podman, ...
7 | CTR_TOOL=docker
8 | CTR_NAME=ifex_local/sdbus-xml2cpp
9 | BINARY=/sdbus-cpp/build/tools/sdbus-c++-xml2cpp
10 |
11 | # The tool can't seem to write to stdout :(
12 | # So... we'll have to pass in both input and output file names
13 |
14 | if [ $# -lt 1 ] ; then
15 | echo "IFEX: Docker wrapper for sdbus-c++-xml2cpp tool."
16 | echo "This generates both proxy and adapter/stub for the input D-Bus XML instrospection formatted file."
17 | echo "It is required to generate both outputs -- if one output is not needed, throw it away..."
18 | echo "If any output file is not specified, its file name will be generated."
19 | echo "Since it bind-maps a directory into a container, all files must be local filenames in the *current directory* only!"
20 | echo "Usage: $0 "
21 | exit 1
22 | fi
23 |
24 | # Drop suffix if any
25 | xmlfile="$1" ; shift
26 | filebase=${xmlfile%.xml}
27 | proxyfile="$1" ; shift 2>/dev/null
28 | if [ -z "$proxyfile" ] ; then
29 | proxyfile="$filebase.proxy.h"
30 | echo "Proxy file will be written to $proxyfile"
31 | fi
32 | adapterfile="$1" ; shift 2>/dev/null
33 | if [ -z "$adapterfile" ] ; then
34 | adapterfile="$filebase.adapter.h"
35 | echo "Adapter file will be written to $adapterfile"
36 | fi
37 |
38 | $CTR_TOOL run -t --rm --volume $PWD:/work ${CTR_NAME} ${BINARY} --proxy="$proxyfile" --adapter="$adapterfile" "$xmlfile" "$@"
39 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_import.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | // Author: kenton@google.com (Kenton Varda)
9 | // Based on original Protocol Buffers design by
10 | // Sanjay Ghemawat, Jeff Dean, and others.
11 | //
12 | // A proto file which is imported by unittest.proto to test importing.
13 |
14 | syntax = "proto2";
15 |
16 | // We don't put this in a package within proto2 because we need to make sure
17 | // that the generated code doesn't depend on being in the proto2 namespace.
18 | // In test_util.h we do
19 | // "using namespace unittest_import = proto2_unittest_import".
20 | package proto2_unittest_import;
21 |
22 | option optimize_for = SPEED;
23 | option cc_enable_arenas = true;
24 |
25 | // Exercise the java_package option.
26 | option java_package = "com.google.protobuf.test";
27 |
28 | // Do not set a java_outer_classname here to verify that Proto2 works without
29 | // one.
30 |
31 | // Test public import
32 | import public "google/protobuf/unittest_import_public.proto";
33 |
34 | message ImportMessage {
35 | optional int32 d = 1;
36 | }
37 |
38 | enum ImportEnum {
39 | IMPORT_FOO = 7;
40 | IMPORT_BAR = 8;
41 | IMPORT_BAZ = 9;
42 | }
43 |
44 | // To use an enum in a map, it must has the first value as 0.
45 | enum ImportEnumForMap {
46 | UNKNOWN = 0;
47 | FOO = 1;
48 | BAR = 2;
49 | }
50 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/hpack_sync_fuzzer.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2023 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package hpack_sync_fuzzer;
18 |
19 | import "test/core/test_util/fuzz_config_vars.proto";
20 |
21 | message Empty {}
22 |
23 | message StringKeyValue {
24 | string key = 1;
25 | string value = 2;
26 | }
27 |
28 | message IndexedKeyValue {
29 | uint32 index = 1;
30 | string value = 2;
31 | }
32 |
33 | message Header {
34 | oneof ty {
35 | uint32 indexed = 1;
36 | StringKeyValue literal_inc_idx = 2;
37 | StringKeyValue literal_not_idx = 3;
38 | IndexedKeyValue literal_not_idx_from_idx = 4;
39 | }
40 | }
41 |
42 | message Msg {
43 | bool use_true_binary_metadata = 1;
44 | repeated Header headers = 2;
45 | grpc.testing.FuzzConfigVars config_vars = 3;
46 | repeated uint64 random_numbers = 4;
47 | // Ensure that a header "a: b" appended to headers with hpack incremental
48 | // indexing is correctly added to the hpack table.
49 | bool check_ab_preservation = 5;
50 | }
51 |
--------------------------------------------------------------------------------
/distribution/docker/README.md:
--------------------------------------------------------------------------------
1 | ## container/docker directory
2 |
3 | This defines some container images that provide a controlled environment to
4 | execute the tools, including an installation of a specific python version and
5 | all dependent packages for the IFEX tools. We want to provide a choice of a
6 | minimal size (Alpine Linux), or more featured version, and also to create some
7 | diversity in testing environment. Therefore, two different distros are provided.
8 |
9 | The very first build can take some time if it installs a particular python
10 | version by compiling it from source code\*. After that the image is normally
11 | reused, as usual of course.
12 |
13 | **VARIANTS**
14 |
15 | - Ubuntu: (latest) This one compiles python from source, using pyenv.
16 | - Alpine Linux: This one uses a preinstalled python container image - see DETAILSk.
17 |
18 | **DETAILS**:
19 | On the Alpine version, the python compilation via pyenv kept failing (perhaps still some dependency missing?). For now this one is based on a Docker image for python itself, but the Alpine version of it -> e.g. `python3.11-alpine`. The important thing at the moment is that the containers are not broken, at least.
20 |
21 | ### Usage:
22 | ```
23 | cd docker
24 | make build_ubuntu
25 | make run_ubuntu
26 | ```
27 | or
28 | ```
29 | make build_alpine
30 | make run_alpine
31 | ```
32 |
33 | When the container is run, it will map the current directory to /work.
34 |
35 | Once inside an interactive shell in the container, you can run tools like `ifexgen` directly.
36 |
37 | **BUGS**
38 | See `Makefile` and `Dockerfile.*` for other options (e.g. alpine based)
39 |
--------------------------------------------------------------------------------
/docs/generate-docs.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # SPDX-FileCopyrightText: Copyright (c) 2025 Mercedes-Benz Tech Innovation GmbH
4 | # SPDX-License-Identifier: MPL-2.0
5 |
6 | # Simple documentation generation script
7 |
8 | set -e # Exit on any error
9 |
10 | echo "🔍 Generating IFEX documentation..."
11 |
12 | # Ensure target directory exists
13 | mkdir -p specification
14 |
15 | # Clean up any existing files on error
16 | cleanup() {
17 | echo "❌ Generation failed. Cleaning up partial files..."
18 | rm -f specification/generated-types.generated.md specification/ast-structure.generated.md
19 | exit 1
20 | }
21 | trap cleanup ERR
22 |
23 | # Generate header comment
24 | TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
25 | HEADER="
26 |
27 |
28 | "
29 |
30 | echo " 🔧 Generating types documentation..."
31 | echo -e "$HEADER" > specification/generated-types.generated.md
32 | cd .. && PYTHONPATH=/app python3 docs/generate-types-doc.py >> docs/specification/generated-types.generated.md
33 | cd docs
34 |
35 | echo " 🏗️ Generating AST structure documentation..."
36 | echo -e "$HEADER" > specification/ast-structure.generated.md
37 | cd .. && PYTHONPATH=/app python3 -m ifex.models.ifex.ifex_ast_doc >> docs/specification/ast-structure.generated.md
38 | cd docs
39 |
40 | echo "✅ Documentation generated successfully!"
41 | echo " 📄 Generated: specification/generated-types.generated.md"
42 | echo " 📄 Generated: specification/ast-structure.generated.md"
43 |
44 | echo "🚀 Documentation generation complete!"
45 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/README.md:
--------------------------------------------------------------------------------
1 | # protobuf/gRPC test files
2 |
3 | This directory holds several test files from the original Google protobuf and
4 | gRPC projects. We use them primarily to check that the protobuf parser can read
5 | them all, or to see if output from conversions has changed as a consequence of
6 | code changes (i.e. regression tests).
7 |
8 | ## Supported protobuf syntax is proto3
9 |
10 | 1-2 files were modified to remove a yet unsupported complex string escape sequence.
11 | This might be fixed later, if a real-world usage requires it.
12 |
13 | While there are a few files here marked as syntax = "proto2", we did not include all proto2
14 | related files that would fail parsing because of a few (deprecated?) features that are not implemented
15 | by the grammar/parser.
16 |
17 | ==> There is NO current plan to officially support anything else than "proto3" syntax.
18 | (but contributions welcome if there is a way to support proto2 without unnecessary complications)
19 |
20 | ## LICENSE
21 |
22 | The copyright and license information for the example and unit-test files are
23 | specified in each file header but generally governed by the project they stem
24 | from. The corresponding license texts can be found in the LICENSES directory:
25 |
26 | Directory:
27 | * protobuf/ - uses MIT license -> see LICENSES/MIT
28 | * grpc/ - uses multiple licenses but the protofiles have only headers with Apache license -> see LICENSES/Apache-2.0
29 |
30 | Example files found outside of these two directories are written by or for the IFEX
31 | project and licensed the same as the project as a whole (unless explicitly marked otherwise).
32 |
33 |
--------------------------------------------------------------------------------
/ifex/models/ifex/types.yml:
--------------------------------------------------------------------------------
1 | # Type categories:
2 | #
3 | # Primitive types can be used directly, as method arguments, in typedef/aliases,
4 | # referenced in struct and variant definitions and so on.
5 | #
6 | # A Defined Type needs to be named and specified in its own node (like
7 | # Enumeration node type), or through a Typedef. These definitions usually
8 | # appear as a child of Namespace. After that has been done, the defined type
9 | # can be used in all the contexts mentioned above for primitive types.
10 | #
11 | # Some types are both in the primitive and defined category. Specifically: Set
12 | # and Map _can_ be used as a primitive type. (In other words the IDL does not
13 | # **require** further specification). However doing that limits their use to
14 | # languages that support dynamic typing (the key or value can be of any type,
15 | # and does not need to be known beforehand). If the key/value type is known
16 | # during API design, they should be treated as a defined_type which has defined
17 | # the type of its members. Even if the contained type in set/map is specified
18 | # as being Variant, this is preferrable over it being unspecified.
19 |
20 | # Opaque is in the primitive category because nothing can be defined about it
21 | # in the fundamental IDL. (It is reserved for deployment layer information)
22 |
23 | primitive_types:
24 | - uint8
25 | - int8
26 | - uint16
27 | - int16
28 | - uint32
29 | - int32
30 | - uint64
31 | - int64
32 | - boolean
33 | - float
34 | - double
35 | - string
36 | - set
37 | - map
38 | - opaque
39 |
40 | defined_types:
41 | - typedef
42 | - struct
43 | - variant
44 | - enumeration
45 | - set*
46 | - map*
47 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/flow_control_fuzzer.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2022 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package flow_control_fuzzer;
18 |
19 | import "test/core/test_util/fuzz_config_vars.proto";
20 |
21 | message Empty {};
22 |
23 | message StreamWrite {
24 | uint32 id = 1;
25 | uint32 size = 2;
26 | }
27 |
28 | message Action {
29 | oneof action {
30 | uint64 set_memory_quota = 1;
31 | uint64 step_time_ms = 2;
32 | Empty periodic_update = 3;
33 | Empty perform_send_to_remote = 4;
34 | Empty read_send_to_remote = 5;
35 | Empty read_send_from_remote = 6;
36 | StreamWrite stream_write = 7;
37 | Empty perform_send_from_remote = 8;
38 | StreamWrite set_min_progress_size = 9;
39 | uint32 allocate_memory = 10;
40 | uint32 deallocate_memory = 11;
41 | Empty perform_send_to_remote_with_payload = 12;
42 | StreamWrite set_pending_size = 13;
43 | }
44 | }
45 |
46 | message Msg {
47 | bool enable_bdp = 1;
48 | repeated Action actions = 2;
49 | grpc.testing.FuzzConfigVars config_vars = 3;
50 | }
51 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_lazy_dependencies_enum.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | // Author: trafacz@google.com (Todd Rafacz)
9 | // Based on original Protocol Buffers design by
10 | // Sanjay Ghemawat, Jeff Dean, and others.
11 | //
12 | // A proto file we will use for unit testing.
13 |
14 | edition = "2023";
15 |
16 | // Treat all enums as closed by default (proto2 behavior).
17 | option features.enum_type = CLOSED;
18 |
19 | // Some generic_services option(s) added automatically.
20 | // See: http://go/proto2-generic-services-default
21 | option cc_generic_services = true; // auto-added
22 | option java_generic_services = true; // auto-added
23 | option py_generic_services = true; // auto-added
24 | option cc_enable_arenas = true;
25 |
26 | // We don't put this in a package within proto2 because we need to make sure
27 | // that the generated code doesn't depend on being in the proto2 namespace.
28 | // In test_util.h we do "using namespace unittest = proto2_unittest".
29 | package proto2_unittest.lazy_imports;
30 |
31 | // Protos optimized for SPEED use a strict superset of the generated code
32 | // of equivalent ones optimized for CODE_SIZE, so we should optimize all our
33 | // tests for speed unless explicitly testing code size optimization.
34 | option optimize_for = SPEED;
35 |
36 | option java_outer_classname = "UnittestLazyImportsEnumProto";
37 |
38 | enum LazyEnum {
39 | LAZY_ENUM_0 = 0;
40 | LAZY_ENUM_1 = 1;
41 | }
42 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/metrics.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2015-2016 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | // Contains the definitions for a metrics service and the type of metrics
16 | // exposed by the service.
17 | //
18 | // Currently, 'Gauge' (i.e a metric that represents the measured value of
19 | // something at an instant of time) is the only metric type supported by the
20 | // service.
21 | syntax = "proto3";
22 |
23 | package grpc.testing;
24 |
25 | // Response message containing the gauge name and value
26 | message GaugeResponse {
27 | string name = 1;
28 | oneof value {
29 | int64 long_value = 2;
30 | double double_value = 3;
31 | string string_value = 4;
32 | }
33 | }
34 |
35 | // Request message containing the gauge name
36 | message GaugeRequest {
37 | string name = 1;
38 | }
39 |
40 | message EmptyMessage {}
41 |
42 | service MetricsService {
43 | // Returns the values of all the gauges that are currently being maintained by
44 | // the service
45 | rpc GetAllGauges(EmptyMessage) returns (stream GaugeResponse);
46 |
47 | // Returns the value of one gauge
48 | rpc GetGauge(GaugeRequest) returns (GaugeResponse);
49 | }
50 |
--------------------------------------------------------------------------------
/tests/gen_proto_test.py:
--------------------------------------------------------------------------------
1 | # SPDX-License-Identifier: MPL-2.0
2 | # ----------------------------------------------------------------------------
3 | # (C) 2021 COVESA
4 | # Test code for code generator part of IFEX -> modified to run protobuf tests
5 | # ----------------------------------------------------------------------------
6 |
7 | from ifex.models.protobuf import protobuf_lark as protobuf_parser
8 | from ifex.output_filters.protobuf import grpc_generator
9 | import os
10 |
11 | TestPath = os.path.dirname(os.path.realpath(__file__))
12 |
13 | def test_gen():
14 |
15 | # Get matching dirs named 'test.'
16 | for (_,dirs,_) in os.walk(TestPath):
17 | test_dirs = [ x for x in dirs if x.startswith('test.proto.') ]
18 | break # First level of walk is enough.
19 |
20 | for subdir in test_dirs:
21 | print(f"Running test in {subdir}.")
22 | path = os.path.join(TestPath, subdir)
23 |
24 | # The files named 'input.yaml', 'template' and 'result' are in each test directory
25 | ast_root = protobuf_parser.get_ast_from_proto_file(os.path.join(path, 'input'))
26 |
27 | template_dir = os.path.join(os.path.dirname(grpc_generator.__file__), "templates")
28 |
29 | generated = grpc_generator.ast_to_text(ast_root, template_dir)
30 |
31 | with open(os.path.join(path,"result"), "r") as result_file:
32 | # Apparently we must strip newline or it will be added superfluously here
33 | # even if it is not in the file. The same does not happen on the
34 | # jinja-template generation we are comparing to.
35 | wanted = result_file.read()
36 | assert generated == wanted
37 |
38 |
39 | if __name__ == '__main__':
40 | test_gen()
41 |
42 |
--------------------------------------------------------------------------------
/ifex/output_filters/templates/simple/simple_overview.tpl:
--------------------------------------------------------------------------------
1 | -----------------------------------------
2 | Header
3 | -----------------------------------------
4 | Servicename: {{ item.name }}
5 | -> {{ item.description }}
6 | {% for n in item.namespaces %}
7 | Namespace: {{ n.name }}
8 | -> {{ n.description }}
9 | {% for x in n.structs %}
10 | Struct: {{ x.name }}
11 | -> {{ x.description }}
12 | {% for x in x.members %}
13 | member: {{ x.name }} (of type {{x.datatype}})
14 | {% endfor %}
15 | {% endfor %}
16 | {% for x in n.typedefs %}
17 | Typedef: {{ x.name }}
18 | -> {{ x.description }}
19 | -> Datatype: {{ x.datatype }}
20 | -> Min: {{ x.min }}
21 | -> Max: {{ x.max }}
22 | {% endfor %}
23 | {% for x in n.enumerations %}
24 | Enum: {{ x.name }}
25 | -> {{ x.description }}
26 | {% for x in x.options %}
27 | Options name: {{ x.name }} (of value {{x.value}})
28 | {% endfor %}
29 | {% endfor %}
30 | {% for x in n.methods %}
31 | Method: {{ x.name }}
32 | -> {{ x.description }}
33 | {% for x in x.input %}
34 | in: {{ x.name }} (of type {{x.datatype}})
35 | {% endfor %}
36 | {{ gen(x.output) }}
37 | {% endfor %}
38 | {% for x in n.events %}
39 | Event: {{ x.name }}
40 | -> {{ x.description }}
41 | {% for x in x.input %}
42 | in: {{ x.name }} (of type {{x.datatype}})
43 | {% endfor %}
44 | {% endfor %}
45 | {% for x in n.properties %}
46 | Property: {{ x.name }}
47 | -> {{ x.description }}
48 | -> Type: {{ x.datatype }}
49 | {% endfor %}
50 | {% endfor %}
51 | -----------------------------------------
52 | Footer
53 | -----------------------------------------
54 |
55 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/memory_quota_fuzzer.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2021 gRPC authors.
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | syntax = "proto3";
16 |
17 | package memory_quota_fuzzer;
18 |
19 | import "test/core/test_util/fuzz_config_vars.proto";
20 |
21 | message Empty {}
22 |
23 | message Reclaimer {
24 | enum Pass {
25 | BENIGN = 0;
26 | IDLE = 1;
27 | DESTRUCTIVE = 2;
28 | }
29 | bool synchronous = 1;
30 | Pass pass = 2;
31 | Msg msg = 3;
32 | }
33 |
34 | message AllocationRequest {
35 | uint32 min = 1;
36 | uint32 max = 2;
37 | }
38 |
39 | message Action {
40 | reserved 15;
41 | int32 quota = 1;
42 | int32 allocator = 2;
43 | int32 allocation = 3;
44 | oneof action_type {
45 | Empty flush_exec_ctx = 7;
46 | Empty create_quota = 10;
47 | Empty delete_quota = 11;
48 | Empty create_allocator = 12;
49 | Empty delete_allocator = 13;
50 | uint64 set_quota_size = 14;
51 | AllocationRequest create_allocation = 16;
52 | Empty delete_allocation = 17;
53 | Reclaimer post_reclaimer = 18;
54 | }
55 | }
56 |
57 | message Msg {
58 | repeated Action actions = 2;
59 | grpc.testing.FuzzConfigVars config_vars = 3;
60 | }
61 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/grpc/transport_security_common.proto:
--------------------------------------------------------------------------------
1 | // Copyright 2018 The gRPC Authors
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | // The canonical version of this proto can be found at
16 | // https://github.com/grpc/grpc-proto/blob/master/grpc/gcp/transport_security_common.proto
17 |
18 | syntax = "proto3";
19 |
20 | package grpc.gcp;
21 |
22 | option go_package = "google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp";
23 | option java_multiple_files = true;
24 | option java_outer_classname = "TransportSecurityCommonProto";
25 | option java_package = "io.grpc.alts.internal";
26 |
27 | // The security level of the created channel. The list is sorted in increasing
28 | // level of security. This order must always be maintained.
29 | enum SecurityLevel {
30 | SECURITY_NONE = 0;
31 | INTEGRITY_ONLY = 1;
32 | INTEGRITY_AND_PRIVACY = 2;
33 | }
34 |
35 | // Max and min supported RPC protocol versions.
36 | message RpcProtocolVersions {
37 | // RPC version contains a major version and a minor version.
38 | message Version {
39 | uint32 major = 1;
40 | uint32 minor = 2;
41 | }
42 | // Maximum supported RPC version.
43 | Version max_rpc_version = 1;
44 | // Minimum supported RPC version.
45 | Version min_rpc_version = 2;
46 | }
47 |
--------------------------------------------------------------------------------
/helpers/dbus/c++/sdbus-c++-xml2cpp/Makefile:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2023 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
4 | IMAGE_NAME ?= ifex_local/sdbus-xml2cpp
5 | CONTAINER_NAME ?= sdbus-xml2cpp
6 | CONTAINER_HOSTNAME ?= sdbus-xml2cpp
7 |
8 | .PHONY: _reset build rebuild buildnew run clean logs shell stop kill rm rmi
9 |
10 | default:
11 | @echo "make [build|buildnew|run|clean|logs|shell|stop|kill|rm|rmi]"
12 |
13 | build:
14 | docker build --tag=${IMAGE_NAME}:latest .
15 |
16 | # Build container fully from scratch, without reusing cached steps
17 | buildnew:
18 | docker build --no-cache --tag=${IMAGE_NAME}:latest .
19 |
20 | # Run container (detached)
21 | run_selinux:
22 | ZFLAG=:z make run
23 |
24 | run:
25 | @docker rm -f ${CONTAINER_NAME}
26 | @docker run -ti -h "${CONTAINER_HOSTNAME}" -v ${PWD}/..:/work${ZFLAG} --name=${CONTAINER_NAME} ${IMAGE_NAME}:latest
27 |
28 | run_shell:
29 | @docker rm -f ${CONTAINER_NAME}
30 | @docker run -ti -h "${CONTAINER_HOSTNAME}" -v ${PWD}/..:/work${ZFLAG} --name=${CONTAINER_NAME} ${IMAGE_NAME}:latest /bin/bash
31 |
32 | # Force remove container and image
33 | clean: kill rm rmi
34 |
35 | logs:
36 | docker logs -f ${CONTAINER_NAME}
37 |
38 | shell:
39 | docker exec -it ${CONTAINER_NAME} /bin/bash
40 |
41 | stop:
42 | docker stop ${CONTAINER_NAME} || true
43 |
44 | # Force stop and remove container
45 | kill:
46 | docker kill ${CONTAINER_NAME} || echo "Cannot kill - probably not running"
47 | docker rm ${CONTAINER_NAME} || echo "Container removed already"
48 |
49 | rm:
50 | docker kill ${CONTAINER_NAME} 2>/dev/null && echo killed || echo "Container seems stopped already"
51 | docker rm ${CONTAINER_NAME} || echo "Container seems removed already"
52 |
53 | rmi:
54 | @docker rmi ${IMAGE_NAME}:latest 2>/dev/null && echo removed image || echo "Image seems removed already"
55 |
--------------------------------------------------------------------------------
/ifex/layer_types/utils/identify_layer.py:
--------------------------------------------------------------------------------
1 | # SPDX-FileCopyrightText: Copyright (c) 2025 MBition GmbH.
2 | # SPDX-License-Identifier: MPL-2.0
3 |
4 | """Determine the type of an input file by validating it with multiple schemas."""
5 |
6 | from ifex.output_filters.schema.validate import schema_check
7 | import sys
8 |
9 | def get_matching_schemas(input_file : str, schemas : list):
10 | checkit = lambda f : schema_check(input_file, f, quiet=True)
11 | return list(filter(checkit, schemas))
12 |
13 | # Some other possibly useful entry points for usage from other modules:
14 | def is_single_match(input_file : str, schemas : list):
15 | return len(get_matching_schemas(input_file, schemas)) == 1
16 |
17 | # Note - this one intended to be called _only if_ is_single_match is True
18 | def identify_file(input_file : str, schemas : list):
19 | matching = get_matching_schemas(input_file, schemas)
20 | if len(matching) == 1:
21 | return matching[0]
22 | else:
23 | return None
24 |
25 | # Can also be used as an executable script directly:
26 | if __name__ == '__main__':
27 | if (len(sys.argv) < 2):
28 | print("Usage: identify_layer.py file.ifex schema.json [schema2.json, schema3... etc]")
29 | sys.exit(1)
30 |
31 | input_file = sys.argv[1]
32 | schemas = list(set(sys.argv[2:])) # (remove any duplicates)
33 | matching = get_matching_schemas(input_file, schemas)
34 | num_match = len(matching)
35 | if num_match == 0:
36 | print("No match.")
37 | sys.exit(1)
38 | elif num_match > 1:
39 | print("Could not identify file because more than one given schema seems to be matching!")
40 | for m in matching:
41 | print(" - " + m)
42 | sys.exit(num_match)
43 | else:
44 | print(f"The input file is of type: {matching[0]}")
45 | sys.exit(0)
46 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/protobuf/unittest_lazy_dependencies_custom_option.proto:
--------------------------------------------------------------------------------
1 | // Protocol Buffers - Google's data interchange format
2 | // Copyright 2008 Google Inc. All rights reserved.
3 | //
4 | // Use of this source code is governed by a BSD-style
5 | // license that can be found in the LICENSE file or at
6 | // https://developers.google.com/open-source/licenses/bsd
7 |
8 | // Author: trafacz@google.com (Todd Rafacz)
9 | // Based on original Protocol Buffers design by
10 | // Sanjay Ghemawat, Jeff Dean, and others.
11 | //
12 | // A proto file we will use for unit testing.
13 |
14 | edition = "2023";
15 |
16 | import "google/protobuf/descriptor.proto";
17 | import "google/protobuf/unittest_lazy_dependencies_enum.proto";
18 |
19 | // Some generic_services option(s) added automatically.
20 | // See: http://go/proto2-generic-services-default
21 | option cc_generic_services = true; // auto-added
22 | option java_generic_services = true; // auto-added
23 | option py_generic_services = true; // auto-added
24 | option cc_enable_arenas = true;
25 |
26 | // We don't put this in a package within proto2 because we need to make sure
27 | // that the generated code doesn't depend on being in the proto2 namespace.
28 | // In test_util.h we do "using namespace unittest = proto2_unittest".
29 | package proto2_unittest.lazy_imports;
30 |
31 | // Protos optimized for SPEED use a strict superset of the generated code
32 | // of equivalent ones optimized for CODE_SIZE, so we should optimize all our
33 | // tests for speed unless explicitly testing code size optimization.
34 | option optimize_for = SPEED;
35 |
36 | option java_outer_classname = "UnittestLazyImportsCustomOptionProto";
37 |
38 | message LazyMessage {
39 | int32 a = 1;
40 | }
41 |
42 | extend google.protobuf.MessageOptions {
43 | LazyEnum lazy_enum_option = 138596335 [default = LAZY_ENUM_1];
44 | }
45 |
--------------------------------------------------------------------------------
/tests/protobuf/unit_test_files/LICENSES/MIT:
--------------------------------------------------------------------------------
1 | Copyright 2008 Google Inc. All rights reserved.
2 |
3 | Redistribution and use in source and binary forms, with or without
4 | modification, are permitted provided that the following conditions are
5 | met:
6 |
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above
10 | copyright notice, this list of conditions and the following disclaimer
11 | in the documentation and/or other materials provided with the
12 | distribution.
13 | * Neither the name of Google Inc. nor the names of its
14 | contributors may be used to endorse or promote products derived from
15 | this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 |
29 | Code generated by the Protocol Buffer compiler is owned by the owner
30 | of the input file used when generating it. This code is not
31 | standalone and requires a support library to be linked with it. This
32 | support library is itself covered by the above license.
33 |
--------------------------------------------------------------------------------