IP : 18.118.115.222Hostname : server86.web-hosting.comKernel : Linux server86.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64Disable Function : None :) OS : Linux
PATH:
/
home/
./
./
../
bin/
../
lib64/
python2.7/
lib-tk/
../
xdrlib.py/
/
"""Implements (a subset of) Sun XDR -- eXternal Data Representation.
See: RFC 1014
"""
import struct try: from cStringIO import StringIO as _StringIO except ImportError: from StringIO import StringIO as _StringIO from functools import wraps
def pack_fstring(self, n, s): if n < 0: raise ValueError, 'fstring size must be nonnegative' data = s[:n] n = ((n+3)//4)*4 data = data + (n - len(data)) * '\0' self.__buf.write(data)
pack_fopaque = pack_fstring
def pack_string(self, s): n = len(s) self.pack_uint(n) self.pack_fstring(n, s)
def unpack_uhyper(self): hi = self.unpack_uint() lo = self.unpack_uint() return long(hi)<<32 | lo
def unpack_hyper(self): x = self.unpack_uhyper() if x >= 0x8000000000000000L: x = x - 0x10000000000000000L return x
def unpack_float(self): i = self.__pos self.__pos = j = i+4 data = self.__buf[i:j] if len(data) < 4: raise EOFError return struct.unpack('>f', data)[0]
def unpack_double(self): i = self.__pos self.__pos = j = i+8 data = self.__buf[i:j] if len(data) < 8: raise EOFError return struct.unpack('>d', data)[0]
def unpack_fstring(self, n): if n < 0: raise ValueError, 'fstring size must be nonnegative' i = self.__pos j = i + (n+3)//4*4 if j > len(self.__buf): raise EOFError self.__pos = j return self.__buf[i:i+n]
unpack_fopaque = unpack_fstring
def unpack_string(self): n = self.unpack_uint() return self.unpack_fstring(n)
def unpack_list(self, unpack_item): list = [] while 1: x = self.unpack_uint() if x == 0: break if x != 1: raise ConversionError, '0 or 1 expected, got %r' % (x,) item = unpack_item() list.append(item) return list
def unpack_farray(self, n, unpack_item): list = [] for i in range(n): list.append(unpack_item()) return list
def unpack_array(self, unpack_item): n = self.unpack_uint() return self.unpack_farray(n, unpack_item)