zone_config.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # Copyright (C) 2012 Internet Systems Consortium.
  2. #
  3. # Permission to use, copy, modify, and distribute this software for any
  4. # purpose with or without fee is hereby granted, provided that the above
  5. # copyright notice and this permission notice appear in all copies.
  6. #
  7. # THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM
  8. # DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
  9. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
  10. # INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
  11. # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
  12. # FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  13. # NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  14. # WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. # Constants representing zone types
  16. ZONE_NOTFOUND = -1 # Zone isn't found in find_zone()
  17. ZONE_PRIMARY = 0 # Primary zone
  18. ZONE_SECONDARY = 1 # Secondary zone
  19. class ZoneConfig:
  20. '''A temporary helper class to encapsulate zone related configuration.
  21. Its find_zone method will search the conceptual configuration for a
  22. given zone, and return a tuple of zone type (primary or secondary) and
  23. the client object to access the data source stroing the zone.
  24. It's very likely that details of zone related configurations like this
  25. will change in near future, so the main purpose of this class is to
  26. provide an independent interface for the main DDNS session module
  27. until the details are fixed.
  28. '''
  29. def find_zone(self, zone_name, zone_class):
  30. '''Return the type and accessor client object for given zone.'''
  31. # Right now, the client is not used, so we simply return None.
  32. return ZONE_PRIMARY, None