Skip to content

QuantumGate::Access::Manager::AddIPFilter

Karel Donk edited this page Dec 11, 2019 · 1 revision

Adds an IP filter to the instance. An IP filter can be used to allow or block a specific IP address or a range of IP addresses. By default all IP addresses are blocked. Filters that block an IP address take precedence over those that allow an IP address or a range of IP addresses through.

Signature

Result<IPFilterID>
    AddIPFilter(const WChar* ip_cidr,
                const IPFilterType type) noexcept;
Result<IPFilterID>
    AddIPFilter(const WChar* ip_str, const WChar* mask_str,
                const IPFilterType type) noexcept;
Result<IPFilterID>
    AddIPFilter(const String& ip_str, const String& mask_str,
                const IPFilterType type) noexcept;
Result<IPFilterID>
    AddIPFilter(const IPAddress& ip, const IPAddress& mask,
                const IPFilterType type) noexcept;

Parameters

Name Description
ip_cidr A QuantumGate::String containing the IP address and mask in CIDR notation e.g. 192.168.1.0/24.
ip_str A QuantumGate::String or pointer to QuantumGate::WChar string containing the IP address.
ip A QuantumGate::IPAddress containing the IP address.
mask_str A QuantumGate::String or pointer to QuantumGate::WChar string containing the IP mask. The mask may be in IP address notation (255.255.255.0) or CIDR notation (/24).
mask A QuantumGate::IPAddress containing the IP address mask.
type The type of the filter. See QuantumGate::Access::IPFilterType for details.

Return values

Returns a QuantumGate::Result object equal to one of the following QuantumGate::ResultCodes:

Value Description
QuantumGate::ResultCode::Succeeded The operation succeeded.
QuantumGate::ResultCode::Failed The operation failed.
QuantumGate::ResultCode::InvalidArgument The operation failed because an invalid argument was passed through.
QuantumGate::ResultCode::AddressInvalid The operation failed because the IP address is invalid.
QuantumGate::ResultCode::AddressMaskInvalid The operation failed because the mask is invalid.

The result will contain a QuantumGate::Access::IPFilterID upon successful completion which can be used to later remove the filter.

Clone this wiki locally