From b7333230be8059baf72345b67c78823c5a929906 Mon Sep 17 00:00:00 2001 From: Tomas Plesnik <plesnik@ics.muni.cz> Date: Tue, 13 Dec 2011 22:59:16 +0100 Subject: [PATCH] zmena nazvu promenych pro rozliseni request a response dat --- src/warden-client/lib/WardenClientReceive.pm | 36 ++++++------- src/warden-server/lib/WardenReg.pm | 12 ++--- src/warden-server/lib/WardenStatus.pm | 56 ++++++++++---------- 3 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/warden-client/lib/WardenClientReceive.pm b/src/warden-client/lib/WardenClientReceive.pm index 779b461..556e7f4 100755 --- a/src/warden-client/lib/WardenClientReceive.pm +++ b/src/warden-client/lib/WardenClientReceive.pm @@ -144,11 +144,11 @@ sub getNewEvents # get new events from warden server DB based on gathered last ID # create SOAP data obejct - my $data = SOAP::Data->name(request => \SOAP::Data->value( + my $request_data = SOAP::Data->name(request => \SOAP::Data->value( SOAP::Data->name(REQUESTED_TYPE => $requested_type), SOAP::Data->name(LAST_ID => $last_id) )); - my $response = c2s($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, "getNewEvents", $data); + my $response = c2s($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, "getNewEvents", $request_data); # match getNewEvents functions response $response->match('/Envelope/Body/getNewEventsResponse/'); @@ -157,24 +157,24 @@ sub getNewEvents # parse returned SOAP data object my $i = 1; - $data = $response->valueof("[$i]"); - while (defined $data) { + my $response_data = $response->valueof("[$i]"); + while (defined $response_data) { my @event; # parse items of one event - $id = $data->{'ID'}; - $hostname = $data->{'HOSTNAME'}; - $service = $data->{'SERVICE'}; - $detected = $data->{'DETECTED'}; - $type = $data->{'TYPE'}; - $source_type = $data->{'SOURCE_TYPE'}; - $source = $data->{'SOURCE'}; - $target_proto = $data->{'TARGET_PROTO'}; - $target_port = $data->{'TARGET_PORT'}; - $attack_scale = $data->{'ATTACK_SCALE'}; - $note = $data->{'NOTE'}; - $priority = $data->{'PRIORITY'}; - $timeout = $data->{'TIMEOUT'}; + $id = $response_data->{'ID'}; + $hostname = $response_data->{'HOSTNAME'}; + $service = $response_data->{'SERVICE'}; + $detected = $response_data->{'DETECTED'}; + $type = $response_data->{'TYPE'}; + $source_type = $response_data->{'SOURCE_TYPE'}; + $source = $response_data->{'SOURCE'}; + $target_proto = $response_data->{'TARGET_PROTO'}; + $target_port = $response_data->{'TARGET_PORT'}; + $attack_scale = $response_data->{'ATTACK_SCALE'}; + $note = $response_data->{'NOTE'}; + $priority = $response_data->{'PRIORITY'}; + $timeout = $response_data->{'TIMEOUT'}; # push new event from warden server into @events which is returned @event = ("$id", "$hostname", "$service", "$detected", "$type", "$source_type", "$source", "$target_proto", "$target_port", "$attack_scale", "$note", "$priority", "$timeout"); @@ -187,7 +187,7 @@ sub getNewEvents # go to the next received event $i++; - $data = $response->valueof("[$i]"); + $response_data = $response->valueof("[$i]"); } # write last return ID diff --git a/src/warden-server/lib/WardenReg.pm b/src/warden-server/lib/WardenReg.pm index ec442bf..a114a2d 100755 --- a/src/warden-server/lib/WardenReg.pm +++ b/src/warden-server/lib/WardenReg.pm @@ -116,7 +116,7 @@ sub registerSender my ($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file) = WardenConf::loadConf($conf_file); # create SOAP data obejct - my $data = SOAP::Data->name(client => \SOAP::Data->value( + my $request_data = SOAP::Data->name(client => \SOAP::Data->value( SOAP::Data->name(HOSTNAME => $hostname), SOAP::Data->name(REQUESTOR => $requestor), SOAP::Data->name(SERVICE => $service), @@ -124,7 +124,7 @@ sub registerSender SOAP::Data->name(IP_NET_CLIENT => $ip_net_client) )); - my $result = c2s($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, "registerSender", $data); + my $result = c2s($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, "registerSender", $request_data); $result ? return 1 : return 0; } # End of registerSender @@ -151,7 +151,7 @@ sub registerReceiver my ($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file) = WardenConf::loadConf($conf_file); # create SOAP data obejct - my $data = SOAP::Data->name(client => \SOAP::Data->value( + my $request_data = SOAP::Data->name(client => \SOAP::Data->value( SOAP::Data->name(HOSTNAME => $hostname), SOAP::Data->name(REQUESTOR => $requestor), SOAP::Data->name(TYPE => $type), @@ -159,7 +159,7 @@ sub registerReceiver SOAP::Data->name(IP_NET_CLIENT => $ip_net_client) )); - my $result = c2s($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, "registerReceiver", $data); + my $result = c2s($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, "registerReceiver", $request_data); $result ? return 1 : return 0; } # End of registerReceiver @@ -182,11 +182,11 @@ sub unregisterClient my ($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file) = WardenConf::loadConf($conf_file); # create SOAP data obejct - my $data = SOAP::Data->name(client => \SOAP::Data->value( + my $request_data = SOAP::Data->name(client => \SOAP::Data->value( SOAP::Data->name(CLIENT_ID => $client_id) )); - my $result = c2s($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, "unregisterClient", $data); + my $result = c2s($uri, $ssl_key_file, $ssl_cert_file, $ssl_ca_file, "unregisterClient", $request_data); $result ? return 1 : return 0; } # End of unregisterClient diff --git a/src/warden-server/lib/WardenStatus.pm b/src/warden-server/lib/WardenStatus.pm index e13868a..8088862 100755 --- a/src/warden-server/lib/WardenStatus.pm +++ b/src/warden-server/lib/WardenStatus.pm @@ -116,24 +116,24 @@ sub getClients my $i = 1; my ($client_id, $hostname, $registered, $requestor, $service, $client_type, $type, $receive_own_events, $description_tags, $ip_net_client); my @clients; - my $data = $response->valueof("[$i]"); + my $response_data = $response->valueof("[$i]"); # parse returned data object - while (defined $data) { + while (defined $response_data) { # inicialization of temporal client array my @client; # parse items of one client - $client_id = $data->{'CLIENT_ID'}; - $hostname = $data->{'HOSTNAME'}; - $registered = $data->{'REGISTERED'}; - $requestor = $data->{'REQUESTOR'}; - $service = $data->{'SERVICE'}; - $client_type = $data->{'CLIENT_TYPE'}; - $type = $data->{'TYPE'}; - $receive_own_events = $data->{'RECEIVE_OWN_EVENTS'}; - $description_tags = $data->{'DESCRIPTION_TAGS'}; - $ip_net_client = $data->{'IP_NET_CLIENT'}; + $client_id = $response_data->{'CLIENT_ID'}; + $hostname = $response_data->{'HOSTNAME'}; + $registered = $response_data->{'REGISTERED'}; + $requestor = $response_data->{'REQUESTOR'}; + $service = $response_data->{'SERVICE'}; + $client_type = $response_data->{'CLIENT_TYPE'}; + $type = $response_data->{'TYPE'}; + $receive_own_events = $response_data->{'RECEIVE_OWN_EVENTS'}; + $description_tags = $response_data->{'DESCRIPTION_TAGS'}; + $ip_net_client = $response_data->{'IP_NET_CLIENT'}; # push received clients from warden server into @clients which is returned @client = ("$client_id", "$hostname", "$registered", "$requestor", "$service", "$client_type", "$type", "$receive_own_events", "$description_tags", "$ip_net_client"); @@ -141,7 +141,7 @@ sub getClients # go to the next received client $i++; - $data = $response->valueof("[$i]"); + $response_data = $response->valueof("[$i]"); } return @clients; } # End of getClients @@ -170,31 +170,31 @@ sub getStatus my $i = 1; # get first value from SOAP data object - my $data = $response->valueof("[$i]"); + my $response_data = $response->valueof("[$i]"); # parse items of server status - my $db_size = $data->{'DB_SIZE'}; - my $events_sum = $data->{'EVENTS_SUM'}; - my $events_last_id = $data->{'EVENTS_LAST_ID'}; - my $events_first_timestamp = $data->{'EVENTS_FIRST_TIMESTAMP'}; - my $events_last_timestamp = $data->{'EVENTS_LAST_TIMESTAMP'}; - my $clients_sum = $data->{'CLIENTS_SUM'}; + my $db_size = $response_data->{'DB_SIZE'}; + my $events_sum = $response_data->{'EVENTS_SUM'}; + my $events_last_id = $response_data->{'EVENTS_LAST_ID'}; + my $events_first_timestamp = $response_data->{'EVENTS_FIRST_TIMESTAMP'}; + my $events_last_timestamp = $response_data->{'EVENTS_LAST_TIMESTAMP'}; + my $clients_sum = $response_data->{'CLIENTS_SUM'}; my @server_status = ("$db_size", "$events_sum", "$events_last_id", "$events_first_timestamp", "$events_last_timestamp", "$clients_sum"); push(@status, \@server_status); $i++; - $data = $response->valueof("[$i]"); - while (defined $data) { + $response_data = $response->valueof("[$i]"); + while (defined $response_data) { my @client_status; # parse SOAP data object - my $client_id = $data->{'CLIENT_ID'}; - my $hostname = $data->{'HOSTNAME'}; - my $service = $data->{'SERVICE'}; - my $count = $data->{'COUNT'}; - my $timestamp = $data->{'TIMESTAMP'}; + my $client_id = $response_data->{'CLIENT_ID'}; + my $hostname = $response_data->{'HOSTNAME'}; + my $service = $response_data->{'SERVICE'}; + my $count = $response_data->{'COUNT'}; + my $timestamp = $response_data->{'TIMESTAMP'}; @client_status = ("$client_id", "$hostname", "$service", "$count", "$timestamp"); push(@status, \@client_status); $i++; - $data = $response->valueof("[$i]"); + $response_data = $response->valueof("[$i]"); } return @status; -- GitLab