Net_Wifi
[ class tree: Net_Wifi ] [ index: Net_Wifi ] [ all elements ]

Class: Net_Wifi

Source Location: /Net_Wifi-1.3.0/Net/Wifi.php

Class Overview


A class for scanning wireless networks and identifying local wireless network interfaces.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 30]
A class for scanning wireless networks and identifying local wireless network interfaces.


[ Top ]


Class Variables

$arFileLocation = array(
        'iwconfig'           => '/usr/sbin/iwconfig',
        'iwlist'             => '/usr/sbin/iwlist',
        '/proc/net/wireless' => '/proc/net/wireless'
    )

[line 59]

Various locations of programs

Type:   array


[ Top ]

$REG_ACCESS_POINT =  '/Access Point: ([0-9:A-F]{17})/'

[line 32]


Type:   mixed


[ Top ]

$REG_AUTH_SUITES =  '|Authentication Suites \([0-9]+\) : (.*)|'

[line 45]


Type:   mixed


[ Top ]

$REG_BIT_RATE =  '/Bit Rate[:=]([0-9.]+) [mk]b\\/s/i'

[line 33]


Type:   mixed


[ Top ]

$REG_ESSID =  '/ESSID:"([^"]+)"/'

[line 34]


Type:   mixed


[ Top ]

$REG_GROUP_CIPHER =  '|Group Cipher : (.*)|'

[line 43]


Type:   mixed


[ Top ]

$REG_INVALID_MISC =  '/Invalid misc[:=](-?[0-9]+)/'

[line 35]


Type:   mixed


[ Top ]

$REG_MISSED_BEACON =  '/Missed beacon[:=](-?[0-9]+)/'

[line 36]


Type:   mixed


[ Top ]

$REG_NICKNAME =  '/Nickname:"([^"]+)"/'

[line 37]


Type:   mixed


[ Top ]

$REG_NOISE_LEVEL =  '/Noise level[:=](-?[0-9]+) dBm/'

[line 38]


Type:   mixed


[ Top ]

$REG_PAIRWISE_CIPHERS =  '|Pairwise Ciphers \([0-9]+\) : (.*)|'

[line 44]


Type:   mixed


[ Top ]

$REG_POWER =  '/Power[:=]([0-9]+) dBm/'

[line 39]


Type:   mixed


[ Top ]

$REG_PROTOCOL_1 =  '/IEEE ([0-9.]+[a-z])/'

[line 40]


Type:   mixed


[ Top ]

$REG_PROTOCOL_2 =  '/([0-9.]+[a-z])\s+linked\s+ESSID/'

[line 41]


Type:   mixed


[ Top ]

$REG_RATES =  '|([0-9.]+) Mb/s|'

[line 42]


Type:   mixed


[ Top ]

$REG_RX_INVALID_CRYPT =  '/Rx invalid crypt[:=](-?[0-9]+)/'

[line 46]


Type:   mixed


[ Top ]

$REG_RX_INVALID_FRAG =  '/Rx invalid frag[:=](-?[0-9]+)/'

[line 47]


Type:   mixed


[ Top ]

$REG_RX_INVALID_NWID =  '/Rx invalid nwid[:=](-?[0-9]+)/'

[line 48]


Type:   mixed


[ Top ]

$REG_SIGNAL_LEVEL =  '/Signal level[:=](-?[0-9]+) dBm/'

[line 49]


Type:   mixed


[ Top ]

$REG_TX_EXCESSIVE_RETRIES =  '/Tx excessive retries[:=](-?[0-9]+)/'

[line 50]


Type:   mixed


[ Top ]

$REG_WPA2_IE_STRING =  'IEEE 802.11i/WPA2 Version 1'

[line 52]


Type:   mixed


[ Top ]

$REG_WPA_IE_STRING =  'WPA Version 1'

[line 51]


Type:   mixed


[ Top ]

$unknowns =  null

[line 74]

How to handle unknown lines in iwconfig output
  • 'echo': Echo to stderr
  • $object: Log to object with debug priority.

assume 'Log' instance

  • null: Ignore unknowns


Type:   string


[ Top ]



Method Detail

Net_Wifi (Constructor)   [line 104]

void Net_Wifi( )

PHP 4 constructor for backwards compatibility.

[ Top ]

__construct (Constructor)   [line 81]

Net_Wifi __construct( )

Constructor which tries to guess the paths of the tools

[ Top ]

connectToAccessPoint   [line 612]

boolean connectToAccessPoint( string $strInterface, string $strMac)

Tells the driver to use the access point with the given MAC address only.

You can use "off" to enable automatic mode again without changing the current AP, or "any" resp. "auto" to force the card to re-associate with the currently best AP

EXPERIMENTAL! WILL CHANGE IN FUTURE VERSIONS

  • Return: True if setting was ok, false if not
  • Access: public

Parameters:

string   $strInterface   —  The interface to use
string   $strMac   —  The mac address of the access point

[ Top ]

getCurrentConfig   [line 119]

Net_Wifi_Config getCurrentConfig( string $strInterface)

Returns an object with the current state of the interface (connected/not connected, AP,...).
  • Return: The state information
  • Access: public

Parameters:

string   $strInterface   —  The interface to check

[ Top ]

getPathIwconfig   [line 699]

string getPathIwconfig( )

Returns the set path to iwconfig.
  • Return: The path to iwconfig
  • Access: public

[ Top ]

getPathIwlist   [line 728]

string getPathIwlist( )

Returns the set path to iwlist.
  • Return: The path to iwlist
  • Access: public

[ Top ]

getPathProcWireless   [line 671]

string getPathProcWireless( )

Returns the set path to /proc/wireless.
  • Return: The path to "/proc/net/wireless"
  • Access: public

[ Top ]

getSupportedInterfaces   [line 239]

array getSupportedInterfaces( )

Returns an array with the names/device files of all supported wireless lan devices.
  • Return: Array with wireless interfaces as values
  • Access: public

[ Top ]

handleUnknown   [line 638]

void handleUnknown( string $strId, string $strSubId)

Handle unknown configuration lines.

Parameters:

string   $strId   —  iwconfig output prefix (i.e. 'frequency')
string   $strSubId   —  iwconfig output value

[ Top ]

isConnected   [line 223]

boolean isConnected( string $strInterface)

Checks if a network interface is connected to an access point.
  • Return: If the interface is connected
  • Access: public

Parameters:

string   $strInterface   —  The network interface to check

[ Top ]

parseCurrentConfig   [line 143]

Net_Wifi_Config parseCurrentConfig( string $strAll)

Parses the iwconfig output to collect the current config information.
  • Return: The current config object
  • Access: protected

Parameters:

string   $strAll   —  The iwconfig output to parse

[ Top ]

parseScan   [line 307]

array parseScan( array $arLines)

Parses the output of iwlist and returns the recognized cells.
  • Return: Array with cell information objects
  • Access: protected

Parameters:

array   $arLines   —  Lines of the iwlist output as an array

[ Top ]

parseWpaCipher   [line 576]

boolean parseWpaCipher( string $strLine, &$arCells, integer $nCurrentCell, string $regex, string $property, array $arCells)

Parse a WPA/WPA2 cipher string and append it to the cell
  • Return: True if a cipher matched
  • Access: protected

Parameters:

string   $strLine   —  Input line that gets parsed
array   $arCells   —  Array of cell data
integer   $nCurrentCell   —  Key of current cell in $arCells
string   $regex   —  Expression to match line against
string   $property   —  Cell property to set (without wpa_/wpa2_)
   &$arCells   — 

[ Top ]

scan   [line 284]

array scan( string $strInterface)

Scans for access points / ad hoc cells and returns them.
  • Return: Array with cell information objects (Net_Wifi_Cell)
  • Access: public

Parameters:

string   $strInterface   —  The interface to use

[ Top ]

setPathIwconfig   [line 714]

null setPathIwconfig( string $strPathIwconfig)

Set the path to iwconfig.
  • Access: public

Parameters:

string   $strPathIwconfig   —  The new ifwconfig path

[ Top ]

setPathIwlist   [line 743]

void setPathIwlist( string $strPathIwlist)

Returns the set path to iwlist.
  • Access: public

Parameters:

string   $strPathIwlist   —  The new iwlist path

[ Top ]

setPathProcWireless   [line 686]

null setPathProcWireless( string $strProcWireless)

Set the path to /proc/net/wireless.
  • Access: public

Parameters:

string   $strProcWireless   —  The new /proc/net/wireless path

[ Top ]


Documentation generated on Wed, 08 Mar 2017 15:30:02 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.