/[Intel-AMT]/trunk/lib/Intel/AMT/SOAP.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Intel/AMT/SOAP.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5 by dpavlin, Sat Aug 8 20:38:06 2009 UTC revision 6 by dpavlin, Sat Aug 8 21:57:47 2009 UTC
# Line 102  sub init() { Line 102  sub init() {
102          $amt_version = $sas->GetCoreVersion()->paramsout;          $amt_version = $sas->GetCoreVersion()->paramsout;
103  }  }
104    
105    sub _soap {
106            my $name = shift;
107    
108            my $proxybase = "http://$amt_host:$amt_port";
109            my $schemabase = "http://schemas.intel.com/platform/client";
110    
111            warn "call_soap $proxybase $name ",dump( @_ );
112    
113            my $soap = SOAP::Lite->new(
114                    proxy      => "$proxybase/${name}Service",
115                    default_ns => "$schemabase/$name/2004/01");
116    
117            $soap->autotype(0);
118    
119            if ( @_ ) {
120                    do_soap($soap, "RemoteControl", @_)
121            } else {
122                    return $soap;
123            }
124    }
125    
126    
127  #############################################################################  #############################################################################
128  # functions  # functions
# Line 224  sub print_general_info() { Line 245  sub print_general_info() {
245          printf "Powerstate:   %s\n", $ps [ $powerstate & 0x0f ];          printf "Powerstate:   %s\n", $ps [ $powerstate & 0x0f ];
246  }  }
247    
 use Intel::AMT::RemoteControl;  
   
 sub describe {  
         warn 'describe ',dump( @_ ) if $amt_debug;  
         my ( $value, $map ) = @_;  
         my $out;  
         foreach my $name ( keys %$map ) {  
                 push @$out, $name if $value & $map->{$name};  
         }  
         push @$out, sprintf("%x", $value) unless $out;  
         return $out;  
 }  
   
 sub RemoteControlCapabilities {  
         my @rccaps = $rcs->GetRemoteControlCapabilities()->paramsout;  
   
         my $return = {  
                 IanaOemNumber => $rccaps[0],  
                 OemDefinedCapabilities =>  
                          describe( $rccaps[1], $Intel::AMT::RemoteControl::OemDefinedCapabilitiesSupported ),  
                 SpecialCommand =>  
                          describe( $rccaps[2], $Intel::AMT::RemoteControl::SpecialCommandSupported ),  
                 SystemCapabilities =>  
                          describe( $rccaps[3], $Intel::AMT::RemoteControl::SystemCapabilitiesSupported ),  
                 SystemFirmwareCapabilities =>  
                          describe( $rccaps[4], $Intel::AMT::RemoteControl::SystemFirmwareCapabilitiesSupported ),  
         };  
   
         warn '# RemoteControlCapabilities ',dump( $return );  
         return $return;  
 }  
   
 sub RemoteControl {  
         my @args;  
   
         my $hostname = $nas->GetHostName()->paramsout;  
         my $domainname = $nas->GetDomainName()->paramsout;  
   
         warn $hostname, '.', $domainname, ' execute: ', dump( @_ );  
   
         my $BootOptions;  
         my $SpecialCommandParameter;  
   
         foreach my $command ( @_ ) {  
   
                 my $i;  
   
                 if ( $i = $Intel::AMT::RemoteControl::BootOptions->{$command} ) {  
                         if ( $BootOptions ) {  
                                 $BootOptions |= $i;  
                                 next;  
                         } else {  
                                 $BootOptions = $i;  
                                 $command = 'SetBootOptions';  
                         }  
                 } elsif ( $i = $Intel::AMT::RemoteControl::SpecialCommandParameters->{$command} ) {  
                         $SpecialCommandParameter |= $i;  
                 } elsif ( $i = $Intel::AMT::RemoteControl::RemoteControlCommand->{$command} ) {  
                         push @args, SOAP::Data->name( 'Command' => $i );  
                 } elsif ( $i = $Intel::AMT::RemoteControl::SpecialCommand->{$command} ) {  
                         push @args, SOAP::Data->name( 'SpecialCommand' => $i );  
                 } elsif ( $i = $Intel::AMT::RemoteControl::OEMParameters->{$command} ) {  
                         push @args, SOAP::Data->name( 'OEMParameters' => $i );  
                 } else {  
                         die "can't find $command";  
                 }  
   
         }  
   
   
         if ( $BootOptions ) {  
                 warn "invalid BootOptions $BootOptions" unless  
                         ( $BootOptions & $Intel::AMT::RemoteControl::BootOptionsReservedBits );  
                 push @args, SOAP::Data->name( 'BootOptions' => $BootOptions );  
         }  
   
         if ( $SpecialCommandParameter ) {  
                 warn "invalid SpecialCommandParameter $SpecialCommandParameter" unless  
                         ( $SpecialCommandParameter & $Intel::AMT::RemoteControl::SpecialCommandParametersReservedBits );  
                 push @args, SOAP::Data->name( 'SpecialCommandParameter' => $SpecialCommandParameter );  
         }  
   
         push @args, SOAP::Data->name( 'IanaOemNumber' => $Intel::AMT::RemoteControl::IanaNumbers->{IntelIanaNumber} );  
         warn "args ",dump( @args );  
   
         do_soap($rcs, "RemoteControl", @args);  
 }  
   
248  sub print_network_info() {  sub print_network_info() {
249          my $ret;          my $ret;
250    
# Line 398  sub command { Line 331  sub command {
331    
332          if ($amt_command eq "info") {          if ($amt_command eq "info") {
333                  print_general_info;                  print_general_info;
                 RemoteControlCapabilities;  
334          } elsif ($amt_command eq "netinfo") {          } elsif ($amt_command eq "netinfo") {
335                  check_amt_version(2,5);                  check_amt_version(2,5);
336                  print_network_info;                  print_network_info;
# Line 415  sub command { Line 347  sub command {
347    
348  warn 'loaded';  warn 'loaded';
349    
 warn 'init ', init;  
   
350  1;  1;

Legend:
Removed from v.5  
changed lines
  Added in v.6

  ViewVC Help
Powered by ViewVC 1.1.26