The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

WlanCurrentConnection( $handle, $interface )

Returns a hashref containing the following keys

  • state - state of the interface

    One of the following

      Win32::Wlan::API::not_ready               => 0,
      Win32::Wlan::API::connected               => 1,
      Win32::Wlan::API::ad_hoc_network_formed   => 2,
      Win32::Wlan::API::disconnecting           => 3,
      Win32::Wlan::API::disconnected            => 4,
      Win32::Wlan::API::associating             => 5,
      Win32::Wlan::API::discovering             => 6,
      Win32::Wlan::API::authenticating          => 7 
  • mode

  • profile_name

    bss_type

      infrastructure   = 1,
      independent      = 2,
      any              = 3 
  • auth_algorithm

      DOT11_AUTH_ALGO_80211_OPEN         = 1,
      DOT11_AUTH_ALGO_80211_SHARED_KEY   = 2,
      DOT11_AUTH_ALGO_WPA                = 3,
      DOT11_AUTH_ALGO_WPA_PSK            = 4,
      DOT11_AUTH_ALGO_WPA_NONE           = 5,
      DOT11_AUTH_ALGO_RSNA               = 6, # wpa2
      DOT11_AUTH_ALGO_RSNA_PSK           = 7, # wpa2
      DOT11_AUTH_ALGO_IHV_START          = 0x80000000,
      DOT11_AUTH_ALGO_IHV_END            = 0xffffffff 
  • cipher_algorithm

      DOT11_CIPHER_ALGO_NONE            = 0x00,
      DOT11_CIPHER_ALGO_WEP40           = 0x01,
      DOT11_CIPHER_ALGO_TKIP            = 0x02,
      DOT11_CIPHER_ALGO_CCMP            = 0x04,
      DOT11_CIPHER_ALGO_WEP104          = 0x05,
      DOT11_CIPHER_ALGO_WPA_USE_GROUP   = 0x100,
      DOT11_CIPHER_ALGO_RSN_USE_GROUP   = 0x100,
      DOT11_CIPHER_ALGO_WEP             = 0x101,
      DOT11_CIPHER_ALGO_IHV_START       = 0x80000000,
      DOT11_CIPHER_ALGO_IHV_END         = 0xffffffff 

NAME

Win32::Wlan::API - Access to the Win32 WLAN API

SYNOPSIS

    use Win32::Wlan::API qw(WlanOpenHandle WlanEnumInterfaces WlanQueryCurrentConnection);
    if ($Win32::Wlan::available) {
        my $handle = WlanOpenHandle();
        my @interfaces = WlanEnumInterfaces($handle);
        my $ih = $interfaces[0]->{guuid};
        # Network adapters are identified by guuid
        print $interfaces[0]->{name};
        my $info = WlanQueryCurrentConnection($handle,$ih);
        print "Connected to $info{ profile_name }\n";        

    } else {
        print "No Wlan detected (or switched off)\n";
    };

SEE ALSO

Windows Native Wifi Reference

http://msdn.microsoft.com/en-us/library/ms706274%28v=VS.85%29.aspx

REPOSITORY

The public repository of this module is http://github.com/Corion/Win32-Wlan.

SUPPORT

The public support forum of this module is http://perlmonks.org/.

BUG TRACKER

Please report bugs in this module via the RT CPAN bug queue at https://rt.cpan.org/Public/Dist/Display.html?Name=Win32-Wlan or via mail to win32-wlan-Bugs@rt.cpan.org.

AUTHOR

Max Maischein corion@cpan.org

COPYRIGHT (c)

Copyright 2011-2011 by Max Maischein corion@cpan.org.

LICENSE

This module is released under the same terms as Perl itself.