Пример #1
0
class UNSHARE_Call(Packet):
    name = 'UNSHARE Reply'
    fields_desc = [
        PacketField('cookie', NLM4_Cookie(), NLM4_Cookie),
        PacketField('caller', Object_Name(), Object_Name),
        PacketField('filehandle', File_Object(), File_Object),
        PacketField('owner', Object_Name(), Object_Name),
        IntField('mode', 0),
        IntField('access', 0),
        IntEnumField('reclaim', 0, {0: 'NO', 1: 'YES'})
    ]
Пример #2
0
class UNLOCK_Call(Packet):
    name = 'UNLOCK Call'
    fields_desc = [
        PacketField('cookie', NLM4_Cookie(), NLM4_Cookie),
        PacketField('caller', Object_Name(), Object_Name),
        PacketField('filehandle', File_Object(), File_Object),
        PacketField('owner', Object_Name(), Object_Name),
        IntField('svid', 0),
        LongField('l_offset', 0),
        LongField('l_len', 0)
    ]
Пример #3
0
class TEST_Call(Packet):
    name = 'TEST Call'
    fields_desc = [
        PacketField('cookie', NLM4_Cookie(), NLM4_Cookie),
        IntEnumField('exclusive', 0, {0: 'NO', 1: 'YES'}),
        PacketField('caller', Object_Name(), Object_Name),
        PacketField('filehandle', File_Object(), File_Object),
        PacketField('owner', Object_Name(), Object_Name),
        IntField('svid', 0),
        LongField('l_offset', 0),
        LongField('l_len', 0)
    ]
Пример #4
0
class MOUNT_Reply(Packet):
    name = 'MOUNT Reply'
    fields_desc = [
        IntEnumField('status', 0, mountstat3),
        ConditionalField(PacketField('filehandle', File_Object(), File_Object),
                         lambda pkt: pkt.status == 0),
        ConditionalField(IntField('flavors', 0), lambda pkt: pkt.status == 0),
        ConditionalField(
            FieldListField('flavor',
                           None,
                           IntField('', None),
                           count_from=lambda pkt: pkt.flavors),
            lambda pkt: pkt.status == 0)
    ]

    def get_filehandle(self):
        if self.status == 0:
            return self.filehandle.fh
        return None