/[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 7 by dpavlin, Sun Apr 22 15:32:22 2007 UTC revision 8 by dpavlin, Sun Apr 22 16:06:03 2007 UTC
# Line 7  use Data::Dump qw/dump/; Line 7  use Data::Dump qw/dump/;
7  use constant GROUP => '224.0.0.103';  use constant GROUP => '224.0.0.103';
8  use constant PORT  => '3235';  use constant PORT  => '3235';
9    
10    my $debug = shift @ARGV;
11    
12  my $local_port = 1000;  my $local_port = 1000;
13    
14  my $resend_search_delay = 3;  my $resend_search_delay = 3;
# Line 52  sub ant2hash { Line 54  sub ant2hash {
54    
55  sub mdap_send {  sub mdap_send {
56          my $data = shift;          my $data = shift;
57          warn ">> $data\n>>----------\n";          warn ">> $data\n>>----------\n" if ($debug);
58          $sock->mcast_send( "${data}", GROUP . ':' . PORT );          $sock->mcast_send( "${data}", GROUP . ':' . PORT );
59  }  }
60    
# Line 77  while (1) { Line 79  while (1) {
79    
80                  my $ant = $h->{'ANT-ID'} || die "no ANT-ID in ", dump( $h );                  my $ant = $h->{'ANT-ID'} || die "no ANT-ID in ", dump( $h );
81    
82                  print "# $type $proto ", dump( $h ), $/;                  print "<< $type $proto ", length($data), " bytes\n";
83    
84                    warn dump($h),$/ if ($debug);
85    
86                  if ($type eq 'REPLY-ANT-SEARCH') {                  if ($type eq 'REPLY-ANT-SEARCH') {
87                          mdap_send("INFO MDAP/1.2\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:Administrator\r\nUSER-PWD:\r\n22");                          mdap_send("INFO MDAP/1.2\r\nSEQ-NR:1\r\nTO-ANT:$ant\r\nUSER-ID:Administrator\r\nUSER-PWD:\r\n22");
# Line 95  while (1) { Line 99  while (1) {
99                          }                          }
100                  } elsif ( $type eq 'REPLY-EXEC-CLI' && $h->{'SEQ-NR'} == 1 ) {                  } elsif ( $type eq 'REPLY-EXEC-CLI' && $h->{'SEQ-NR'} == 1 ) {
101                                  print "UPDATE STEP 2 on ant $ant\n";                                  print "UPDATE STEP 2 on ant $ant\n";
102                                  mdap_send("EXEC-CLI MDAP/1.2\r\nSEQ-NR:2\r\nTO-ANT:0644JTHJ4\r\nUSER-ID:Administrator\r\nUSER-PWD:\r\n5F");                                  mdap_send("EXEC-CLI MDAP/1.2\r\nSEQ-NR:2\r\nTO-ANT:$ant\r\nUSER-ID:Administrator\r\nUSER-PWD:\r\n5F");
103                  } else {                  } else {
104                          print "!! reply ignored\n";                          print "!! reply ignored ", dump( $h ), $/;
105                  }                  }
106    
107          } else {          } else {
108                  print $data, "\n", "-" x 30, "\n";                  warn "<=" x 15, "\n", $data, "\n", "<=" x 15, "\n";
109          }          }
110  }  }

Legend:
Removed from v.7  
changed lines
  Added in v.8

  ViewVC Help
Powered by ViewVC 1.1.26