1Net::UPnP::GW::Gateway(U3s)er Contributed Perl DocumentatNieotn::UPnP::GW::Gateway(3)
2
3
4

NAME

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

SYNOPSIS

9               use Net::UPnP::ControlPoint;
10               use Net::UPnP::GW::Gateway;
11
12               my $obj = Net::UPnP::ControlPoint->new();
13
14               @dev_list = ();
15               while (@dev_list <= 0 || $retry_cnt > 5) {
16               #       @dev_list = $obj->search(st =>'urn:schemas-upnp-org:device:InternetGatewayDevice:1', mx => 10);
17                       @dev_list = $obj->search(st =>'upnp:rootdevice', mx => 3);
18                       $retry_cnt++;
19               }
20
21               $devNum= 0;
22               foreach $dev (@dev_list) {
23                       my $device_type = $dev->getdevicetype();
24                       if  ($device_type ne 'urn:schemas-upnp-org:device:InternetGatewayDevice:1') {
25                               next;
26                       }
27                       print "[$devNum] : " . $dev->getfriendlyname() . "\n";
28                       unless ($dev->getservicebyname('urn:schemas-upnp-org:service:WANIPConnection:1')) {
29                               next;
30                       }
31                       my $gwdev = Net::UPnP::GW::Gateway->new();
32                       $gwdev->setdevice($dev);
33                       print "\tExternalIPAddress = " . $gwdev->getexternalipaddress() . "\n";
34                       print "\tPortMappingNumberOfEntries = " . $gwdev->getportmappingnumberofentries() . "\n";
35                       @port_mapping = $gwdev->getportmappingentries();
36                       $port_num = 0;
37                       foreach $port_entry (@port_mapping) {
38                               $port_map_name = $port_entry->{'NewPortMappingDescription'};
39                               if (length($port_map_name) <= 0) {
40                                       $port_map_name = "(No name)";
41                               }
42                               print "  [$port_num] : $port_map_name\n";
43                               foreach $name ( keys %{$port_entry} ) {
44                                       print "    $name = $port_entry->{$name}\n";
45                               }
46                               $port_num++;
47                       }
48               }
49

DESCRIPTION

51       The package is a extention UPnP/GW.
52

METHODS

54       new - create new Net::UPnP::GW::Gateway.
55               $mservier = Net::UPnP::GW::Gateway();
56
57           Creates a new object. Read `perldoc perlboot` if you don't
58           understand that.
59
60           The new object is not associated with any UPnP devices. Please use
61           setdevice() to set the device.
62
63       setdevice - set a UPnP devices
64               $gw->setdevice($dev);
65
66           Set a device to the object.
67
68       getexternalipaddress - External IP address
69               $gw->getexternalipaddress();
70
71           Get the external IP address.
72
73       getportmappingnumberofentries - PortMappingNumberOfEntries
74               $gw->getportmappingnumberofentries();
75
76           Get the number of the port mapping entries.
77
78       getportmappingentries - PortMappingEntry
79               $gw->getportmappingentries();
80
81           Get the port mapping entries.
82
83       addportmapping - add new port mapping.
84               $result = gw->addportmapping(
85                                         NewRemoteHost # '',
86                                         NewExternalPort # '',
87                                         NewProtocol # '',
88                                         NewInternalPort # '',
89                                         NewInternalClient # '',
90                                         NewEnabled #1,
91                                         NewPortMappingDescription # '',
92                                         NewLeaseDuration # 0);
93
94           Add a new specified port mapping.
95
96       deleteportmapping - delete a port mapping.
97               $result = gw->deleteportmapping(
98                                         NewRemoteHost # '',
99                                         NewExternalPort # '',
100                                         NewProtocol # '');
101
102           Delete the specified port mapping.
103
104       gettotalbytesrecieved - Total recieved bytes.
105               $gw->gettotalbytesrecieved();
106
107           Get the total recieved bytes.
108

AUTHOR

110       Satoshi Konno skonno@cybergarage.org
111
112       CyberGarage http://www.cybergarage.org
113
115       Copyright (C) 2005 by Satoshi Konno
116
117       It may be used, redistributed, and/or modified under the terms of BSD
118       License.
119
120
121
122perl v5.32.0                      2020-07-28         Net::UPnP::GW::Gateway(3)
Impressum