Branch data Line data Source code
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 : :
15 : : #ifndef __COMMON_H
16 : : #define __COMMON_H 1
17 : :
18 : : #include <stdexcept>
19 : : #include <string>
20 : :
21 : : /// An exception class that is thrown in an unrecoverable error condition.
22 : : ///
23 : : /// This exception should not be caught except at the highest level of
24 : : /// the application only for terminating the program gracefully, and so
25 : : /// it cannot be a derived class of \c isc::Exception.
26 : 1 : class FatalError : public std::runtime_error {
27 : : public:
28 [ - + ]: 1 : FatalError(const std::string& what) : std::runtime_error(what)
29 : : {}
30 : : };
31 : :
32 : : /// \short Get the path of socket to talk to xfrout
33 : : ///
34 : : /// It takes some environment variables into account (B10_FROM_BUILD,
35 : : /// B10_FROM_SOURCE_LOCALSTATEDIR and BIND10_XFROUT_SOCKET_FILE). It
36 : : /// also considers the installation prefix.
37 : : ///
38 : : /// The logic should be the same as in b10-xfrout, so they find each other.
39 : : std::string getXfroutSocketPath();
40 : :
41 : : /// \brief The name used when identifieng the process
42 : : ///
43 : : /// This is currently b10-auth, but it can be changed easily in one place.
44 : : extern const char* const AUTH_NAME;
45 : :
46 : : #endif // __COMMON_H
47 : :
48 : : // Local Variables:
49 : : // mode: c++
50 : : // End:
|