Expand typed firewall and map API

This commit is contained in:
Vibe Myass
2026-03-16 04:07:08 +00:00
parent 1dfc6aebfd
commit e89739a64f
21 changed files with 1373 additions and 131 deletions

49
src/LibNftables/NftMap.cs Normal file
View File

@@ -0,0 +1,49 @@
namespace LibNftables;
/// <summary>
/// Represents a typed nftables map definition backed by native C# collections.
/// </summary>
public sealed class NftMap
{
/// <summary>
/// Gets or sets the map name.
/// </summary>
public string? Name { get; set; }
/// <summary>
/// Gets or sets a common typed key type.
/// </summary>
/// <remarks>
/// Set either <see cref="KeyType"/> or <see cref="CustomKeyTypeExpression"/>.
/// </remarks>
public NftMapType? KeyType { get; set; }
/// <summary>
/// Gets or sets a custom nftables key-type expression for the map.
/// </summary>
/// <remarks>
/// Set either <see cref="KeyType"/> or <see cref="CustomKeyTypeExpression"/>.
/// </remarks>
public string? CustomKeyTypeExpression { get; set; }
/// <summary>
/// Gets or sets a common typed value type.
/// </summary>
/// <remarks>
/// Set either <see cref="ValueType"/> or <see cref="CustomValueTypeExpression"/>.
/// </remarks>
public NftMapType? ValueType { get; set; }
/// <summary>
/// Gets or sets a custom nftables value-type expression for the map.
/// </summary>
/// <remarks>
/// Set either <see cref="ValueType"/> or <see cref="CustomValueTypeExpression"/>.
/// </remarks>
public string? CustomValueTypeExpression { get; set; }
/// <summary>
/// Gets the entries declared inline with the map definition.
/// </summary>
public IList<NftMapEntry> Entries { get; } = new List<NftMapEntry>();
}