1 # Generated by rpcgen.py at Mon Mar 8 11:09:57 2004
3 from mountconstants import *
4 from mountpacker import *
7 __all__ = ['BadDiscriminant', 'fhstatus', 'mountres3_ok', 'mountres3', 'mountbody', 'groupnode', 'exportnode']
9 def init_type_class(klass, ncl):
10 # Initilize type class
12 klass.packer = ncl.packer
13 klass.unpacker = ncl.unpacker
15 def assert_not_none(klass, *args):
18 raise TypeError(repr(klass) + " has uninitialized data")
20 def pack_objarray(ncl, list):
21 # FIXME: Support for length assertion.
22 ncl.packer.pack_uint(len(list))
26 def unpack_objarray(ncl, klass):
27 n = ncl.unpacker.unpack_uint()
36 class BadDiscriminant(rpc.RPCException):
37 def __init__(self, value, klass):
42 return "Bad Discriminant %s in %s" % (self.value, self.klass)
46 # union fhstatus switch (unsigned fhs_status) {
48 # fhandle2 fhs_fhandle;
52 def __init__(self, ncl, fhs_status=None, fhs_fhandle=None):
53 init_type_class(self, ncl)
54 self.fhs_status = fhs_status
55 self.fhs_fhandle = fhs_fhandle
56 # Shortcut to current arm
60 s = " fhs_status=%s fhs_fhandle=%s" % (str(self.fhs_status), str(self.fhs_fhandle))
61 if len(s) > 70: s = s[:70] + "..."
62 return "<fhstatus:%s>" % s
64 def pack(self, dummy=None):
65 assert_not_none(self, self.fhs_status)
66 self.packer.pack_unsigned(self.fhs_status)
67 if self.fhs_status == 0:
68 assert_not_none(self, self.fhs_fhandle)
69 self.packer.pack_fhandle2(self.fhs_fhandle)
70 self.arm = self.fhs_fhandle
76 self.fhs_status = self.unpacker.unpack_unsigned()
77 if self.fhs_status == 0:
78 self.fhs_fhandle = self.unpacker.unpack_fhandle2()
79 self.arm = self.fhs_fhandle
86 # struct mountres3_ok {
90 def __init__(self, ncl, fhandle=None, auth_flavors=None):
91 init_type_class(self, ncl)
92 self.fhandle = fhandle
93 self.auth_flavors = auth_flavors
96 s = " fhandle=%s auth_flavors=%s" % (str(self.fhandle), str(self.auth_flavors))
97 if len(s) > 70: s = s[:70] + "..."
98 return "<mountres3_ok:%s>" % s
100 def pack(self, dummy=None):
101 assert_not_none(self, self.fhandle, self.auth_flavors)
102 self.packer.pack_fhandle3(self.fhandle)
103 self.packer.pack_int(self.auth_flavors)
106 self.fhandle = self.unpacker.unpack_fhandle3()
107 self.auth_flavors = self.unpacker.unpack_array(self.unpacker.unpack_int)
111 # union mountres3 switch (mountstat3 fhs_status) {
113 # mountres3_ok mountinfo;
117 def __init__(self, ncl, fhs_status=None, mountinfo=None):
118 init_type_class(self, ncl)
119 self.fhs_status = fhs_status
120 self.mountinfo = mountinfo
121 # Shortcut to current arm
125 s = " fhs_status=%s mountinfo=%s" % (str(self.fhs_status), str(self.mountinfo))
126 if len(s) > 70: s = s[:70] + "..."
127 return "<mountres3:%s>" % s
129 def pack(self, dummy=None):
130 assert_not_none(self, self.fhs_status)
131 self.packer.pack_mountstat3(self.fhs_status)
132 if self.fhs_status == MNT3_OK:
133 assert_not_none(self, self.mountinfo)
134 self.mountinfo.pack()
135 self.arm = self.mountinfo
141 self.fhs_status = self.unpacker.unpack_mountstat3()
142 if self.fhs_status == MNT3_OK:
143 self.mountinfo = mountres3_ok(self)
144 self.mountinfo.unpack()
145 self.arm = self.mountinfo
154 # dirpath ml_directory;
157 def __init__(self, ncl, ml_hostname=None, ml_directory=None, ml_next=None):
158 init_type_class(self, ncl)
159 self.ml_hostname = ml_hostname
160 self.ml_directory = ml_directory
161 self.ml_next = ml_next
164 s = " ml_hostname=%s ml_directory=%s ml_next=%s" % (str(self.ml_hostname), str(self.ml_directory), str(self.ml_next))
165 if len(s) > 70: s = s[:70] + "..."
166 return "<mountbody:%s>" % s
168 def pack(self, dummy=None):
169 assert_not_none(self, self.ml_hostname, self.ml_directory, self.ml_next)
170 self.packer.pack_name(self.ml_hostname)
171 self.packer.pack_dirpath(self.ml_directory)
172 self.packer.pack_mountlist(self.ml_next)
175 self.ml_hostname = self.unpacker.unpack_name()
176 self.ml_directory = self.unpacker.unpack_dirpath()
177 self.ml_next = self.unpacker.unpack_mountlist()
185 def __init__(self, ncl, gr_name=None, gr_next=None):
186 init_type_class(self, ncl)
187 self.gr_name = gr_name
188 self.gr_next = gr_next
191 s = " gr_name=%s gr_next=%s" % (str(self.gr_name), str(self.gr_next))
192 if len(s) > 70: s = s[:70] + "..."
193 return "<groupnode:%s>" % s
195 def pack(self, dummy=None):
196 assert_not_none(self, self.gr_name, self.gr_next)
197 self.packer.pack_name(self.gr_name)
198 self.packer.pack_groups(self.gr_next)
201 self.gr_name = self.unpacker.unpack_name()
202 self.gr_next = self.unpacker.unpack_groups()
206 # struct exportnode {
211 def __init__(self, ncl, ex_dir=None, ex_groups=None, ex_next=None):
212 init_type_class(self, ncl)
214 self.ex_groups = ex_groups
215 self.ex_next = ex_next
218 s = " ex_dir=%s ex_groups=%s ex_next=%s" % (str(self.ex_dir), str(self.ex_groups), str(self.ex_next))
219 if len(s) > 70: s = s[:70] + "..."
220 return "<exportnode:%s>" % s
222 def pack(self, dummy=None):
223 assert_not_none(self, self.ex_dir, self.ex_groups, self.ex_next)
224 self.packer.pack_dirpath(self.ex_dir)
225 self.packer.pack_groups(self.ex_groups)
226 self.packer.pack_exports(self.ex_next)
229 self.ex_dir = self.unpacker.unpack_dirpath()
230 self.ex_groups = self.unpacker.unpack_groups()
231 self.ex_next = self.unpacker.unpack_exports()