common.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Copyright (C) 2009-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 __COMMON_H
  15. #define __COMMON_H 1
  16. #include <stdexcept>
  17. #include <string>
  18. /// An exception class that is thrown in an unrecoverable error condition.
  19. ///
  20. /// This exception should not be caught except at the highest level of
  21. /// the application only for terminating the program gracefully, and so
  22. /// it cannot be a derived class of \c isc::Exception.
  23. class FatalError : public std::runtime_error {
  24. public:
  25. FatalError(const std::string& what) : std::runtime_error(what)
  26. {}
  27. };
  28. /// \short Get the path of socket to talk to xfrout
  29. ///
  30. /// It takes some environment variables into account (B10_FROM_BUILD,
  31. /// B10_FROM_SOURCE_LOCALSTATEDIR and BIND10_XFROUT_SOCKET_FILE). It
  32. /// also considers the installation prefix.
  33. ///
  34. /// The logic should be the same as in b10-xfrout, so they find each other.
  35. std::string getXfroutSocketPath();
  36. /// \brief Get the path of socket to talk to ddns
  37. ///
  38. /// It takes some environment variables into account (B10_FROM_BUILD,
  39. /// B10_FROM_SOURCE_LOCALSTATEDIR and BIND10_DDNS_SOCKET_FILE). It
  40. /// also considers the installation prefix.
  41. ///
  42. /// The logic should be the same as in b10-ddns, so they find each other.
  43. ///
  44. /// Note: eventually we should find a better way so that we don't have to
  45. /// repeat the same magic value (and how to tweak it with some magic
  46. /// environment variable) twice, at which point this function may be able
  47. /// to be deprecated.
  48. std::string getDDNSSocketPath();
  49. /// \brief The name used when identifieng the process
  50. ///
  51. /// This is currently b10-auth, but it can be changed easily in one place.
  52. extern const char* const AUTH_NAME;
  53. /// \brief Notification string that is used to inform auth is starting
  54. ///
  55. /// This is sent to interested modules (currently only b10-ddns)
  56. extern const char* const AUTH_STARTED_NOTIFICATION;
  57. #endif // __COMMON_H
  58. // Local Variables:
  59. // mode: c++
  60. // End: