/// <summary> /// Parse IPADDR_INFO_LIST from RESP_ASYNC_NOTIFY. /// </summary> /// <param name="respNotify">A pointer to a PRESP_ASYNC_NOTIFY structure, as specified in section 2.2.1.7.</param> /// <param name="IPAddrInfoList">IPADDR_INFO_LIST list.</param> public static void ParseIPAddrInfoList(RESP_ASYNC_NOTIFY respNotify, out IPADDR_INFO_LIST IPAddrInfoList) { IPAddrInfoList = new IPADDR_INFO_LIST(); IPAddrInfoList.Length = BitConverter.ToUInt32(respNotify.MessageBuffer, 0); IPAddrInfoList.Reserved = BitConverter.ToUInt32(respNotify.MessageBuffer, sizeof(int)); IPAddrInfoList.IPAddrInstances = BitConverter.ToUInt32(respNotify.MessageBuffer, 2 * sizeof(int)); IPAddrInfoList.IPAddrList = new IPADDR_INFO[IPAddrInfoList.IPAddrInstances]; int len = 3 * sizeof(int); for (int i = 0; i < IPAddrInfoList.IPAddrInstances; i++) { IPAddrInfoList.IPAddrList[i].Flags = BitConverter.ToUInt32(respNotify.MessageBuffer, len); if ((IPAddrInfoList.IPAddrList[i].Flags & (uint)SwnIPAddrInfoFlags.IPADDR_V4) != 0) { IPAddrInfoList.IPAddrList[i].IPV4 = BitConverter.ToUInt32(respNotify.MessageBuffer, len + sizeof(int)); } IPAddrInfoList.IPAddrList[i].IPV6 = new ushort[8]; if ((IPAddrInfoList.IPAddrList[i].Flags & (uint)SwnIPAddrInfoFlags.IPADDR_V6) != 0) { Array.Copy(respNotify.MessageBuffer, len + 2 * sizeof(int), IPAddrInfoList.IPAddrList[i].IPV6, 0, 8); } len += 2 * sizeof(int) + 8 * sizeof(ushort); } }