1# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
2# See LICENSE.txt for complete terms.
3
4from mixbox import entities, fields
5
6import cybox.bindings.volume_object as volume_binding
7from cybox.common import BaseProperty, ObjectProperties, String, DateTime, UnsignedLong, PositiveInteger, UnsignedInteger
8
9
10class VolumeFileSystemFlag(BaseProperty):
11    _binding = volume_binding
12    _binding_class = volume_binding.VolumeFileSystemFlagType
13    _namespace = "http://cybox.mitre.org/objects#VolumeObject-2"
14
15
16class FileSystemFlagList(entities.EntityList):
17    _binding = volume_binding
18    _binding_class = volume_binding.FileSystemFlagListType
19    _namespace = "http://cybox.mitre.org/objects#VolumeObject-2"
20
21    file_system_flag = fields.TypedField("File_System_Flag", VolumeFileSystemFlag, multiple=True)
22
23
24class Volume(ObjectProperties):
25    _binding = volume_binding
26    _binding_class = volume_binding.VolumeObjectType
27    _namespace = "http://cybox.mitre.org/objects#VolumeObject-2"
28    _XSI_NS = "VolumeObj"
29    _XSI_TYPE = "VolumeObjectType"
30
31    is_mounted = fields.TypedField('is_mounted')
32    name = fields.TypedField('Name', String)
33    device_path = fields.TypedField('Device_Path', String)
34    file_system_type = fields.TypedField('File_System_Type', String)
35    total_allocation_units = fields.TypedField('Total_Allocation_Units', UnsignedLong)
36    sectors_per_allocation_unit = fields.TypedField('Sectors_Per_Allocation_Unit', UnsignedInteger)
37    bytes_per_sector = fields.TypedField('Bytes_Per_Sector', PositiveInteger)
38    actual_available_allocation_units = fields.TypedField('Actual_Available_Allocation_Units', UnsignedLong)
39    creation_time = fields.TypedField('Creation_Time', DateTime)
40    file_system_flag_list = fields.TypedField('File_System_Flag_List', FileSystemFlagList)
41    serial_number = fields.TypedField('Serial_Number', String)
42