Add src files
This commit is contained in:
103
src/LibNftables/INftablesClient.cs
Normal file
103
src/LibNftables/INftablesClient.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
namespace LibNftables;
|
||||
|
||||
/// <summary>
|
||||
/// Provides high-level nftables operations backed by <c>libnftables</c>.
|
||||
/// </summary>
|
||||
public interface INftablesClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Validates a ruleset request using dry-run mode.
|
||||
/// </summary>
|
||||
/// <param name="request">The ruleset request to validate.</param>
|
||||
/// <param name="ct">A cancellation token.</param>
|
||||
/// <returns>
|
||||
/// A validation result. Invalid ruleset syntax or schema errors return <see cref="NftValidationResult.IsValid"/> = <see langword="false"/>.
|
||||
/// </returns>
|
||||
/// <exception cref="NftValidationException">Thrown when request input shape is invalid (for example, both text and file source provided).</exception>
|
||||
/// <exception cref="NftUnsupportedException">Thrown when runtime/platform is unsupported.</exception>
|
||||
/// <exception cref="NftNativeLoadException">Thrown when required native runtime components cannot be loaded.</exception>
|
||||
NftValidationResult Validate(NftApplyRequest request, System.Threading.CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously validates a ruleset request using dry-run mode.
|
||||
/// </summary>
|
||||
/// <param name="request">The ruleset request to validate.</param>
|
||||
/// <param name="ct">A cancellation token.</param>
|
||||
/// <returns>A task that resolves to a validation result.</returns>
|
||||
/// <exception cref="NftValidationException">Thrown when request input shape is invalid (for example, both text and file source provided).</exception>
|
||||
/// <exception cref="NftUnsupportedException">Thrown when runtime/platform is unsupported.</exception>
|
||||
/// <exception cref="NftNativeLoadException">Thrown when required native runtime components cannot be loaded.</exception>
|
||||
System.Threading.Tasks.Task<NftValidationResult> ValidateAsync(NftApplyRequest request, System.Threading.CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Applies a ruleset request.
|
||||
/// </summary>
|
||||
/// <param name="request">The ruleset request to apply.</param>
|
||||
/// <param name="ct">A cancellation token.</param>
|
||||
/// <exception cref="NftValidationException">Thrown when request input shape is invalid or the ruleset cannot be parsed/validated.</exception>
|
||||
/// <exception cref="NftPermissionException">Thrown when insufficient privileges are available for runtime operation.</exception>
|
||||
/// <exception cref="NftUnsupportedException">Thrown when runtime/platform is unsupported.</exception>
|
||||
/// <exception cref="NftNativeLoadException">Thrown when required native runtime components cannot be loaded.</exception>
|
||||
/// <exception cref="NftException">Thrown for other native execution failures.</exception>
|
||||
void Apply(NftApplyRequest request, System.Threading.CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously applies a ruleset request.
|
||||
/// </summary>
|
||||
/// <param name="request">The ruleset request to apply.</param>
|
||||
/// <param name="ct">A cancellation token.</param>
|
||||
/// <returns>A completed task when apply succeeds.</returns>
|
||||
/// <exception cref="NftValidationException">Thrown when request input shape is invalid or the ruleset cannot be parsed/validated.</exception>
|
||||
/// <exception cref="NftPermissionException">Thrown when insufficient privileges are available for runtime operation.</exception>
|
||||
/// <exception cref="NftUnsupportedException">Thrown when runtime/platform is unsupported.</exception>
|
||||
/// <exception cref="NftNativeLoadException">Thrown when required native runtime components cannot be loaded.</exception>
|
||||
/// <exception cref="NftException">Thrown for other native execution failures.</exception>
|
||||
System.Threading.Tasks.Task ApplyAsync(NftApplyRequest request, System.Threading.CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Captures the current nftables ruleset from the system.
|
||||
/// </summary>
|
||||
/// <param name="ct">A cancellation token.</param>
|
||||
/// <returns>A snapshot containing the exported ruleset text and capture time.</returns>
|
||||
/// <exception cref="NftPermissionException">Thrown when insufficient privileges are available for runtime operation.</exception>
|
||||
/// <exception cref="NftUnsupportedException">Thrown when runtime/platform is unsupported.</exception>
|
||||
/// <exception cref="NftNativeLoadException">Thrown when required native runtime components cannot be loaded.</exception>
|
||||
/// <exception cref="NftException">Thrown for other native execution failures.</exception>
|
||||
NftSnapshot Snapshot(System.Threading.CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously captures the current nftables ruleset from the system.
|
||||
/// </summary>
|
||||
/// <param name="ct">A cancellation token.</param>
|
||||
/// <returns>A task that resolves to a snapshot.</returns>
|
||||
/// <exception cref="NftPermissionException">Thrown when insufficient privileges are available for runtime operation.</exception>
|
||||
/// <exception cref="NftUnsupportedException">Thrown when runtime/platform is unsupported.</exception>
|
||||
/// <exception cref="NftNativeLoadException">Thrown when required native runtime components cannot be loaded.</exception>
|
||||
/// <exception cref="NftException">Thrown for other native execution failures.</exception>
|
||||
System.Threading.Tasks.Task<NftSnapshot> SnapshotAsync(System.Threading.CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Restores ruleset state from a previously captured snapshot.
|
||||
/// </summary>
|
||||
/// <param name="snapshot">The snapshot to restore.</param>
|
||||
/// <param name="ct">A cancellation token.</param>
|
||||
/// <exception cref="NftValidationException">Thrown when snapshot content is invalid.</exception>
|
||||
/// <exception cref="NftPermissionException">Thrown when insufficient privileges are available for runtime operation.</exception>
|
||||
/// <exception cref="NftUnsupportedException">Thrown when runtime/platform is unsupported.</exception>
|
||||
/// <exception cref="NftNativeLoadException">Thrown when required native runtime components cannot be loaded.</exception>
|
||||
/// <exception cref="NftException">Thrown for other native execution failures.</exception>
|
||||
void Restore(NftSnapshot snapshot, System.Threading.CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously restores ruleset state from a previously captured snapshot.
|
||||
/// </summary>
|
||||
/// <param name="snapshot">The snapshot to restore.</param>
|
||||
/// <param name="ct">A cancellation token.</param>
|
||||
/// <returns>A completed task when restore succeeds.</returns>
|
||||
/// <exception cref="NftValidationException">Thrown when snapshot content is invalid.</exception>
|
||||
/// <exception cref="NftPermissionException">Thrown when insufficient privileges are available for runtime operation.</exception>
|
||||
/// <exception cref="NftUnsupportedException">Thrown when runtime/platform is unsupported.</exception>
|
||||
/// <exception cref="NftNativeLoadException">Thrown when required native runtime components cannot be loaded.</exception>
|
||||
/// <exception cref="NftException">Thrown for other native execution failures.</exception>
|
||||
System.Threading.Tasks.Task RestoreAsync(NftSnapshot snapshot, System.Threading.CancellationToken ct = default);
|
||||
}
|
||||
Reference in New Issue
Block a user