Home | Trees | Indices | Help |
|
---|
|
1 # $Id: rpc.py 23 2006-11-08 15:45:33Z dugsong $ 2 3 """Remote Procedure Call.""" 4 5 import struct 6 import dpkt 7 8 # RPC.dir 9 CALL = 0 10 REPLY = 1 11 12 # RPC.Auth.flavor 13 AUTH_NONE = AUTH_NULL = 0 14 AUTH_UNIX = 1 15 AUTH_SHORT = 2 16 AUTH_DES = 3 17 18 # RPC.Reply.stat 19 MSG_ACCEPTED = 0 20 MSG_DENIED = 1 21 22 # RPC.Reply.Accept.stat 23 SUCCESS = 0 24 PROG_UNAVAIL = 1 25 PROG_MISMATCH = 2 26 PROC_UNAVAIL = 3 27 GARBAGE_ARGS = 4 28 SYSTEM_ERR = 5 29 30 # RPC.Reply.Reject.stat 31 RPC_MISMATCH = 0 32 AUTH_ERROR = 1 3335 __hdr__ = ( 36 ('xid', 'I', 0), 37 ('dir', 'I', CALL) 38 )131 144 14740 __hdr__ = (('flavor', 'I', AUTH_NONE), )5042 dpkt.Packet.unpack(self, buf) 43 n = struct.unpack('>I', self.data[:4])[0] 44 self.data = self.data[4:4+n]52 __hdr__ = ( 53 ('rpcvers', 'I', 2), 54 ('prog', 'I', 0), 55 ('vers', 'I', 0), 56 ('proc', 'I', 0) 57 )7059 dpkt.Packet.unpack(self, buf) 60 self.cred = RPC.Auth(self.data) 61 self.verf = RPC.Auth(self.data[len(self.cred):]) 62 self.data = self.data[len(self.cred) + len(self.verf):]64 return len(str(self)) # XXX72 __hdr__ = (('stat', 'I', MSG_ACCEPTED), ) 7312475 __hdr__ = (('stat', 'I', SUCCESS), )9477 self.verf = RPC.Auth(buf) 78 buf = buf[len(self.verf):] 79 self.stat = struct.unpack('>I', buf[:4])[0] 80 if self.stat == SUCCESS: 81 self.data = buf[4:] 82 elif self.stat == PROG_MISMATCH: 83 self.low, self.high = struct.unpack('>II', buf[4:12]) 84 self.data = buf[12:]86 if self.stat == PROG_MISMATCH: n = 8 87 else: n = 0 88 return len(self.verf) + 4 + n + len(self.data)96 __hdr__ = (('stat', 'I', AUTH_ERROR), )11798 dpkt.Packet.unpack(self, buf) 99 if self.stat == RPC_MISMATCH: 100 self.low, self.high = struct.unpack('>II', self.data[:8]) 101 self.data = self.data[8:] 102 elif self.stat == AUTH_ERROR: 103 self.why = struct.unpack('>I', self.data[:4])[0] 104 self.data = self.data[4:]106 if self.stat == RPC_MISMATCH: n = 8 107 elif self.stat == AUTH_ERROR: n =4 108 else: n = 0 109 return 4 + n + len(self.data)
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Feb 19 21:29:30 2012 | http://epydoc.sourceforge.net |