NI XNET XNET Session Ethernet Properties - ni/grpc-device GitHub Wiki

XNET Session Ethernet Properties

Ethernet:Filtering:Frame Filter

Data Type Direction Required? Default
string Read/Write No Empty String

Property Class

XNET Session

Property ID

nxPropSession_EnetFrameFilter

Description

Specifies an Ethernet frame filter, using Berkeley packet filtering (BPF) syntax. The standard BPF syntax is extended to support multiple independent filters in the string. Independent filters are separated by a comma.

When applied as a filter for incoming frames, only Ethernet frames that match the filter will be received from the network. This property can also be used with output streams in conjunction with the replay feature.

When used with replay, this property specifies the set of included or excluded frames for Ethernet. Because database frame objects do not exist for Ethernet, the Output Stream List property is not supported and this property is used instead.

This property affects the output stream according to the mode specified for Interface:Output Stream Timing property:

  • Immediate:  This property is ignored.
  • Replay Exclusive:  All frames that match this filter will be excluded from the replay. By default (an empty filter string), all frames are replayed.
  • Replay Inclusive:  Only frames that match this filter will be included in the replay. By default (an empty filter string), no frames are replayed; the user must specify a filter in order for frames to be replayed.

Examples

The following Frame Filter, when used with a Frame Input Stream session, will permit the session to receive Ethernet frames only from VLAN 2:

vlan 2

When used with a Frame Output Stream session in Replay Inclusive mode, the following Frame Filter will cause the session to replay Ethernet frames only from VLAN 2 or VLAN 3:

vlan 2,vlan 3

Ethernet:Logging:Error?

Data Type Direction Required? Default
bool Read No False

Property Class

XNET Session

Property ID

nxPropSession_EnetLogError

Description

Indicates whether an error has occurred in the logging thread.

To view the error information, use nxStop to stop the session; the error from the logging thread will be merged with the error of the nxStop function.

Ethernet:Logging:Mode

Data Type Direction Required? Default
u32 Read/Write Yes Off

Property Class

XNET Session

Property ID

nxPropSession_EnetLogMode

Description

This property enables or disables logging. The value is Off by default; to enable logging, you must write this property to the log. This property uses an enumerated list with the following values:

Enumeration Value Description
nxEnetLogMode_Off 0 Disable logging for the session.
nxEnetLogMode_Log 1 Enable logging for the session. You cannot read data using nxRead when using this mode. If you require access to the data, read from the log file.
When logging is enabled, you must use the Filepath property to specify a valid path for the log file.

Ethernet:Logging:Filepath

Data Type Direction Required? Default
string Read/Write Yes N/A

Property Class

XNET Session

Property ID

nxPropSession_EnetLogFile

Description

This property specifies the path to the file in which you want to log data. The file must use the .pcap extension.

No default file path is provided; you must write this property with a valid file path when you use the Mode property to enable logging. The operation used to create the file is determined by the Operation property.

Ethernet:Logging:Operation

Data Type Direction Required? Default
u32 Read/Write No Create or Replace

Property Class

XNET Session

Property ID

nxPropSession_EnetLogOperation

Description

This property specifies the operation used to create the log file. This property uses an enumerated list with the following values:

Enumeration Value Description
nxEnetLogOperation_CreateOrReplace 0 Create a new log file, or replace an existing log file.
nxEnetLogOperation_Create 1 Create a new log file. If the file already exists, XNET returns an error.

Ethernet:Logging:MultipleFiles:EnableMultipleFiles

Data Type Direction Required? Default
bool Read/Write No False

Property Class

XNET Session

Property ID

nxPropSession_EnetLogEnableMultipleFiles

Description

Enables multiple log files to be created for a single session; use the FileSizeThreshold property to determine log file size. If this property value is True, the FileSizeThreshold must be greater than 0. Generated file names include an incrementing index and timestamp of the start of capture.

Ethernet:Logging:MultipleFiles:FileSizeThreshold

Data Type Direction Required? Default
u64 Read/Write No 0

Property Class

XNET Session

Property ID

nxPropSession_EnetLogFileSizeThreshold

Description

Threshold, specified in bytes, above which a new log file will be created if the value of the EnableMultipleFiles property is True. FileSizeThreshold is ignored if the EnableMultipleFiles property is False.

Note  If the value of EnableMultipleFiles is True, the FileSizeThreshold must be greater than 0.

Ethernet:Number of Frames Received

Data Type Direction Required? Default
u64 Read Only No N/A

Property Class

XNET Session

Property ID

nxPropSession_EnetNumFramesReceived

Description

This is a cumulative count of frames received by the session while started. When logging is off, these frames can be obtained from nxRead. When logging is on, these frames are stored in the log file. When an input session is used for the Ethernet endpoint, the Interface:Ethernet:Endpoint:Receive Filter property determines which frames are received by the session.

This count resets to zero when the session starts. The count is unchanged when the session stops.

Ethernet:Source MAC Address Auto?

Data Type Direction Required? Default
bool Read/Write No True

Property Class

XNET Session

Property ID

nxPropSession_EnetSourceMacAddressAuto

Description

Configures whether the output session automatically uses the MAC Address property as the source MAC address in transmitted frames.

When this property is true (default), the endpoint ignores the source MAC address in frame data provided to nxWriteFrame. The endpoint automatically replaces the source MAC address in frame data with the MAC Address property for the endpoint, and uses that for the transmitted frame. This convenience allows you to leave the source MAC address uninitialized (e.g. all zero) in frame data.

When this property is false, the endpoint uses the source MAC address in frame data for each transmitted frame. You must provide a valid source MAC address in frame data provided to XNET Write. This can be useful if you are simulating a specific ECU in the network. Each output session retains a distinct value for this property. This property is ignored for input sessions.

⚠️ **GitHub.com Fallback** ⚠️