/// <summary> /// Retrieves the basic service sets (BSS) list of all available networks. /// </summary> public Wlan.WlanBssEntry[] GetNetworkBssList() { IntPtr bssListPtr; Wlan.ThrowIfError( Wlan.WlanGetNetworkBssList(client.clientHandle, info.interfaceGuid, IntPtr.Zero, Wlan.Dot11BssType.Any, false, IntPtr.Zero, out bssListPtr)); try { return(ConvertBssListPtr(bssListPtr)); } finally { Wlan.WlanFreeMemory(bssListPtr); } }
/// <summary> /// Retrieves the list of available networks. /// </summary> /// <param name="flags">Controls the type of networks returned.</param> /// <returns>A list of the available networks.</returns> public Wlan.WlanAvailableNetwork[] GetAvailableNetworkList(Wlan.WlanGetAvailableNetworkFlags flags) { IntPtr availNetListPtr; Wlan.ThrowIfError( Wlan.WlanGetAvailableNetworkList(client.clientHandle, info.interfaceGuid, flags, IntPtr.Zero, out availNetListPtr)); try { return(ConvertAvailableNetworkListPtr(availNetListPtr)); } finally { Wlan.WlanFreeMemory(availNetListPtr); } }
/// <summary> /// Gets a parameter of the interface whose data type is <see cref="int"/>. /// </summary> /// <param name="opCode">The opcode of the parameter.</param> /// <returns>The integer value.</returns> private int GetInterfaceInt(Wlan.WlanIntfOpcode opCode) { IntPtr valuePtr; int valueSize; Wlan.WlanOpcodeValueType opcodeValueType; Wlan.ThrowIfError( Wlan.WlanQueryInterface(client.clientHandle, info.interfaceGuid, opCode, IntPtr.Zero, out valueSize, out valuePtr, out opcodeValueType)); try { return(Marshal.ReadInt32(valuePtr)); } finally { Wlan.WlanFreeMemory(valuePtr); } }
/// <summary> /// Gets the profile's XML specification. /// </summary> /// <param name="profileName">The name of the profile.</param> /// <returns>The XML document.</returns> public string GetProfileXml(string profileName) { IntPtr profileXmlPtr; Wlan.WlanProfileFlags flags; Wlan.WlanAccess access; Wlan.ThrowIfError( Wlan.WlanGetProfile(client.clientHandle, info.interfaceGuid, profileName, IntPtr.Zero, out profileXmlPtr, out flags, out access)); try { return(Marshal.PtrToStringUni(profileXmlPtr)); } finally { Wlan.WlanFreeMemory(profileXmlPtr); } }
/// <summary> /// Retrieves the basic service sets (BSS) list of the specified network. /// </summary> /// <param name="ssid">Specifies the SSID of the network from which the BSS list is requested.</param> /// <param name="bssType">Indicates the BSS type of the network.</param> /// <param name="securityEnabled">Indicates whether security is enabled on the network.</param> public Wlan.WlanBssEntry[] GetNetworkBssList(Wlan.Dot11Ssid ssid, Wlan.Dot11BssType bssType, bool securityEnabled) { IntPtr ssidPtr = Marshal.AllocHGlobal(Marshal.SizeOf(ssid)); Marshal.StructureToPtr(ssid, ssidPtr, false); try { IntPtr bssListPtr; Wlan.ThrowIfError( Wlan.WlanGetNetworkBssList(client.clientHandle, info.interfaceGuid, ssidPtr, bssType, securityEnabled, IntPtr.Zero, out bssListPtr)); try { return(ConvertBssListPtr(bssListPtr)); } finally { Wlan.WlanFreeMemory(bssListPtr); } } finally { Marshal.FreeHGlobal(ssidPtr); } }
public Wlan.WlanInterfaceCapability GetInterfaceCapability() { IntPtr capabilityPtr; Wlan.ThrowIfError( Wlan.WlanGetInterfaceCapability(client.clientHandle, info.interfaceGuid, IntPtr.Zero, out capabilityPtr)); try { //Wlan.WlanInterfaceCapability capability = new Wlan.WlanInterfaceCapability(); Wlan.WlanInterfaceCapability capability = (Wlan.WlanInterfaceCapability)Marshal.PtrToStructure(capabilityPtr, typeof(Wlan.WlanInterfaceCapability)); return(capability); } finally { Wlan.WlanFreeMemory(capabilityPtr); } }
/// <summary> /// Gets the information of all profiles on this interface. /// </summary> /// <returns>The profiles information.</returns> public Wlan.WlanProfileInfo[] GetProfiles() { IntPtr profileListPtr; Wlan.ThrowIfError( Wlan.WlanGetProfileList(client.clientHandle, info.interfaceGuid, IntPtr.Zero, out profileListPtr)); try { Wlan.WlanProfileInfoListHeader header = (Wlan.WlanProfileInfoListHeader)Marshal.PtrToStructure(profileListPtr, typeof(Wlan.WlanProfileInfoListHeader)); Wlan.WlanProfileInfo[] profileInfos = new Wlan.WlanProfileInfo[header.numberOfItems]; long profileListIterator = profileListPtr.ToInt64() + Marshal.SizeOf(header); for (int i = 0; i < header.numberOfItems; ++i) { Wlan.WlanProfileInfo profileInfo = (Wlan.WlanProfileInfo)Marshal.PtrToStructure(new IntPtr(profileListIterator), typeof(Wlan.WlanProfileInfo)); profileInfos[i] = profileInfo; profileListIterator += Marshal.SizeOf(profileInfo); } return(profileInfos); } finally { Wlan.WlanFreeMemory(profileListPtr); } }