| 277 |
|
push(@data, "packet.attributes.type=data"); |
| 278 |
|
push(@data, "packet.attributes.ip=$ip"); |
| 279 |
|
|
| 280 |
+ |
# sort the data |
| 281 |
+ |
@data = sort(@data); |
| 282 |
+ |
|
| 283 |
|
# turn the array into some nice XML |
| 284 |
|
my($xml) = &make_xml("", ""); |
| 285 |
|
|
| 292 |
|
print $sock $xml or die "Could not send UDP packet: $!\n"; |
| 293 |
|
close($sock); |
| 294 |
|
$seq_no++; |
| 295 |
< |
print "-: $xml\n"; |
| 295 |
> |
print "-"; |
| 296 |
|
|
| 297 |
|
return; |
| 298 |
|
} |
| 402 |
|
sub make_xml() { |
| 403 |
|
my($curlevel, $curline) = @_; |
| 404 |
|
my($xmltemp) = ""; my($curtag) = ""; my($attributes) = ""; |
| 405 |
< |
while(true) { |
| 405 |
> |
while(1) { |
| 406 |
|
$curline = shift(@data) if $curline eq ""; chomp $curline; |
| 407 |
|
if($curline =~ /^$curlevel([^\.\s]+\.)/) { |
| 408 |
|
$curtag=$1; |
| 418 |
|
} |
| 419 |
|
my($nextline) = $data[0]; chomp $nextline if defined $nextline; |
| 420 |
|
$curtag =~ s/(.*)\./$1/; |
| 421 |
< |
if(defined $nextline && $nextline =~ /^$curlevel$curtag\./) { |
| 421 |
> |
if((defined $nextline) && ($nextline =~ /^$curlevel$curtag\./)) { |
| 422 |
|
$curline = ""; |
| 423 |
|
} |
| 424 |
|
else { |