| 1 | package Net::UPnP::GW::Gateway; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # Net::UPnP::GW::Gateway | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Net::UPnP::HTTP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 4 | ▶ | use Net::UPnP::Device; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | use Net::UPnP::Service; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 4 | ▶ | use vars qw($_DEVICE $_CONNECTION_SERVICE_TYPE $DEVICE_TYPE $WANIPCONNECTION_SERVICE_TYPE $WANPPPCONNECTION_SERVICE_TYPE $WANCOMMONINTERFACECONFIG_SERVICE_TYPE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 4 | $_DEVICE = 'device'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | $_CONNECTION_SERVICE_TYPE = 'connection_service_type'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 4 | $DEVICE_TYPE = 'urn:schemas-upnp-org:device:InternetGatewayDevice:1'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 4 | $WANIPCONNECTION_SERVICE_TYPE = 'urn:schemas-upnp-org:service:WANIPConnection:1'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 4 | $WANPPPCONNECTION_SERVICE_TYPE = 'urn:schemas-upnp-org:service:WANPPPConnection:1'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 4 | $WANCOMMONINTERFACECONFIG_SERVICE_TYPE = 'urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 11 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 11 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 11 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | my($this) = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | $Net::UPnP::GW::Gateway::_DEVICE => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | $Net::UPnP::GW::Gateway::_CONNECTION_SERVICE_TYPE => $args{connection_service_type}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 11 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 11 | bless $this, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # device | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 10 | ▶ | sub setdevice() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setdevice: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 10 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 10 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 10 | $this->{$Net::UPnP::GW::Gateway::_DEVICE} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 44 | ▶ | sub getdevice() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getdevice: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 44 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 44 | $this->{$Net::UPnP::GW::Gateway::_DEVICE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | # connection service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # Service types tried, in order, when no type has been set explicitly. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # Dial-up (PPPoE/PPPoA) routers often provide only WANPPPConnection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # (RT #60372). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 27 | ▶ | sub _connection_service_types { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_connection_service_types: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 27 | return ($Net::UPnP::GW::Gateway::WANIPCONNECTION_SERVICE_TYPE, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | $Net::UPnP::GW::Gateway::WANPPPCONNECTION_SERVICE_TYPE); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 2 | ▶ | sub setconnectionservicetype { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setconnectionservicetype: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 2 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 2 | $this->{$Net::UPnP::GW::Gateway::_CONNECTION_SERVICE_TYPE} = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 27 | ▶ | sub getconnectionservice { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getconnectionservice: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 27 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 27 | my $dev = $this->getdevice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 27 | ▶ | return undef unless $dev; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 26 | my $type = $this->{$Net::UPnP::GW::Gateway::_CONNECTION_SERVICE_TYPE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 26 | ▶ | my @types = (defined($type) && length($type)) ? ($type) : _connection_service_types(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $type and length $type
MC/DC50%1/2
defined $type and length $type
defined $type
length $type
Truth table66%2/3
A and B
A= defined $typeB= length $type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 26 | foreach my $service_type (@types) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 38 | my $service = $dev->getservicebyname($service_type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 38 | ▶ | return $service if $service; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 6 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 7 | ▶ | sub getconnectionservicetype { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getconnectionservicetype: called CC=7 SCAR=19.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 7 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 7 | my $service = $this->getconnectionservice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 7 | ▶ | return '' unless $service; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 6 | my $type = $this->{$Net::UPnP::GW::Gateway::_CONNECTION_SERVICE_TYPE}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 6 | ▶ | return $type if defined($type) && length($type); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $type and length $type
MC/DC50%1/2
defined $type and length $type
defined $type
length $type
Truth table66%2/3
A and B
A= defined $typeB= length $type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 5 | my $dev = $this->getdevice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 5 | foreach my $service_type (_connection_service_types()) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 7 | my $found = $dev->getservicebyname($service_type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 7 | ▶ | return $service_type if $found && $found == $service; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$found and $found == $service
MC/DC50%1/2
$found and $found == $service
$found
$found == $service
Truth table66%2/3
A and B
A= $foundB= $found == $service
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 4 | ▶ | sub _connectionaction { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_connectionaction: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 4 | my($this, $action_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 4 | my $service = $this->getconnectionservice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 4 | ▶ | return undef unless $service; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 3 | my $action_res = $service->postaction($action_name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 3 | ▶ | return undef unless $action_res->getstatuscode() == 200; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 3 | return $action_res->getargumentlist(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # getstatusinfo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 2 | ▶ | sub getstatusinfo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getstatusinfo: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 2 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 2 | ▶ | my $arg_list = $this->_connectionaction('GetStatusInfo') or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | ConnectionStatus => $arg_list->{'NewConnectionStatus'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | LastConnectionError => $arg_list->{'NewLastConnectionError'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | Uptime => $arg_list->{'NewUptime'}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | # getconnectiontypeinfo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1 | ▶ | sub getconnectiontypeinfo { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getconnectiontypeinfo: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 1 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 1 | ▶ | my $arg_list = $this->_connectionaction('GetConnectionTypeInfo') or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | ConnectionType => $arg_list->{'NewConnectionType'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 1 | PossibleConnectionTypes => $arg_list->{'NewPossibleConnectionTypes'}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # getlinklayermaxbitrates (WANPPPConnection only) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 2 | ▶ | sub getlinklayermaxbitrates { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getlinklayermaxbitrates: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 2 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 2 | ▶ | return undef unless $this->getconnectionservicetype() eq $Net::UPnP::GW::Gateway::WANPPPCONNECTION_SERVICE_TYPE; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 1 | ▶ | my $arg_list = $this->_connectionaction('GetLinkLayerMaxBitRates') or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | UpstreamMaxBitRate => $arg_list->{'NewUpstreamMaxBitRate'}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 1 | DownstreamMaxBitRate => $arg_list->{'NewDownstreamMaxBitRate'}, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # getexternalipaddress | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 3 | ▶ | sub getexternalipaddress { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getexternalipaddress: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 3 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | my ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 3 | $dev, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | $wanipcon_service, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | $action_res, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | $arg_list, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | $ipaddr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 3 | $dev = $this->getdevice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 3 | $wanipcon_service = $this->getconnectionservice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 3 | ▶ | unless ($wanipcon_service) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 1 | return ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 2 | $action_res = $wanipcon_service->postaction("GetExternalIPAddress"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 2 | ▶ | if ($action_res->getstatuscode() != 200) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | return ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 2 | $arg_list = $action_res->getargumentlist(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 2 | $ipaddr = $arg_list->{'NewExternalIPAddress'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 2 | return $ipaddr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | # getportmappingnumberofentries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 2 | ▶ | sub getportmappingnumberofentries { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getportmappingnumberofentries: called CC=4 SCAR=14.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 2 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | my ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 2 | $dev, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | $wanipcon_service, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | $query_res, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 2 | $dev = $this->getdevice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 2 | $wanipcon_service = $this->getconnectionservice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 2 | ▶ | unless ($wanipcon_service) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 1 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 1 | $query_res = $wanipcon_service->postquery("PortMappingNumberOfEntries"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 1 | ▶ | if ($query_res->getstatuscode() != 200) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 1 | ▶ | if( $query_res->getvalue() =~ /^(\d+)$/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | return $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 1 | return scalar($this->getportmappingentries()); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | # getportmapping | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 7 | ▶ | sub getportmappingentries { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getportmappingentries: called CC=15 SCAR=27.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 7 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 7 | my %args = (max_entries => 1024, timeout => 30, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | croak 'Invalid mapping entry limit' unless defined($args{max_entries}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 7 | ▶ | && $args{max_entries} =~ /\A\d+\z/ && Net::UPnP::HTTP::_isfinite(0 + $args{max_entries}) && $args{max_entries} > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
defined $args{"max_entries"} and $args{"max_entries"} =~ /\A\d+\z/ and Net::UPnP::HTTP::_isfinite(0 + $args{"max_entries"}) and $args{"max_entries"} > 0
defined $args{"max_entries"} and $args{"max_entries"} =~ /\A\d+\z/ and Net::UPnP::HTTP::_isfinite(0 + $args{"max_entries"})
defined $args{"max_entries"} and $args{"max_entries"} =~ /\A\d+\z/
MC/DC25%1/4
defined $args{"max_entries"} and $args{"max_entries"} =~ /\A\d+\z/ and Net::UPnP::HTTP::_isfinite(0 + $args{"max_entries"}) and $args{"max_entries"} > 0
defined $args{"max_entries"}
$args{"max_entries"} =~ /\A\d+\z/
Net::UPnP::HTTP::_isfinite(0 + $args{"max_entries"})
$args{"max_entries"} > 0
Truth table40%2/5
A and B and C and D
A= defined $args{"max_entries"}B= $args{"max_entries"} =~ /\A\d+\z/C= Net::UPnP::HTTP::_isfinite(0 + $args{"max_entries"})D= $args{"max_entries"} > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | croak 'Invalid mapping timeout' unless defined($args{timeout}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 6 | ▶ | && $args{timeout} =~ /\A\d+(?:\.\d+)?\z/ && Net::UPnP::HTTP::_isfinite(0 + $args{timeout}) && $args{timeout} > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
defined $args{"timeout"} and $args{"timeout"} =~ /\A\d+(?:\.\d+)?\z/ and Net::UPnP::HTTP::_isfinite(0 + $args{"timeout"}) and $args{"timeout"} > 0
defined $args{"timeout"} and $args{"timeout"} =~ /\A\d+(?:\.\d+)?\z/ and Net::UPnP::HTTP::_isfinite(0 + $args{"timeout"})
defined $args{"timeout"} and $args{"timeout"} =~ /\A\d+(?:\.\d+)?\z/
MC/DC25%1/4
defined $args{"timeout"} and $args{"timeout"} =~ /\A\d+(?:\.\d+)?\z/ and Net::UPnP::HTTP::_isfinite(0 + $args{"timeout"}) and $args{"timeout"} > 0
defined $args{"timeout"}
$args{"timeout"} =~ /\A\d+(?:\.\d+)?\z/
Net::UPnP::HTTP::_isfinite(0 + $args{"timeout"})
$args{"timeout"} > 0
Truth table40%2/5
A and B and C and D
A= defined $args{"timeout"}B= $args{"timeout"} =~ /\A\d+(?:\.\d+)?\z/C= Net::UPnP::HTTP::_isfinite(0 + $args{"timeout"})D= $args{"timeout"} > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 5 | $this->{error} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 5 | my $deadline = Net::UPnP::HTTP::_now() + $args{timeout}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | my ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 5 | @port_mapping, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | $dev, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | $port_mapping_num, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | $wanipcon_service, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | $n, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | %req_arg, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | $action_res, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | $arg_list, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | $ipaddr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 5 | $dev = $this->getdevice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 5 | $wanipcon_service = $this->getconnectionservice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 5 | ▶ | unless ($wanipcon_service) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | return @port_mapping; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 5 | $n = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 5 | ▶ | while ($n < $args{max_entries}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 1035 | ▶ | if (Net::UPnP::HTTP::_now() >= $deadline) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 1 | $this->{error} = 'Port mapping deadline exceeded'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | %req_arg = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 1034 | 'NewPortMappingIndex' => $n, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 1034 | $action_res = $wanipcon_service->postaction("GetGenericPortMappingEntry", \%req_arg, {deadline => $deadline}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | #print "[$n]" .$action_res->getstatuscode() . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | #print %req_arg; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 1034 | ▶ | if ($action_res->getstatuscode() != 200) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 1 | ▶ | $this->{error} = 'Port mapping request failed' if !$action_res->getstatuscode(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 1033 | $arg_list = $action_res->getargumentlist(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | #print $arg_list; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 1033 | push(@port_mapping, $arg_list); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 1033 | ++$n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 5 | ▶ | if ($n == $args{max_entries}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 3 | $this->{error} = 'Port mapping entry limit reached'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 5 | return @port_mapping; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 4 | ▶ | sub geterror { $_[0]->{error} || '' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
geterror: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | # deprecated method - mapped to new name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 1 | ▶ | sub getportmappingentry { getportmappingentries(@_); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
getportmappingentry: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | # addportmapping | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 1 | ▶ | sub addportmapping { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
addportmapping: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 1 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 1 | my %args = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | NewRemoteHost => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | NewExternalPort => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | NewProtocol => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | NewInternalPort => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | NewInternalClient => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | NewEnabled => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | NewPortMappingDescription => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | NewLeaseDuration => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | @_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | my ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 1 | $dev, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | $wanipcon_service, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | $action_res, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | $arg_list, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | $ipaddr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | %req_arg, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 1 | $dev = $this->getdevice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 1 | $wanipcon_service = $this->getconnectionservice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 1 | ▶ | unless ($wanipcon_service) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | %req_arg = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 'NewRemoteHost' => $args{NewRemoteHost}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 'NewExternalPort' => $args{NewExternalPort}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 'NewProtocol' => $args{NewProtocol}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 'NewInternalPort' => $args{NewInternalPort}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 'NewInternalClient' => $args{NewInternalClient}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 'NewEnabled' => $args{NewEnabled}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 'NewPortMappingDescription' => $args{NewPortMappingDescription}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 'NewLeaseDuration' => $args{NewLeaseDuration}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 1 | $action_res = $wanipcon_service->postaction("AddPortMapping", \%req_arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 1 | ▶ | if ($action_res->getstatuscode() != 200) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | # deleteportmapping | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 1 | ▶ | sub deleteportmapping { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
deleteportmapping: called CC=3 SCAR=11.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 1 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 1 | my %args = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | NewRemoteHost => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | NewExternalPort => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | NewProtocol => '', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | @_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | my ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 1 | $dev, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | $wanipcon_service, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | $action_res, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | $arg_list, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | $ipaddr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | %req_arg, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 1 | $dev = $this->getdevice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 1 | $wanipcon_service = $this->getconnectionservice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 1 | ▶ | unless ($wanipcon_service) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | %req_arg = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 'NewRemoteHost' => $args{NewRemoteHost}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 'NewExternalPort' => $args{NewExternalPort}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 'NewProtocol' => $args{NewProtocol}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 1 | $action_res = $wanipcon_service->postaction("DeletePortMapping", \%req_arg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 1 | ▶ | if ($action_res->getstatuscode() != 200) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 1 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | # gettotalbytesreceived | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | ▶ | sub gettotalbytesreceived { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gettotalbytesreceived: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | my ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | $dev, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | $wanconif_service, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | $action_res, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | $arg_list, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | $totalBytes, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | $dev = $this->getdevice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | $wanconif_service = $dev->getservicebyname($Net::UPnP::GW::Gateway::WANCOMMONINTERFACECONFIG_SERVICE_TYPE); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | ▶ | unless ($wanconif_service) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | return ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | $action_res = $wanconif_service->postaction("GetTotalBytesReceived"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | if ($action_res->getstatuscode() != 200) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | return ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | $arg_list = $action_res->getargumentlist(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $totalBytes = $arg_list->{'NewTotalBytesReceived'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | return $totalBytes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | # Backward-compatible alias for the historical misspelling (RT #123509). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 4 | ▶ | { no warnings 'once'; *gettotalbytesrecieved = \&gettotalbytesreceived; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | # gettotalbytessent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | ▶ | sub gettotalbytessent { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gettotalbytessent: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | my ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | $dev, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | $wanconif_service, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | $action_res, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | $arg_list, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | $totalBytes, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | $dev = $this->getdevice(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $wanconif_service = $dev->getservicebyname($Net::UPnP::GW::Gateway::WANCOMMONINTERFACECONFIG_SERVICE_TYPE); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | unless ($wanconif_service) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | return ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | $action_res = $wanconif_service->postaction("GetTotalBytesSent"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | if ($action_res->getstatuscode() != 200) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | return ""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | $arg_list = $action_res->getargumentlist(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | $totalBytes = $arg_list->{'NewTotalBytesSent'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | return $totalBytes; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||