summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ce793d3)
raw | patch | inline | side by side (parent: ce793d3)
author | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 30 Jun 2008 15:05:02 +0000 (15:05 +0000) | ||
committer | rettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 30 Jun 2008 15:05:02 +0000 (15:05 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11484 594d385d-05f5-0310-b6e9-bd551577e9d8
index 6703714c9ccec539dca266a3245f4444a9d257dc..5c377e227bbb4ce4f85850cb8f3764ea3b99ff07 100644 (file)
my $res = $main::job_db->exec_statement($sql_statement);
}
+ # build out message
+ my $out_hash = &create_xml_hash("trigger_wake", "GOSA", "KNOWN_SERVER");
+ &add_content2xml_hash($out_hash, 'macAddress', $msg_hash->{macaddress});
+ my $out_msg = &create_xml_string($out_hash);
+
+ # invoke trigger wake for this gosa-si-server
+ &main::server_server_com::trigger_wake($out_msg, $out_hash, $session_id);
- my %data = ( 'macAddress' => \@{$msg_hash->{macaddress}} );
- my $out_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data);
+ #my %data = ( 'macAddress' => \@{$msg_hash->{macaddress}} );
+ #my $out_msg = &build_msg("trigger_wake", "GOSA", "KNOWN_SERVER", \%data);
+
+ # send trigger wake to all other gosa-si-server
my @out_msg_l = ($out_msg);
return @out_msg_l;
}
diff --git a/gosa-si/server/events/server_server_com.pm b/gosa-si/server/events/server_server_com.pm
index b1abc8e12092e0761870f483f72ac74d14dae698..8972f97a00aec6fbe3e81decd99b8d0032215101 100644 (file)
'new_server',
'confirm_new_server',
'new_foreign_client',
+ 'trigger_wake',
);
@EXPORT = @events;
}
+sub trigger_wake {
+ my ($msg, $msg_hash, $session_id) = @_ ;
+
+ foreach (@{$msg_hash->{macAddress}}){
+ &main::daemon_log("$session_id INFO: trigger wake for $_", 5);
+ my $host = $_;
+ my $ipaddr = '255.255.255.255';
+ my $port = getservbyname('discard', 'udp');
+
+ my ($raddr, $them, $proto);
+ my ($hwaddr, $hwaddr_re, $pkt);
+
+ # get the hardware address (ethernet address)
+ $hwaddr_re = join(':', ('[0-9A-Fa-f]{1,2}') x 6);
+ if ($host =~ m/^$hwaddr_re$/) {
+ $hwaddr = $host;
+ } else {
+ &main::daemon_log("$session_id ERROR: trigger_wake called with non mac address", 1);
+ }
+
+ # Generate magic sequence
+ foreach (split /:/, $hwaddr) {
+ $pkt .= chr(hex($_));
+ }
+ $pkt = chr(0xFF) x 6 . $pkt x 16;
+
+ # Allocate socket and send packet
+
+ $raddr = gethostbyname($ipaddr);
+ $them = pack_sockaddr_in($port, $raddr);
+ $proto = getprotobyname('udp');
+
+ socket(S, AF_INET, SOCK_DGRAM, $proto) or die "socket : $!";
+ setsockopt(S, SOL_SOCKET, SO_BROADCAST, 1) or die "setsockopt : $!";
+
+ send(S, $pkt, 0, $them) or die "send : $!";
+ close S;
+ }
+
+ return;
+}
+
+
1;
index 25582abf8efff17527896f416cf137529425ae96..7694b19103628a0d084cbdc46081249132a78483 100644 (file)
}
-sub trigger_wake {
- my ($msg, $msg_hash, $session_id) = @_ ;
-
- foreach (@{$msg_hash->{macAddress}}){
- &main::daemon_log("$session_id INFO: trigger wake for $_", 5);
- my $host = $_;
- my $ipaddr = '255.255.255.255';
- my $port = getservbyname('discard', 'udp');
-
- my ($raddr, $them, $proto);
- my ($hwaddr, $hwaddr_re, $pkt);
-
- # get the hardware address (ethernet address)
- $hwaddr_re = join(':', ('[0-9A-Fa-f]{1,2}') x 6);
- if ($host =~ m/^$hwaddr_re$/) {
- $hwaddr = $host;
- } else {
- &main::daemon_log("$session_id ERROR: trigger_wake called with non mac address", 1);
- }
-
- # Generate magic sequence
- foreach (split /:/, $hwaddr) {
- $pkt .= chr(hex($_));
- }
- $pkt = chr(0xFF) x 6 . $pkt x 16;
-
- # Allocate socket and send packet
-
- $raddr = gethostbyname($ipaddr);
- $them = pack_sockaddr_in($port, $raddr);
- $proto = getprotobyname('udp');
-
- socket(S, AF_INET, SOCK_DGRAM, $proto) or die "socket : $!";
- setsockopt(S, SOL_SOCKET, SO_BROADCAST, 1) or die "setsockopt : $!";
-
- send(S, $pkt, 0, $them) or die "send : $!";
- close S;
- }
-
- return;
-}
+# moved to server_server_com.pm: rettenbe 30.06.2008
+#sub trigger_wake {
+# my ($msg, $msg_hash, $session_id) = @_ ;
+#
+# foreach (@{$msg_hash->{macAddress}}){
+# &main::daemon_log("$session_id INFO: trigger wake for $_", 5);
+# my $host = $_;
+# my $ipaddr = '255.255.255.255';
+# my $port = getservbyname('discard', 'udp');
+#
+# my ($raddr, $them, $proto);
+# my ($hwaddr, $hwaddr_re, $pkt);
+#
+# # get the hardware address (ethernet address)
+# $hwaddr_re = join(':', ('[0-9A-Fa-f]{1,2}') x 6);
+# if ($host =~ m/^$hwaddr_re$/) {
+# $hwaddr = $host;
+# } else {
+# &main::daemon_log("$session_id ERROR: trigger_wake called with non mac address", 1);
+# }
+#
+# # Generate magic sequence
+# foreach (split /:/, $hwaddr) {
+# $pkt .= chr(hex($_));
+# }
+# $pkt = chr(0xFF) x 6 . $pkt x 16;
+#
+# # Allocate socket and send packet
+#
+# $raddr = gethostbyname($ipaddr);
+# $them = pack_sockaddr_in($port, $raddr);
+# $proto = getprotobyname('udp');
+#
+# socket(S, AF_INET, SOCK_DGRAM, $proto) or die "socket : $!";
+# setsockopt(S, SOL_SOCKET, SO_BROADCAST, 1) or die "setsockopt : $!";
+#
+# send(S, $pkt, 0, $them) or die "send : $!";
+# close S;
+# }
+#
+# return;
+#}
1;
index 32fb6212b3ccfb92d2b224aaf7f9619ceb86a2b7..1707c5ae52e0a2717ba7ed28debdfe156bfcdbc6 100755 (executable)
"modules/SIPackages.pm" => "/usr/lib/gosa-si/modules/SIPackages.pm",
"modules/DBsqlite.pm" => "/usr/share/perl5/GOSA/DBsqlite.pm",
"modules/GosaSupportDaemon.pm" => "/usr/share/perl5/GOSA/GosaSupportDaemon.pm",
- "sever/events/clMessages.pm" => "/usr/lib/gosa-si/server/events/clMessages.pm",
- "sever/events/databases.pm" => "/usr/lib/gosa-si/server/events/databases.pm",
- "sever/events/gosaTriggered.pm" => "/usr/lib/gosa-si/server/events/gosaTriggered.pm",
- "sever/events/siTriggered.pm" => "/usr/lib/gosa-si/server/events/siTriggered.pm",
+ "server/events/clMessages.pm" => "/usr/lib/gosa-si/server/events/clMessages.pm",
+ "server/events/databases.pm" => "/usr/lib/gosa-si/server/events/databases.pm",
+ "server/events/gosaTriggered.pm" => "/usr/lib/gosa-si/server/events/gosaTriggered.pm",
+ "server/events/siTriggered.pm" => "/usr/lib/gosa-si/server/events/siTriggered.pm",
);
while( my($file_name, $new_file) = each %copies ) {