| 1 | package Net::UPnP::ControlPoint; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # Net::UPnP::ControlPoint | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | #----------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use Socket; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 5 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 5 | ▶ | use Net::UPnP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 5 | ▶ | use Net::UPnP::HTTP; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 5 | ▶ | use Net::UPnP::Device; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 12 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 12 | my($class) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 12 | my($this) = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 12 | bless $this, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # search | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | #------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 11 | ▶ | sub search { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
search: called CC=33 SCAR=39.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 11 | my($this) = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 11 | my %args = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | st => 'upnp:rootdevice', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | mx => 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | max_packets => 256, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | max_devices => 64, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | allowed_addresses => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | @_, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 11 | $this->{error} = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 11 | my $extra_addresses = Net::UPnP::HTTP::_address_list($args{allowed_addresses}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 11 | ▶ | croak 'Invalid discovery mx' unless defined($args{mx}) && $args{mx} =~ /\A\d+(?:\.\d+)?\z/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $args{"mx"} and $args{"mx"} =~ /\A\d+(?:\.\d+)?\z/
MC/DC0%0/2
defined $args{"mx"} and $args{"mx"} =~ /\A\d+(?:\.\d+)?\z/
defined $args{"mx"}
$args{"mx"} =~ /\A\d+(?:\.\d+)?\z/
Truth table33%1/3
A and B
A= defined $args{"mx"}B= $args{"mx"} =~ /\A\d+(?:\.\d+)?\z/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 11 | ▶ | croak 'Invalid discovery mx' unless Net::UPnP::HTTP::_isfinite(0 + $args{mx}) && Net::UPnP::HTTP::_isfinite(2 * $args{mx}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
Net::UPnP::HTTP::_isfinite(0 + $args{"mx"}) and Net::UPnP::HTTP::_isfinite(2 * $args{"mx"})
MC/DC50%1/2
Net::UPnP::HTTP::_isfinite(0 + $args{"mx"}) and Net::UPnP::HTTP::_isfinite(2 * $args{"mx"})
Net::UPnP::HTTP::_isfinite(0 + $args{"mx"})
Net::UPnP::HTTP::_isfinite(2 * $args{"mx"})
Truth table66%2/3
A and B
A= Net::UPnP::HTTP::_isfinite(0 + $args{"mx"})B= Net::UPnP::HTTP::_isfinite(2 * $args{"mx"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 10 | foreach my $key (qw(max_packets max_devices)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | croak "Invalid discovery $key" unless defined($args{$key}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 19 | ▶ | && $args{$key} =~ /\A\d+\z/ && Net::UPnP::HTTP::_isfinite(0 + $args{$key}) && $args{$key} > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
defined $args{$key} and $args{$key} =~ /\A\d+\z/ and Net::UPnP::HTTP::_isfinite(0 + $args{$key}) and $args{$key} > 0
defined $args{$key} and $args{$key} =~ /\A\d+\z/ and Net::UPnP::HTTP::_isfinite(0 + $args{$key})
defined $args{$key} and $args{$key} =~ /\A\d+\z/
MC/DC25%1/4
defined $args{$key} and $args{$key} =~ /\A\d+\z/ and Net::UPnP::HTTP::_isfinite(0 + $args{$key}) and $args{$key} > 0
defined $args{$key}
$args{$key} =~ /\A\d+\z/
Net::UPnP::HTTP::_isfinite(0 + $args{$key})
$args{$key} > 0
Truth table40%2/5
A and B and C and D
A= defined $args{$key}B= $args{$key} =~ /\A\d+\z/C= Net::UPnP::HTTP::_isfinite(0 + $args{$key})D= $args{$key} > 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 9 | ▶ | return () unless $args{mx} > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 9 | my $deadline = Net::UPnP::HTTP::_now() + $args{mx} * 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 9 | my ($packets, %seen_location) = (0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | my( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 9 | @dev_list, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | $ssdp_header, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | $ssdp_mcast, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | $rin, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | $rout, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | $ssdp_res_msg, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | $dev_location, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | $dev_addr, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | $dev_port, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | $dev_path, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | $http_req, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | $post_res, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | $post_content, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | $key, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | $dev, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 9 | $ssdp_header = <<"SSDP_SEARCH_MSG"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | M-SEARCH * HTTP/1.1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | Host: $Net::UPnP::SSDP_ADDR:$Net::UPnP::SSDP_PORT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | Man: "ssdp:discover" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | ST: $args{st} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | MX: $args{mx} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | SSDP_SEARCH_MSG | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 9 | $ssdp_header =~ s/\r//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 9 | $ssdp_header =~ s/\n/\r\n/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 9 | ▶ | socket(my $ssdp_sock, AF_INET, SOCK_DGRAM, getprotobyname('udp')) or return (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 9 | $ssdp_mcast = sockaddr_in($Net::UPnP::SSDP_PORT, inet_aton($Net::UPnP::SSDP_ADDR)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 9 | ▶ | unless (send($ssdp_sock, $ssdp_header, 0, $ssdp_mcast)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | close($ssdp_sock); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | return (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 9 | ▶ | if ($Net::UPnP::DEBUG) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | print "$ssdp_header\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 9 | @dev_list = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 9 | $rin = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 9 | vec($rin, fileno($ssdp_sock), 1) = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 9 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 68 | my $remaining = $deadline - Net::UPnP::HTTP::_now(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 68 | ▶ | last if $remaining <= 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 67 | ▶ | last unless select($rout = $rin, undef, undef, $remaining) > 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 61 | my $peer = recv($ssdp_sock, $ssdp_res_msg, 4096, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 61 | ▶ | last unless defined $peer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 61 | my (undef, $peer_address) = sockaddr_in($peer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 61 | my $peer_ip = inet_ntoa($peer_address); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 61 | my ($first) = unpack('C4', $peer_address); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 61 | my @allowed = @$extra_addresses; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # LAN/private and link-local peers are valid UPnP devices. Loopback, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # unspecified and multicast/reserved sources require explicit trust. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 61 | ▶ | push @allowed, $peer_ip if $first > 0 && $first != 127 && $first < 224; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$first > 0 and $first != 127 and $first < 224
$first > 0 and $first != 127
MC/DC0%0/3
$first > 0 and $first != 127 and $first < 224
$first > 0
$first != 127
$first < 224
Truth table25%1/4
A and B and C
A= $first > 0B= $first != 127C= $first < 224
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 61 | ▶ | if (++$packets > $args{max_packets}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 1 | $this->{error} = 'Discovery packet limit exceeded'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 60 | ▶ | print "$ssdp_res_msg" if ($Net::UPnP::DEBUG); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 60 | ▶ | unless ($ssdp_res_msg =~ m/LOCATION[ :]+(.*)\r/i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 14 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 46 | $dev_location = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | # A rejected advertisement from another peer must not poison the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | # legitimate device's later advertisement of the same URL. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 46 | ▶ | next if $seen_location{$peer_ip . "\0" . $dev_location}++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 8 | ▶ | print "dev_location=$dev_location\n" if ($Net::UPnP::DEBUG); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 8 | ▶ | unless ($dev_location =~ m{http://([0-9a-z.-]+)(?::(\d+))?/(.*)}i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | print "bad dev_location: $dev_location\n" if ($Net::UPnP::DEBUG); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 8 | $dev_addr = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 8 | ▶ | $dev_port = $2 || 80; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$2 || 80
MC/DC100%1/1
$2 || 80
$2
Truth table100%2/2
A
A= $2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 8 | $dev_path = '/' . $3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 8 | ▶ | print "dev_addr=$dev_addr dev_port=$dev_port dev_path=$dev_path\n" if ($Net::UPnP::DEBUG); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 8 | $http_req = Net::UPnP::HTTP->new(deadline => $deadline, allowed_addresses => \@allowed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 8 | $post_res = $http_req->post($dev_addr, $dev_port, "GET", $dev_path, "", ""); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 8 | ▶ | unless ($post_res) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 4 | $this->{error} = $http_req->geterror(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 4 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 4 | ▶ | if ($Net::UPnP::DEBUG) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | print $post_res->getstatus() . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | print $post_res->getheader() . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | print $post_res->getcontent() . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 4 | $post_content = $post_res->getcontent(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 4 | $dev = Net::UPnP::Device->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 4 | $dev->setallowedaddresses(\@allowed); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 4 | $dev->setssdp($ssdp_res_msg); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 4 | $dev->setdescription($post_content); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 4 | ▶ | if ($Net::UPnP::DEBUG) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | print "ssdp = $ssdp_res_msg\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | print "description = $post_content\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 4 | push(@dev_list, $dev); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 4 | ▶ | if (@dev_list >= $args{max_devices}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | $this->{error} = 'Discovery device limit reached'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 9 | close($ssdp_sock); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 9 | @dev_list; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 7 | ▶ | sub geterror { $_[0]->{error} || '' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
geterror: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||