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

Class: Net_Wifi

Source Location: /Net_Wifi-1.1.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 53]

Various locations of programs

Type:   array


[ Top ]

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

[line 32]


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_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_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 43]


Type:   mixed


[ Top ]

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

[line 44]


Type:   mixed


[ Top ]

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

[line 45]


Type:   mixed


[ Top ]

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

[line 46]


Type:   mixed


[ Top ]

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

[line 47]


Type:   mixed


[ Top ]

$unknowns =  null

[line 68]

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 75]

Net_Wifi Net_Wifi( )

Constructor which tries to guess the paths of the tools

[ Top ]

connectToAccessPoint   [line 503]

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 104]

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 590]

string getPathIwconfig( )

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

[ Top ]

getPathIwlist   [line 619]

string getPathIwlist( )

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

[ Top ]

getPathProcWireless   [line 562]

string getPathProcWireless( )

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

[ Top ]

getSupportedInterfaces   [line 224]

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 529]

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 208]

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 128]

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 293]

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 ]

scan   [line 271]

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 605]

null setPathIwconfig( string $strPathIwconfig)

Set the path to iwconfig.
  • Access: public

Parameters:

string   $strPathIwconfig     The new ifwconfig path

[ Top ]

setPathIwlist   [line 634]

void setPathIwlist( string $strPathIwlist)

Returns the set path to iwlist.
  • Access: public

Parameters:

string   $strPathIwlist     The new iwlist path

[ Top ]

setPathProcWireless   [line 577]

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 Tue, 20 Oct 2009 21:00:03 +0000 by phpDocumentor 1.4.2. PEAR Logo Copyright © PHP Group 2004.