]> git.donarmstrong.com Git - bamtools.git/blob - src/api/internal/io/HostInfo_p.h
Updated file headers (filename, license, description, etc)
[bamtools.git] / src / api / internal / io / HostInfo_p.h
1 // ***************************************************************************
2 // HostInfo_p.h (c) 2011 Derek Barnett
3 // Marth Lab, Department of Biology, Boston College
4 // ---------------------------------------------------------------------------
5 // Last modified: 10 November 2011 (DB)
6 // ---------------------------------------------------------------------------
7 // Provides DNS lookup functionality for hostname/IP addresses
8 // ***************************************************************************
9
10 #ifndef HOSTINFO_P_H
11 #define HOSTINFO_P_H
12
13 //  -------------
14 //  W A R N I N G
15 //  -------------
16 //
17 // This file is not part of the BamTools API.  It exists purely as an
18 // implementation detail. This header file may change from version to version
19 // without notice, or even be removed.
20 //
21 // We mean it.
22
23 #include "api/internal/io/HostAddress_p.h"
24 #include <string>
25 #include <vector>
26
27 namespace BamTools {
28 namespace Internal {
29
30 class HostInfo {
31
32     public:
33         enum ErrorType { NoError = 0
34                        , HostNotFound
35                        , UnknownError
36                        };
37
38     // ctors & dtor
39     public:
40         HostInfo(void);
41         HostInfo(const HostInfo& other);
42         ~HostInfo(void);
43
44     // HostInfo interface
45     public:
46         std::string HostName(void) const;
47         void SetHostName(const std::string& name);
48
49         std::vector<HostAddress> Addresses(void) const;
50         void SetAddresses(const std::vector<HostAddress>& addresses);
51
52         HostInfo::ErrorType GetError(void) const;
53         std::string GetErrorString(void) const;
54
55     // internal methods
56     private:
57         void SetError(const HostInfo::ErrorType error);
58         void SetErrorString(const std::string& errorString);
59
60     // static methods
61     public:
62         static HostInfo Lookup(const std::string& hostname,
63                                const std::string& port);
64
65     // data members
66     private:
67         std::string m_hostName;
68         std::vector<HostAddress> m_addresses;
69         HostInfo::ErrorType m_error;
70         std::string m_errorString;
71 };
72
73 } // namespace Internal
74 } // namespace BamTools
75
76 #endif // HOSTINFO_P_H