CWMP::Methods - generate SOAP meesages for CPE
-=head2 METHODS
+=head1 METHODS
=head2 new
- my $response = CWMP::Methods->new({ debug => 1 });
+ my $method = CWMP::Methods->new({ debug => 1 });
=cut
return $self;
}
+=head2 xml
+
+Used to implement methods which modify just body of soap message.
+For examples, see source of this module.
+
+=cut
my $cwmp = [ cwmp => 'urn:dslforum-org:cwmp-1-0' ];
my $soap = [ soap => 'http://schemas.xmlsoap.org/soap/envelope/' ];
my $xsd = [ xsd => 'http://www.w3.org/2001/XMLSchema-instance' ];
-=head2 InformResponse
+sub xml {
+ my $self = shift;
- $response->InformResponse( $state );
+ my ( $state, $closure ) = @_;
-=cut
+ confess "no state?" unless ($state);
+ confess "no body closure" unless ( $closure );
-sub InformResponse {
- my ( $self, $state ) = @_;
- $self->xml( $state, sub {
- my ( $X, $state ) = @_;
- $X->InformResponse( $cwmp,
- $X->MaxEnvelopes( $cwmp, 1 )
- );
- });
+ confess "no ID in state ", dump( $state ) unless ( $state->{ID} );
+
+ #warn "state used to generate xml = ", dump( $state ) if $self->debug;
+
+ my $X = XML::Generator->new(':pretty');
+
+ return $X->Envelope( $soap, { 'soap:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/" },
+ $X->Header( $soap,
+ $X->ID( $cwmp, { mustUnderstand => 1 }, $state->{ID} ),
+ $X->NoMoreRequests( $cwmp, $state->{NoMoreRequests} || 0 ),
+ ),
+ $X->Body( $soap, $closure->( $X, $state ) ),
+ );
}
+=head1 CPE methods
+
=head2 GetRPCMethods
- $response->GetRPCMethods( $state );
+ $method->GetRPCMethods( $state );
=cut
});
};
-=head2 Reboot
+=head2 SetParameterValues
+
+B<not implemented>
+
+=head2 GetParameterValues
- $response->Reboot( $state );
+ $method->GetParameterValues( $state, $ParameterNames );
=cut
-sub Reboot {
- my ( $self, $state ) = @_;
+sub GetParameterValues {
+ my $self = shift;
+ my $state = shift;
+ my @ParameterNames = @_;
+ confess "need ParameterNames" unless @ParameterNames;
+ warn "# GetParameterValues", dump( @ParameterNames ), "\n" if $self->debug;
+
$self->xml( $state, sub {
my ( $X, $state ) = @_;
- $X->Reboot();
+
+ $X->GetParameterValues( $cwmp,
+ $X->ParameterNames( $cwmp,
+ map {
+ $X->string( $xsd, $_ )
+ } @ParameterNames
+ )
+ );
});
}
=head2 GetParameterNames
- $response->GetParameterNames( $state, $ParameterPath, $NextLevel );
+ $method->GetParameterNames( $state, $ParameterPath, $NextLevel );
=cut
});
}
-=head2 GetParameterValues
+=head2 Reboot
- $response->GetParameterValues( $state, $ParameterNames );
+ $method->Reboot( $state );
=cut
-sub GetParameterValues {
- my $self = shift;
- my $state = shift;
- my @ParameterNames = @_;
- confess "need ParameterNames" unless @ParameterNames;
- warn "# GetParameterValues", dump( @ParameterNames ), "\n" if $self->debug;
-
+sub Reboot {
+ my ( $self, $state ) = @_;
$self->xml( $state, sub {
my ( $X, $state ) = @_;
-
- $X->GetParameterValues( $cwmp,
- $X->ParameterNames( $cwmp,
- map {
- $X->string( $xsd, $_ )
- } @ParameterNames
- )
- );
+ $X->Reboot();
});
}
-=head2 xml
-Used to implement methods which modify just body of soap message.
-For examples, see source of this module.
+=head1 Server methods
-=cut
-sub xml {
- my $self = shift;
+=head2 InformResponse
- my ( $state, $closure ) = @_;
+ $method->InformResponse( $state );
- confess "no state?" unless ($state);
- confess "no body closure" unless ( $closure );
+=cut
- confess "no ID in state ", dump( $state ) unless ( $state->{ID} );
+sub InformResponse {
+ my ( $self, $state ) = @_;
+ $self->xml( $state, sub {
+ my ( $X, $state ) = @_;
+ $X->InformResponse( $cwmp,
+ $X->MaxEnvelopes( $cwmp, 1 )
+ );
+ });
+}
- #warn "state used to generate xml = ", dump( $state ) if $self->debug;
+=head1 BUGS
- my $X = XML::Generator->new(':pretty');
+All other methods are unimplemented.
- return $X->Envelope( $soap, { 'soap:encodingStyle' => "http://schemas.xmlsoap.org/soap/encoding/" },
- $X->Header( $soap,
- $X->ID( $cwmp, { mustUnderstand => 1 }, $state->{ID} ),
- $X->NoMoreRequests( $cwmp, $state->{NoMoreRequests} || 0 ),
- ),
- $X->Body( $soap, $closure->( $X, $state ) ),
- );
-}
+=cut
1;