File Coverage

blib/lib/XDR/RPC/Reply.pm
Criterion Covered Total %
statement 30 35 85.7
branch 2 12 16.6
condition n/a
subroutine 9 9 100.0
pod 0 4 0.0
total 41 60 68.3


line stmt bran cond sub pod time code
1             # Reply.pm - SunRPC reply packets
2             # Copyright (C) 2000 Mountain View Data, Inc.
3             # Written by Gordon Matzigkeit , 2000-12-18
4             #
5             # This file is part of Perl XDR.
6             #
7             # Perl XDR is free software; you can redistribute it and/or modify it
8             # under the terms of the GNU General Public License as published by
9             # the Free Software Foundation; either version 2 of the License, or
10             # (at your option) any later version.
11             #
12             # Perl XDR is distributed in the hope that it will be useful, but
13             # WITHOUT ANY WARRANTY; without even the implied warranty of
14             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15             # General Public License for more details.
16             #
17             # You should have received a copy of the GNU General Public License
18             # along with this program; if not, write to the Free Software
19             # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20             # USA
21              
22             package XDR::RPC::Reply;
23             # [guilt]
24             # [maint
25             # File: Reply.pm
26             # Summary: SunRPC reply packets
27             # Package: Perl XDR
28             # Owner: Mountain View Data, Inc.
29             # Years: 2000
30             # Author: Gordon Matzigkeit
31             # Contact:
32             # Date: 2000-12-18
33             # License: GPL]
34             # [clemency]
35              
36 2     2   12 use strict;
  2         3  
  2         185  
37              
38 2     2   10 use vars qw(@ISA);
  2         4  
  2         111  
39             @ISA = qw(XDR::RPC);
40              
41 2     2   8 use XDR::Decode;
  2         4  
  2         69  
42 2     2   11 use XDR::RPC;
  2         3  
  2         44  
43 2     2   42 use XDR qw(:reply_stat :accept_stat :reject_stat);
  2         4  
  2         1157  
44              
45              
46             sub finish_decode
47             {
48 3     3 0 7 my ($type, $dec, $xid) = @_;
49              
50 3         4 my (@priv, $verf, $result, $reason);
51 3         13 my ($status) = $dec->unsigned;
52 3 50       8 if ($status == MSG_ACCEPTED)
    0          
53             {
54 3         11 $verf = $dec->opaque_auth;
55 3         14 $reason = $dec->unsigned;
56 3 50       10 if ($reason == SUCCESS)
    0          
57             {
58 3         10 $result = $dec->buffer (1);
59             }
60             elsif ($reason == PROG_MISMATCH)
61             {
62             # low, high
63 0         0 push @priv, ($dec->unsigned, $dec->unsigned);
64             }
65             }
66             elsif ($status == MSG_DENIED)
67             {
68 0         0 $reason = $dec->unsigned;
69 0 0       0 if ($reason == RPC_MISMATCH)
    0          
70             {
71             # low, high
72 0         0 push @priv, ($dec->unsigned, $dec->unsigned);
73             }
74             elsif ($reason == AUTH_ERROR)
75             {
76             # auth_stat
77 0         0 push @priv, $dec->unsigned;
78             }
79             }
80              
81 3         18 return $type->new($xid, [$status, $reason, @priv], $result,
82             undef, $verf);
83             }
84              
85              
86             sub status
87             {
88 1     1 0 1 my ($self) = @_;
89 1         6 return $self->private->[0];
90             }
91              
92              
93             sub reason
94             {
95 1     1 0 2 my ($self) = @_;
96 1         3 return $self->private->[1];
97             }
98              
99              
100             sub result
101             {
102 1     1 0 1 my ($self) = @_;
103 1         6 return $self->args ();
104             }
105              
106              
107             1;