/[mdap]/mdap-server.pl
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 /mdap-server.pl

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

revision 69 by dpavlin, Sun Nov 18 10:27:37 2007 UTC revision 86 by dpavlin, Wed Dec 5 23:13:56 2007 UTC
# Line 199  while (1) { Line 199  while (1) {
199                  my $client_version = $h->{'MDAP-VERSION'};                  my $client_version = $h->{'MDAP-VERSION'};
200                  $mdap_ver = $client_version if ($client_version);                  $mdap_ver = $client_version if ($client_version);
201    
                 print "<< $type $proto/$mdap_ver << ", length($data), " bytes: ",_dump_data($data),$/ unless $quiet;  
   
                 warn dump( $data, $h ),$/ if ($debug);  
   
202                  # we are getting our own messages (since our source port                  # we are getting our own messages (since our source port
203                  # is same as destination)                  # is same as destination)
204                  next if ( $type =~ m#^(INFO|ANT-SEARCH|EXEC-CLI)# );                  next if ( $type =~ m#^(INFO|ANT-SEARCH|EXEC-CLI)# );
205    
206                    print "<< $type $proto/$mdap_ver << ", length($data), " bytes: ",_dump_data($data),$/ unless $quiet;
207    
208                    warn dump( $data, $h ),$/ if ($debug);
209    
210                  my $ant = $h->{'ANT-ID'} || die "no ANT-ID in ", dump( $h );                  my $ant = $h->{'ANT-ID'} || die "no ANT-ID in ", dump( $h );
211                  my $seq_nr = $1 if (defined $h->{'SEQ-NR'} && $h->{'SEQ-NR'} =~ m/^-*(\d)+/);                  my $seq_nr = $1 if (defined $h->{'SEQ-NR'} && $h->{'SEQ-NR'} =~ m/^(-*\d)+/);
212                  #warn "SEQ-NR: $seq_nr ok: ",$ant_ok_password->{$ant},"\n" if ($seq_nr);                  #warn "SEQ-NR: $seq_nr ok: ",$ant_ok_password->{$ant},"\n" if ($seq_nr);
213    
214                  my ($user_id,$user_pwd) = ant_credentials( $ant );                  my ($user_id,$user_pwd) = ant_credentials( $ant );
# Line 234  while (1) { Line 234  while (1) {
234                          my $board = $h->{'_BOARD_NAME'} || die "no _BOARD_NAME?";                          my $board = $h->{'_BOARD_NAME'} || die "no _BOARD_NAME?";
235                          if ( fw_exists( $board ) ) {                          if ( fw_exists( $board ) ) {
236                                  my $build = $h->{'_BUILD'} || die "no _BUILD?";                                  my $build = $h->{'_BUILD'} || die "no _BUILD?";
237                                    $build =~ s/^(\d+)\.(\d+)\.(\d+)\.(\d+).*$/$1.$2.$3.$4/;
238                                  my $new_build = fw_build( $board );                                  my $new_build = fw_build( $board );
239                                  if ( $build ne $new_build ) {                                  if ( $build ne $new_build ) {
240                                          print "+ $ant $board version $build -> $new_build\n";                                          print "+ $ant $board version $build -> $new_build\n";
# Line 263  while (1) { Line 264  while (1) {
264                                          }                                          }
265                                  }                                  }
266    
                                 if ( $plugins ) {  
                                         foreach my $plugin ( MDAP->plugins ) {  
                                                 warn "## calling $plugin\n" if $debug;  
                                                 if ( my $command = $plugin->check( $h ) ) {  
   
                                                         warn ">> $plugin $ant $board ",  
                                                                 $h->{'ANT-NAME'}, " ",  
                                                                 $h->{'_BUILD'}, " ",  
                                                                 "\t:$command\n";  
                   
                                                         mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nCLI-CMD:$command\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n");  
                                                         last;  
                                                 }  
                                         }  
                                 }  
   
267                          } else {                          } else {
268                                  once "!! NO FIRMWARE for $board in $tftp_path for ant $ant, skipping update";                                  once "!! NO FIRMWARE for $board in $tftp_path for ant $ant, skipping update";
269                          }                          }
270    
271                            if ( $plugins ) {
272                                    foreach my $plugin ( MDAP->plugins ) {
273                                            warn "## calling $plugin\n" if $debug;
274                                            if ( my $command = $plugin->check( $h ) ) {
275    
276                                                    warn ">> $plugin $ant $board ",
277                                                            $h->{'ANT-NAME'}, " ",
278                                                            $h->{'_BUILD'}, " ",
279                                                            "\t:$command\n";
280            
281                                                    mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nCLI-CMD:$command\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n");
282                                                    last;
283                                            }
284                                    }
285                            }
286    
287                  } elsif ( $type eq 'REPLY-EXEC-CLI' ) {                  } elsif ( $type eq 'REPLY-EXEC-CLI' ) {
288                          print "##<< $type\n$data\n" if $debug;                          print "##<< $type $seq_nr\n$data\n" if $debug;
289                          if ( $seq_nr == 1 ) {                          if ( $seq_nr == 1 ) {
290                                  mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nSEQ-NR:2\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n");                                  mdap_send("EXEC-CLI MDAP/$mdap_ver\r\nSEQ-NR:2\r\nTO-ANT:$ant\r\nUSER-ID:$user_id\r\nUSER-PWD:$user_pwd\r\n");
291                                  forget_ant( $ant ) if ( $ant_flashing->{$ant} );                                  forget_ant( $ant ) if ( $ant_flashing->{$ant} );

Legend:
Removed from v.69  
changed lines
  Added in v.86

  ViewVC Help
Powered by ViewVC 1.1.26