GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::UPNP::GW::GATEWAY (3)

.ds Aq ’

NAME

Net::UPnP::GW::Gateway - Perl extension for UPnP.

CONTENTS

SYNOPSIS



        use Net::UPnP::ControlPoint;
        use Net::UPnP::GW::Gateway;
       
        my $obj = Net::UPnP::ControlPoint->new();
       
        @dev_list = ();
        while (@dev_list <= 0 || $retry_cnt > 5) {
        #       @dev_list = $obj->search(st =>urn:schemas-upnp-org:device:InternetGatewayDevice:1, mx => 10);
                @dev_list = $obj->search(st =>upnp:rootdevice, mx => 3);
                $retry_cnt++;
        }
       
        $devNum= 0;
        foreach $dev (@dev_list) {
                my $device_type = $dev->getdevicetype();
                if  ($device_type ne urn:schemas-upnp-org:device:InternetGatewayDevice:1) {
                        next;
                }
                print "[$devNum] : " . $dev->getfriendlyname() . "\n";
                unless ($dev->getservicebyname(urn:schemas-upnp-org:service:WANIPConnection:1)) {
                        next;
                }
                my $gwdev = Net::UPnP::GW::Gateway->new();
                $gwdev->setdevice($dev);
                print "\tExternalIPAddress = " . $gwdev->getexternalipaddress() . "\n";
                print "\tPortMappingNumberOfEntries = " . $gwdev->getportmappingnumberofentries() . "\n";
                @port_mapping = $gwdev->getportmappingentry();
                $port_num = 0;
                foreach $port_entry (@port_mapping) {
                        if ($port_entry) {
                                $port_map_name = $port_entry->{NewPortMappingDescription};
                                if (length($port_map_name) <= 0) {
                                        $port_map_name = "(No name)";
                                }
                                print "  [$port_num] : $port_map_name\n";
                                foreach $name ( keys %{$port_entry} ) {
                                        print "    $name = $port_entry->{$name}\n";
                                }
                        }
                        else {
                                print "  [$port_num] : Unknown\n";
                        }
                        $port_num++;
                }
        }



DESCRIPTION

The package is a extention UPnP/GW.

METHODS

<B>newB> - create new Net::UPnP::GW::Gateway.


    $mservier = Net::UPnP::GW::Gateway();



Creates a new object. Read ‘perldoc perlbootif you don’t understand that.

The new object is not associated with any UPnP devices. Please use setdevice() to set the device.

<B>setdeviceB> - set a UPnP devices


    $gw->setdevice($dev);



Set a device to the object.

<B>getexternalipaddressB> - External IP address


    $gw->getexternalipaddress();



Get the external IP address.

<B>getportmappingnumberofentriesB> - PortMappingNumberOfEntries


    $gw->getexternalipaddress();



Get the number of the port mapping entries.

<B>getportmappingentryB> - PortMappingEntry


    $gw->getexternalipaddress();



Get the port mapping entries.

<B>addportmappingB> - add new port mapping.


    $result = gw->addportmapping(
                              NewRemoteHost # ,
                              NewExternalPort # ,    
                              NewProtocol # ,
                              NewInternalPort # ,
                              NewInternalClient # ,
                              NewEnabled #1,
                              NewPortMappingDescription # ,
                              NewLeaseDuration # 0);



Add a new specified port mapping.

<B>deleteportmappingB> - delete a port mapping.


    $result = gw->deleteportmapping(
                              NewRemoteHost # ,
                              NewExternalPort # ,    
                              NewProtocol # );



Delete the specified port mapping.

<B>gettotalbytesrecievedB> - Total recieved bytes.


    $gw->gettotalbytesrecieved();



Get the total recieved bytes.

AUTHOR

Satoshi Konno skonno@cybergarage.org

CyberGarage http://www.cybergarage.org

COPYRIGHT AND LICENSE

Copyright (C) 2005 by Satoshi Konno

It may be used, redistributed, and/or modified under the terms of BSD License.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::UPNP::GW::GATEWAY (3) 2014-06-28

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.