/[cwmp]/google/trunk/lib/CWMP/Request.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 /google/trunk/lib/CWMP/Request.pm

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

revision 36 by dpavlin, Tue Jun 19 00:38:49 2007 UTC revision 71 by dpavlin, Wed Jun 20 23:35:04 2007 UTC
# Line 51  my $parser = XML::Rules->new( Line 51  my $parser = XML::Rules->new(
51  #               '^division_name,fax' => 'skip',  #               '^division_name,fax' => 'skip',
52  #       ],  #       ],
53          namespaces => {          namespaces => {
54  #               'http://schemas.xmlsoap.org/soap/envelope/' => 'soapenv',                  'http://schemas.xmlsoap.org/soap/envelope/' => 'soapenv',
55  #               'http://schemas.xmlsoap.org/soap/encoding/' => 'soap',                  'http://schemas.xmlsoap.org/soap/encoding/' => 'soap',
56                    'http://www.w3.org/2001/XMLSchema' => 'xsd',
57                    'http://www.w3.org/2001/XMLSchema-instance' => 'xsi',
58                  'urn:dslforum-org:cwmp-1-0' => '',                  'urn:dslforum-org:cwmp-1-0' => '',
59          },          },
60          rules => [          rules => [
# Line 69  my $parser = XML::Rules->new( Line 71  my $parser = XML::Rules->new(
71                  # Inform                  # Inform
72                  #                  #
73                  'Inform' => sub {                  'Inform' => sub {
74                          $state->{_dispatch} = 'Inform';         # what reponse to call                          $state->{_dispatch} = 'InformResponse';         # what reponse to call
75                  },                  },
76                  qr/DeviceId/ => sub {                  'DeviceId' => sub {
77                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;
78                          foreach my $name ( keys %$tag_hash ) {                          foreach my $name ( keys %$tag_hash ) {
79                                  next if $name eq '_content';                                  next if $name eq '_content';
# Line 80  my $parser = XML::Rules->new( Line 82  my $parser = XML::Rules->new(
82                                  $state->{DeviceID}->{ $key } = _tag( $tag_hash, $name, '_content' );                                  $state->{DeviceID}->{ $key } = _tag( $tag_hash, $name, '_content' );
83                          }                          }
84                  },                  },
85                  qr/EventStruct/ => sub {                  'EventStruct' => sub {
86                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;
87                          push @{ $state->{EventStruct} }, $tag_hash->{EventCode}->{_content};                          push @{ $state->{EventStruct} }, $tag_hash->{EventCode}->{_content};
88                  },                  },
# Line 88  my $parser = XML::Rules->new( Line 90  my $parser = XML::Rules->new(
90                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;
91                          $state->{$tag_name} = $tag_hash->{_content};                          $state->{$tag_name} = $tag_hash->{_content};
92                  },                  },
93                  qr/ParameterValueStruct/ => sub {                  'ParameterValueStruct' => sub {
94                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;
95                          # Name/Value tags must be case insnesitive                          # Name/Value tags must be case insnesitive
96                          my $value = (grep( /value/i, keys %$tag_hash ))[0];                          my $value = (grep( /value/i, keys %$tag_hash ))[0];
# Line 98  my $parser = XML::Rules->new( Line 100  my $parser = XML::Rules->new(
100                  # GetRPCMethodsResponse                  # GetRPCMethodsResponse
101                  #                  #
102                  qr/^(?:^\w+:)*string$/ => 'content array',                  qr/^(?:^\w+:)*string$/ => 'content array',
103                  qr/MethodList/ => sub {                  'MethodList' => sub {
104                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;                          my ($tag_name, $tag_hash, $context, $parent_data) = @_;
105                          $state->{MethodList} = _tag( $tag_hash, 'string' );                          $state->{MethodList} = _tag( $tag_hash, 'string' );
106                  },                        },
107                    #
108                    # GetParameterNamesResponse
109                    #
110                    'ParameterInfoStruct' => sub {
111                            my ($tag_name, $tag_hash, $context, $parent_data) = @_;
112                            $state->{ParameterInfo}->{ _tag($tag_hash, 'Name', '_content') } = _tag($tag_hash, 'Writable', '_content' );
113                            #warn dump( $tag_name, $tag_hash, $context );
114                    },
115                    #
116                    # Fault
117                    #
118                    'Fault' => sub {
119                            my ($tag_name, $tag_hash, $context, $parent_data) = @_;
120                            $state->{Fault} = {
121                                    FaultCode => _tag( $tag_hash, 'FaultCode', '_content' ),
122                                    FaultString => _tag( $tag_hash, 'FaultString', '_content' ),
123                            };
124                            warn "FAULT: ", $state->{Fault}->{FaultCode}, " ", $state->{Fault}->{FaultString}, "\n";
125                    }
126          ]          ]
127  );  );
128    

Legend:
Removed from v.36  
changed lines
  Added in v.71

  ViewVC Help
Powered by ViewVC 1.1.26