1RPC(3) rpc 1.3 RPC(3)
2
3
4
6 packet.application.rpc - RPC module
7
9 Decode RPC layer.
10
12 class Header(baseobj.BaseObj)
13 Header object
14
15
16 Methods defined here:
17 ---------------------
18
19 __init__(self, size, last_fragment)
20 Constructor which takes the size and last fragment as inputs
21
22 class Prog(baseobj.BaseObj)
23 Prog object
24
25
26 Methods defined here:
27 ---------------------
28
29 __init__(self, unpack)
30 Constructor which takes the Unpack object as input
31
32 class RPC(packet.application.gss.GSS)
33 RPC object
34
35 Usage:
36 from packet.application.rpc import RPC
37
38 # Decode the RPC header
39 x = RPC(pktt_obj, proto=6)
40
41 # Decode NFS layer
42 nfs = x.decode_payload()
43
44 Object definition:
45
46 RPC(
47 [
48 # If TCP
49 fragment_hdr = Header(
50 last_fragment = int,
51 size = int,
52 ),
53 ]
54 xid = int,
55 type = int,
56
57 [
58 # If type == 0 (RPC call)
59 rpc_version = int,
60 program = int,
61 version = int,
62 procedure = int,
63 credential = Credential(
64 data = string,
65 flavor = int,
66 size = int,
67 ),
68 verifier = Credential(
69 data = string,
70 flavor = int,
71 size = int,
72 ),
73 ] | [
74 # If type == 1 (RPC reply)
75 reply_status = int,
76 [
77 # If reply_status == 0
78 verifier = Credential(
79 data = string,
80 flavor = int,
81 size = int,
82 ),
83 accepted_status = int,
84 [
85 # If accepted_status == 2
86 prog_mismatch = Prog(
87 low = int,
88 high = int,
89 )
90 ]
91 ] | [
92 # If reply_status != 0
93 rejected_status = int,
94 [
95 # If rejected_status == 0
96 prog_mismatch = Prog(
97 low = int,
98 high = int,
99 )
100 ] | [
101 # If rejected_status != 0
102 auth_status = int,
103 ]
104 ]
105 ]
106 [data = string] # raw data of payload if unable to decode
107 )
108
109
110 Methods defined here:
111 ---------------------
112
113 __init__(self, pktt, proto, state=True)
114 Constructor
115
116 Initialize object's private data.
117
118
119 pktt: Packet trace object (packet.pktt.Pktt) so this layer has
120 access to the parent layers.
121
122 proto: Transport layer protocol.
123
124 state: Save call state. [default: True]
125
126 __nonzero__(self)
127 Truth value testing for the built-in operation bool()
128
129 __str__(self)
130 String representation of object
131
132 The representation depends on the verbose level set by debug_repr().
133 If set to 0 the generic object representation is returned.
134 If set to 1 the representation of the object is:
135 'RPC call program: 100003, version: 4, procedure: 0, xid: 0xe37d3d5 '
136
137 If set to 2 the representation of the object is as follows:
138 'CALL(0), program: 100003, version: 4, procedure: 0, xid: 0xe37d3d5'
139
140 decode_payload(self)
141 Decode RPC load
142
143 For RPC calls it is easy to decide if the RPC payload is an NFS packet
144 since the RPC program is in the RPC header, which for NFS the
145 program number is 100003. On the other hand, for RPC replies the RPC
146 header does not have any information on what the payload is, so the
147 transaction ID (xid) is used to map the replies to their calls and
148 thus deciding if RPC payload is an NFS packet or not.
149 This is further complicated when trying to decode callbacks, since
150 the program number for callbacks could be any number in the transient
151 program range [0x40000000, 0x5FFFFFFF]. Therefore, any program number
152 in the transient range is considered a callback and if the decoding
153 succeeds then this is an NFS callback, otherwise it is not.
154
155 Since the RPC replies do not contain any information about what type
156 of payload, when they are decoded correctly as NFS replies this
157 information is inserted in the RPC (pkt.rpc) object.
158 This information includes program number, RPC version, procedure
159 number as well as the call_index which is the packet index of its
160 corresponding call for each reply.
161
162 x.pkt.nfs = <NFSobject>
163
164 where <NFSobject> is an object of type COMPOUND4args or COMPOUND4res
165
166 class COMPOUND4args(
167 tag = string,
168 minorversion = int,
169 argarray = [],
170 )
171
172 The argarray is a list of nfs_argop4 objects:
173
174 class nfs_argop4(
175 argop = int,
176 [<opobject> = <opargobject>,]
177 )
178
179 where opobject could be opsequence, opgetattr, etc., and opargobject
180 is the object which has the arguments for the given opobject, e.g.,
181 SEQUENCE4args, GETATTR4args, etc.
182
183 class COMPOUND4res(
184 tag = string,
185 status = int,
186 resarray = [],
187 )
188
189 The resarray is a list of nfs_resop4 objects:
190
191 class nfs_resop4(
192 resop = int,
193 [<opobject> = <opresobject>,]
194 )
195
196 where opobject could be opsequence, opgetattr, etc., and opresobject
197 is the object which has the results for the given opobject, e.g.,
198 SEQUENCE4res, GETATTR4res, etc.
199
201 baseobj(3), packet.application.gss(3), packet.nfs.mount3(3),
202 packet.nfs.nfs(3), packet.nfs.nlm4(3), packet.nfs.portmap2(3),
203 packet.utils(3)
204
205
207 No known bugs.
208
210 Jorge Mora (mora@netapp.com)
211
212
213
214NFStest 2.1.5 14 February 2017 RPC(3)