1# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
2# See LICENSE.txt for complete terms.
3
4from mixbox import entities
5from mixbox import fields
6
7import cybox.bindings.dns_cache_object as dns_cache_binding
8from cybox.common import ObjectProperties, PositiveInteger
9from cybox.objects.dns_record_object import DNSRecord
10
11
12class DNSCacheEntry(entities.Entity):
13    _namespace = "http://cybox.mitre.org/objects#DNSCacheObject-2"
14    _binding = dns_cache_binding
15    _binding_class = dns_cache_binding.DNSCacheEntryType
16
17    dns_entry = fields.TypedField("DNS_Entry", DNSRecord)
18    ttl = fields.TypedField("TTL", PositiveInteger)
19
20
21class DNSCache(ObjectProperties):
22    _binding = dns_cache_binding
23    _binding_class = dns_cache_binding.DNSCacheObjectType
24    _namespace = "http://cybox.mitre.org/objects#DNSCacheObject-2"
25    _XSI_NS = "DNSCacheObj"
26    _XSI_TYPE = "DNSCacheObjectType"
27
28    dns_cache_entry = fields.TypedField("DNS_Cache_Entry", DNSCacheEntry, multiple=True)
29