datasrc.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #ifndef __PYTHON_DATASRC_H
  15. #define __PYTHON_DATASRC_H 1
  16. #include <Python.h>
  17. namespace isc {
  18. namespace datasrc {
  19. namespace python {
  20. // Return a Python exception object of the given name (ex_name) defined in
  21. // the isc.datasrc.datasrc loadable module.
  22. //
  23. // Since the datasrc module is a different binary image and is loaded separately
  24. // from the dns module, it would be very tricky to directly access to
  25. // C/C++ symbols defined in that module. So we get access to these object
  26. // using the Python interpretor through this wrapper function.
  27. //
  28. // The __init__.py file should ensure isc.datasrc has been loaded by the time
  29. // whenever this function is called, and there shouldn't be any operation
  30. // within this function that can fail (such as dynamic memory allocation),
  31. // so this function should always succeed. Yet there may be an overlooked
  32. // failure mode, perhaps due to a bug in the binding implementation, or
  33. // due to invalid usage. As a last resort for such cases, this function
  34. // returns PyExc_RuntimeError (a C binding of Python's RuntimeError) should
  35. // it encounters an unexpected failure.
  36. extern PyObject* getDataSourceException(const char* ex_name);
  37. } // namespace python
  38. } // namespace datasrc
  39. } // namespace isc
  40. #endif // __PYTHON_ACL_DNS_H
  41. // Local Variables:
  42. // mode: c++
  43. // End: