public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dietmar Maurer <dietmar@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [RFC proxmox 02/22] firewall-api-types: add README.md
Date: Mon, 16 Feb 2026 11:43:40 +0100	[thread overview]
Message-ID: <20260216104401.3959270-3-dietmar@proxmox.com> (raw)
In-Reply-To: <20260216104401.3959270-1-dietmar@proxmox.com>

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
---
 proxmox-firewall-api-types/README.md | 54 ++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 proxmox-firewall-api-types/README.md

diff --git a/proxmox-firewall-api-types/README.md b/proxmox-firewall-api-types/README.md
new file mode 100644
index 00000000..1ae22118
--- /dev/null
+++ b/proxmox-firewall-api-types/README.md
@@ -0,0 +1,54 @@
+# proxmox-firewall-api-types
+
+Strongly typed Rust definitions for the Proxmox VE Firewall API.
+
+## Motivation
+
+The current PVE firewall implementation is written in Perl, and Rust type
+definitions can be auto-generated from its API schemas. However, many of the
+more complex types are represented as opaque strings, which limits type safety.
+
+Verifiers for complex types like ports and address matches cannot be generated
+automatically, so we need to implement them manually anyway.
+
+To address this, the crate provides hand-crafted Rust types that parse and validate these
+string-encoded values into proper enums and structs, while remaining fully
+compatible with the existing API wire format. The initial type definitions were
+seeded from the auto-generated `pve-api-types` crate and then refined by hand.
+
+Dependencies are minimal, so that we can use this crate for wasm targets (GUI).
+
+## Compatibility
+
+All types must serialize and deserialize to the same JSON wire format that the
+existing Perl-based PVE API produces and consumes. There is currently no
+automated compatibility test against the live Perl API, so changes must be
+verified manually.
+
+Key techniques used to maintain wire-format compatibility:
+
+- **Perl-specific deserializers** — The Perl API encodes booleans and integers
+  as strings. Fields that come from Perl use custom deserializers such as
+  `proxmox_serde::perl::deserialize_bool` and `deserialize_u64` to accept
+  these representations.
+- **Serde renames** — `#[serde(rename = "...")]` and `#[serde(rename_all = "kebab-case")]`
+  ensure that Rust field and variant names map to the exact keys and values
+  the Perl API expects (e.g. `icmp-type`, `macro`, `type`).
+- **Forward-compatible enums** — When the `enum-fallback` feature is enabled,
+  enums gain an `UnknownEnumValue` catch-all variant (backed by
+  `proxmox-fixed-string`) so that new values added in a future API version
+  can be deserialized without errors.
+
+When adding or modifying types, compare the serde output against the
+corresponding Perl API endpoint to ensure the JSON representation matches.
+
+## Features
+
+- **`enum-fallback`** — Enables an `UnknownEnumValue` catch-all variant on
+  enums (backed by `proxmox-fixed-string`) for forward-compatible
+  deserialization of values added in newer API versions.
+
+## Usage
+
+- All public types are re-exported from the crate root.
+- Every type implements `serde::Serialize` / `Deserialize`.
-- 
2.47.3




  parent reply	other threads:[~2026-02-16 10:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-16 10:43 [RFC proxmox 00/22] New crate for firewall api types Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 01/22] firewall-api-types: add new " Dietmar Maurer
2026-02-16 10:43 ` Dietmar Maurer [this message]
2026-02-16 10:43 ` [RFC proxmox 03/22] firewall-api-types: add firewall policy types Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 04/22] firewall-api-types: add logging types Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 05/22] firewall-api-types: add FirewallClusterOptions Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 06/22] firewall-api-types: add FirewallGuestOptions Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 07/22] firewall-api-types: add FirewallConntrackHelper enum Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 08/22] firewall-api-types: add FirewallNodeOptions struct Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 09/22] firewall-api-types: add FirewallRef type Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 10/22] firewall-api-types: add FirewallPortList types Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 11/22] firewall-api-types: add FirewallIcmpType Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 12/22] firewall-api-types: add FirewallIpsetReference type Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 13/22] firewall-api-types: add FirewallAliasReference type Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 14/22] firewall-api-types: add firewall address types Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 15/22] firewall-api-types: add FirewallRule type Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 16/22] firewall-api-types: use ConfigDigest from proxmox-config-digest crate Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 17/22] firewall-api-types: use COMMENT_SCHEMA from proxmox-schema crate Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 18/22] firewall-api-types: add FirewallRuleUpdater type Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 19/22] firewall-api-types: refactor FirewallRule and add FirewallRuleListEntry Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 20/22] firewall-api-types: add DeletableFirewallRuleProperty enum Dietmar Maurer
2026-02-16 10:43 ` [RFC proxmox 21/22] firewall-api-types: add FirewallAliasEntry API type Dietmar Maurer
2026-02-16 10:44 ` [RFC proxmox 22/22] firewall-api-types: add FirewallIpsetListEntry and FirewallIpsetEntry api types Dietmar Maurer
2026-02-17  6:17 ` [RFC proxmox 00/22] New crate for firewall " Hannes Laimer
2026-02-17  6:39   ` Dietmar Maurer
2026-02-17  8:17     ` Hannes Laimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260216104401.3959270-3-dietmar@proxmox.com \
    --to=dietmar@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal