Rtnl2AddUdpPortDispatchRule

Rtnl2AddUdpPortDispatchRule adds a rule to dispatch incoming packets to a given Physical Receive Queue based on the value of their UDP Destination Port.

Syntax

Copy
BOOL Rtnl2AddUdpPortDispatchRule(
  [in]    RTNL2_HINTERFACE Interface,
  [in]    const RTNL2_UDP_PORT_DISPATCH_RULE *pRuleData,
  [in]    ULONG RuleStructSize,
  [out]   ULONG *pRuleId
);

Parameters

[in] Interface

A handle to the interface.

[in] pRuleData

The description of the rule to add.

[in] RuleStructSize

The size of the RTNL2_UDP_PORT_DISPATCH_RULE structure.

[out] pRuleId

The identifier of the newly added rule.

Return Value

If the function succeeds, it returns TRUE. If the function fails, it returns FALSE. Call GetLastError to obtain an error code.

Possible error codes:

Error code Meaning

ERROR_NOT_READY

The calling process has not called Rtnl2Init.

ERROR_INVALID_PARAMETER

One of the following conditions occurred:

  • The supplied interface handle is invalid.
  • pRuleData is NULL.
  • pRuleId is NULL.
  • The value of the Target Receive Queue supplied in the rule doesn't correspond to an enabled queue.

ERROR_ALREADY_EXISTS

A rule with the specified UDP Port already exists.

ERROR_DEVICE_FEATURE_NOT_SUPPORTED

There is no UDP Port Dispatcher in this interface.

ERROR_DEVICE_NO_RESOURCES

All hardware slots are already in use.

RTNL2_ERROR_INCOMPATIBLE_REQUEST

This version of NL2 is unable to interpret the fields contained in the provided pRuleData structure.

RTNL2_ERROR_SERIALIZED_COMMAND_TIMEOUT

The NL2 process didn’t reply within an acceptable delay.

RTNL2_ERROR_NO_MORE_COMMUNICATION

Unable to communicate with the NL2 process. This might be because the NL2 process is not running anymore, or because an application process thread was terminated during a previous call to an NL2 API function.

Remarks

To ensure backward and forward compatibility, the caller MUST memset the structure pointed by pRuleData to zero before populating it and set RuleStructSize to sizeof(RTNL2_UDP_PORT_DISPATCH_RULE).

Note: The value of RuleId in the supplied rule structure is ignored.

Note: If the PhysicalRxQueueIndex field in the RTNL2_UDP_PORT_DISPATCH_RULE structure doesn't correspond to this interface's existing and enabled Physical Receive Queue, the function fails.

Note: This function cannot create two different rules using the same UdpPort value in the RTNL2_UDP_PORT_DISPATCH_RULE structure.

Note: To change the target Physical Receive Queue associated with a given UDP Port when there is already a rule for that UDP Port, you must first delete the rule using the Rtnl2DeleteUdpPortDispatchRule function, and then create a new rule with the Rtnl2AddUdpPortDispatchRule function.

Characteristics

Real-time

Deterministic

No

Shutdown-safe

No

Local memory usage

Process

External MSpace usage

Internal MSpace usage

System

No

No

NL2 process

No

No

Calling process

No

No

Windows contiguous memory usage

Usage

No

Requirements

Minimum supported version Header Library

wRTOS 1.0 SDK

Rtnl2Api.h

Rtnl2Api.lib

See Also: