Package nattraverso :: Package pynupnp :: Module upnp :: Class UPnPMapper
[show private | hide private]
[frames | no frames]

Class UPnPMapper

NATMapper --+
            |
           UPnPMapper


This is the UPnP port mapper implementing the NATMapper interface.

See Also: NATMapper

Method Summary
  __init__(self, upnp)
Creates the mapper, with the given UPnPDevice instance.
  get_port_mappings(self)
See interface
  info(self, port)
See interface
  map(self, port)
See interface
  unmap(self, port)
See interface
  _map_got_local_ip(self, ip_result, port)
We got the local ip address, retreive the existing port mappings in the device.
  _map_got_port_mappings(self, mappings, ip, port)
We got all the existing mappings in the device, find an unused one and assign it for the requested port.
  _port_mapping_added(self, extaddr, extport, port)
The port mapping was added in the device, this means:
    Inherited from NATMapper
  _check_valid_port(self, port)
Various Port object validity checks.

Method Details

__init__(self, upnp)
(Constructor)

Creates the mapper, with the given UPnPDevice instance.
Parameters:
upnp - UPnPDevice instance
Overrides:
nattraverso.portmapper.NATMapper.__init__

get_port_mappings(self)

See interface
Overrides:
nattraverso.portmapper.NATMapper.get_port_mappings

info(self, port)

See interface
Overrides:
nattraverso.portmapper.NATMapper.info

map(self, port)

See interface
Overrides:
nattraverso.portmapper.NATMapper.map

unmap(self, port)

See interface
Overrides:
nattraverso.portmapper.NATMapper.unmap

_map_got_local_ip(self, ip_result, port)

We got the local ip address, retreive the existing port mappings in the device.
Parameters:
ip_result - result of ipdiscover.get_local_ip
port - a twisted.internet.interfaces.IListeningPort we want to map

_map_got_port_mappings(self, mappings, ip, port)

We got all the existing mappings in the device, find an unused one and assign it for the requested port.
Parameters:
mappings - result of UPnPDevice.get_port_mappings
ip - The local ip of this host "x.x.x.x"
port - a twisted.internet.interfaces.IListeningPort we want to map

_port_mapping_added(self, extaddr, extport, port)

The port mapping was added in the device, this means:
    Internet        NAT         LAN
                     |
  > IP:extaddr       |>       IP:local ip
  > Port:extport     |>       Port:port
                     |              
Parameters:
extaddr - The exernal ip address
extport - The external port as number
port - The internal port as a twisted.internet.interfaces.IListeningPort object, that has been mapped

Generated by Epydoc 2.1 on Tue Aug 30 14:56:47 2005 http://epydoc.sf.net