| 86 | 
   | 
                                      PeerAddr => $filter_manager_addr, | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 87 | 
   | 
                                      PeerPort => $filter_manager_port, | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 88 | 
   | 
                                      Proto => 'tcp' | 
 
 
 
 
 
 
 
 
 
 
 
 | 89 | 
 < | 
                                     ); | 
 
 
 
 
 
 
 
 
 
 | 89 | 
 > | 
                                     ) or die "Cannot connect!"; | 
 
 
 
 
 
 
 
 
 
 
 
 | 90 | 
   | 
     if (!defined $sock) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 91 | 
   | 
         print "IHOST ERROR: Could not connect to $filter_manager_addr:$filter_manager_port.\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 92 | 
   | 
         print "Please check that there is an i-scream server at this address.\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 151 | 
   | 
      | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 152 | 
   | 
     print $sock "FILTER\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 153 | 
   | 
     $response = <$sock>; | 
 
 
 
 
 
 
 
 
 | 154 | 
 + | 
     unless (defined($response)) { | 
 
 
 
 
 
 
 
 
 | 155 | 
 + | 
         print "Failed: Could not get a filter address from the filter manager.\n"; | 
 
 
 
 
 
 
 
 
 | 156 | 
 + | 
         exit(1); | 
 
 
 
 
 
 
 
 
 | 157 | 
 + | 
     } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 158 | 
   | 
     chop $response; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 159 | 
   | 
     $response =~ /(.*);(.*);(.*)/; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 160 | 
   | 
     ($filter_addr, $udp_port, $tcp_port) = ($1, $2, $3); | 
 
 
 
 
 
 
 
 
 | 161 | 
 + | 
     unless (defined($filter_addr) && defined($udp_port) && defined($tcp_port)) { | 
 
 
 
 
 
 
 
 
 | 162 | 
 + | 
         print "Failed: Filter address response from server did not make sense: $response\n"; | 
 
 
 
 
 
 
 
 
 | 163 | 
 + | 
         exit(1); | 
 
 
 
 
 
 
 
 
 | 164 | 
 + | 
     } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 165 | 
   | 
      | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 166 | 
   | 
     print "Got filter data ($filter_addr, $udp_port, $tcp_port)\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 167 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 277 | 
   | 
                                       PeerPort => $udp_port, | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 278 | 
   | 
                                       PeerAddr => $filter_addr, | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 279 | 
   | 
                                       Proto => 'udp' | 
 
 
 
 
 
 
 
 
 
 
 
 | 280 | 
 < | 
                                      ) or die "Socket: $!\n"; | 
 
 
 
 
 
 
 
 
 
 | 280 | 
 > | 
                                      ) or die "Could not send UDP: $!\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 | 281 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 282 | 
   | 
     print $sock $xml or die "Could not send UDP packet: $!\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 283 | 
   | 
     close($sock); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 301 | 
   | 
                                      PeerAddr => $filter_addr, | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 302 | 
   | 
                                      PeerPort => $tcp_port, | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 303 | 
   | 
                                      Proto => 'tcp' | 
 
 
 
 
 
 
 
 
 
 
 
 | 304 | 
 < | 
                                     ); | 
 
 
 
 
 
 
 
 
 
 | 304 | 
 > | 
                                     ) or return; | 
 
 
 
 
 
 
 
 
 
 
 
 | 305 | 
   | 
     if (!defined $sock) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 306 | 
   | 
         print "IHOST WARNING: Failed to deliver a heartbeat to the i-scream filter.\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 307 | 
   | 
         return; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 312 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 313 | 
   | 
     print $sock "HEARTBEAT\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 314 | 
   | 
     $response = <$sock>; | 
 
 
 
 
 
 
 
 
 | 315 | 
 + | 
     return if (!defined $response); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 316 | 
   | 
     chop $response; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 317 | 
   | 
     if (!$response eq "OK") { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 318 | 
   | 
         close($sock); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 322 | 
   | 
      | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 323 | 
   | 
     print $sock "CONFIG\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 324 | 
   | 
     $response = <$sock>; | 
 
 
 
 
 
 
 
 
 | 325 | 
 + | 
     return if (!defined $response); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 326 | 
   | 
     chop $response; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 327 | 
   | 
     if (!$response eq "OK") { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 328 | 
   | 
         close($sock); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 332 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 333 | 
   | 
     print $sock "$file_list\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 334 | 
   | 
     $response = <$sock>; | 
 
 
 
 
 
 
 
 
 | 335 | 
 + | 
     return if (!defined $response); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 336 | 
   | 
     chop $response; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 337 | 
   | 
     if (!$response eq "OK") { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 338 | 
   | 
         close($sock); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 342 | 
   | 
      | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 343 | 
   | 
     print $sock "$last_modified\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 344 | 
   | 
     $response = <$sock>; | 
 
 
 
 
 
 
 
 
 | 345 | 
 + | 
     return if (!defined $response); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 346 | 
   | 
     chop $response; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 347 | 
   | 
     if ($response eq "ERROR") { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 348 | 
   | 
         close($sock); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 357 | 
   | 
      | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 358 | 
   | 
     print $sock "ENDHEARTBEAT\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 359 | 
   | 
     $response = <$sock>; | 
 
 
 
 
 
 
 
 
 | 360 | 
 + | 
     return if (!defined $response); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 361 | 
   | 
     chop $response; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 362 | 
   | 
     if (!$response eq "OK") { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 363 | 
   | 
         close($sock); |