The NET_BUFFER_LIST structure for each packet that traverses the Hyper-V extensible switch data path contains out-of-band (OOB) data. 此数据指定来自数据包来源的源端口,以及用于数据包传递的一个或多个目标端口。 此 OOB 数据称为 可扩展交换机转发上下文。
The following data types have been declared to access the extensible switch forwarding context within a packet's NET_BUFFER_LIST structure:
NDIS_SWITCH_FORWARDING_DETAIL_NET_BUFFER_LIST_INFO
这是一个包含数据包转发特征的 64 位联合。 此数据包括来自数据包的源端口和网络适配器连接的标识符。 此数据还包括目标端口数组中可用的未使用的元素数。
The extensible switch extension can access this data by using the NET_BUFFER_LIST_SWITCH_FORWARDING_DETAIL macro.
NDIS_SWITCH_FORWARDING_DESTINATION_ARRAY
此结构定义数据包的目标端口数组。 Each element in this array is formatted as an NDIS_SWITCH_PORT_DESTINATION structure.
The NDIS_SWITCH_FORWARDING_DESTINATION_ARRAY structure contains members that specify the current number of the total number of elements as well as the number of used elements in the array.
The extensible switch extension can obtain this array by calling the GetNetBufferListDestinations function. If the driver adds or modifies elements in the array for a packet with multiple destination ports, it must call the UpdateNetBufferListDestinations function. 此函数将这些更改提交到数据包转发上下文中的目标端口数组。
Note To commit changes to a packet with only one destination port, it is more efficient for the driver to call the AddNetBufferListDestination function.
NDIS_SWITCH_PORT_DESTINATION
此结构定义数据包的目标端口。 For packets with a single destination port, there is only one NDIS_SWITCH_PORT_DESTINATION element in the destination port array. 对于具有多个目标端口的数据包,数组中有一个或多个这些元素。
After the extensible switch extension has called GetNetBufferListDestinations to obtain the packet's destination port array, it can access individual elements in the array by using the NDIS_SWITCH_PORT_DESTINATION_AT_ARRAY_INDEX macro.