IN_PKTINFO structure (ws2ipdef.h)

The in_pktinfo structure is used to store received packet address information, and is used by Windows to return information about received packets and also allows specifying the local IPv4 address to use for sending packets.

Syntax

typedef struct in_pktinfo {
  IN_ADDR ipi_addr;
  ULONG   ipi_ifindex;
} IN_PKTINFO, *PIN_PKTINFO;

Members

ipi_addr

The destination IPv4 address from the IP header of the received packet when used with the LPFN_WSARECVMSG (WSARecvMsg) function. The local source IPv4 address to set in the IP header when used with the WSASendMsg function.

ipi_ifindex

The interface on which the packet was received when used with the LPFN_WSARECVMSG (WSARecvMsg) function. The interface on which the packet should be sent when used with the WSASendMsg function.

Remarks

If the IP_PKTINFO socket option is set on a socket of type SOCK_DGRAM or SOCK_RAW, one of the control data objects returned by the LPFN_WSARECVMSG (WSARecvMsg) function will contain an in_pktinfo structure used to store received packet address information.

On an IPv4 socket of type SOCK_DGRAM or SOCK_RAW, an application can specific the local IP address to use for sending with the WSASendMsg function. One of the control data objects passed in the WSAMSG structure to the WSASendMsg function may contain an in_pktinfo structure used to specify the local IPv4 address to use for sending.

On the Microsoft Windows Software Development Kit (SDK) released for Windows Vista and later, the organization of header files has changed and the in_pktinfo structure is defined in the Ws2ipdef.h header file which is automatically included in the Ws2tcpip.h header file. The Ws2ipdef.h header files should never be used directly.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header ws2ipdef.h (include Ws2tcpip.h)

See also

Dual-Stack Sockets for IPv6 Winsock Applications

IPPROTO_IP Socket Options

IPV6_PKTINFO

IP_PKTINFO

WSAMSG

LPFN_WSARECVMSG (WSARecvMsg)

WSASendMsg

in6_pktinfo