Line data Source code
1 : // Snap Websites Servers -- snap websites mail exchangers loading
2 : // Copyright (c) 2011-2019 Made to Order Software Corp. All Rights Reserved
3 : //
4 : // This program is free software; you can redistribute it and/or modify
5 : // it under the terms of the GNU General Public License as published by
6 : // the Free Software Foundation; either version 2 of the License, or
7 : // (at your option) any later version.
8 : //
9 : // This program is distributed in the hope that it will be useful,
10 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 : // GNU General Public License for more details.
13 : //
14 : // You should have received a copy of the GNU General Public License
15 : // along with this program; if not, write to the Free Software
16 : // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 : #pragma once
18 :
19 : // snapwebsites lib
20 : //
21 : #include "snapwebsites/snap_exception.h"
22 :
23 : // C++ lib
24 : //
25 : #include <vector>
26 :
27 :
28 :
29 : namespace snap
30 : {
31 :
32 : class mail_exhanger_exception : public snap_exception
33 : {
34 : public:
35 : explicit mail_exhanger_exception(char const * whatmsg) : snap_exception("mail_exhanger", whatmsg) {}
36 : explicit mail_exhanger_exception(std::string const & whatmsg) : snap_exception("mail_exhanger", whatmsg) {}
37 : explicit mail_exhanger_exception(QString const & whatmsg) : snap_exception("mail_exhanger", whatmsg) {}
38 : };
39 :
40 :
41 :
42 :
43 0 : class mail_exchanger
44 : {
45 : public:
46 : typedef std::vector<mail_exchanger> mail_exchange_vector_t;
47 :
48 : mail_exchanger(int priority, std::string const & domain);
49 :
50 : int get_priority() const;
51 : std::string get_domain() const;
52 :
53 : bool operator < (mail_exchanger const & rhs) const;
54 :
55 : private:
56 : int f_priority = 0;
57 : std::string f_domain = std::string();
58 : };
59 :
60 :
61 :
62 :
63 :
64 :
65 0 : class mail_exchangers
66 : {
67 : public:
68 :
69 : mail_exchangers(std::string const & domain);
70 :
71 : bool domain_found() const;
72 : size_t size() const;
73 : mail_exchanger::mail_exchange_vector_t get_mail_exchangers() const;
74 :
75 : private:
76 : bool f_domain_found = false;
77 : mail_exchanger::mail_exchange_vector_t f_mail_exchangers = mail_exchanger::mail_exchange_vector_t();
78 : };
79 :
80 :
81 :
82 : } // namespace snap
83 : // vim: ts=4 sw=4 et
|