first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / octopi / library / sockets / range_limiter.cpp
1 /*****************************************************************************\
2 *                                                                             *
3 *  Name   : range_limiter                                                     *
4 *  Author : Chris Koeritz                                                     *
5 *                                                                             *
6 *******************************************************************************
7 * Copyright (c) 2002-$now By Author.  This program is free software; you can  *
8 * redistribute it and/or modify it under the terms of the GNU General Public  *
9 * License as published by the Free Software Foundation; either version 2 of   *
10 * the License or (at your option) any later version.  This is online at:      *
11 *     http://www.fsf.org/copyleft/gpl.html                                    *
12 * Please send any updates to: fred@gruntose.com                               *
13 \*****************************************************************************/
14
15 #include "range_limiter.h"
16 #include "machine_uid.h"
17
18 #include <basis/astring.h>
19 #include <structures/amorph.h>
20
21 using namespace basis;
22 using namespace structures;
23
24 namespace sockets {
25
26 class range_record
27 {
28 public:
29   machine_uid _first;
30   machine_uid _second;
31   astring _host;
32   bool _is_host;  // true if the host has any useful information.
33   bool _single;  // true if only the first address matters.
34 };
35
36 //////////////
37
38 class limiter_range_list : public amorph<range_record>
39 {
40 public:
41 };
42
43 //////////////
44
45 range_limiter::range_limiter()
46 : _ranges(new limiter_range_list)
47 {
48 }
49
50 range_limiter::range_limiter(const astring &source_file,
51     const astring &section)
52 : _ranges(new limiter_range_list)
53 {
54   load(source_file, section);
55 }
56
57 range_limiter::~range_limiter() { WHACK(_ranges); }
58
59 bool range_limiter::is_allowed(const machine_uid &host)
60 {
61 if (host.valid()) {}
62 return false;
63 }
64
65 bool range_limiter::is_allowed(const astring &hostname)
66 {
67 if (!hostname) {}
68 return false;
69 }
70
71 range_limiter::capabilities range_limiter::get_default()
72 {
73 return DENY;
74 }
75
76 void range_limiter::set_default(capabilities rights)
77 {
78 if (!rights) {}
79 }
80
81 bool range_limiter::add(const machine_uid &address, capabilities rights)
82 {
83 if (address.valid() || rights) {}
84 return false;
85 }
86
87 bool range_limiter::add(const astring &hostname, capabilities rights)
88 {
89 if (!hostname || rights) {}
90 return false;
91 }
92
93 bool range_limiter::add(const machine_uid &first, const machine_uid &second,
94     capabilities rights)
95 {
96 if (first.valid() || second.valid() || rights) {}
97 return false;
98 }
99
100 bool range_limiter::remove(const machine_uid &address)
101 {
102 if (address.valid()) {}
103 return false;
104 }
105
106 bool range_limiter::remove(const astring &hostname)
107 {
108 if (!hostname) {}
109 return false;
110 }
111
112 bool range_limiter::remove(const machine_uid &first, const machine_uid &second)
113 {
114 if (first.valid() || second.valid()) {}
115 return false;
116 }
117
118 bool range_limiter::load(const astring &file_name, const astring &section)
119 {
120 if (!file_name || !section) {}
121 return false;
122 }
123
124 bool range_limiter::save(const astring &file_name, const astring &section)
125 {
126 if (!file_name || !section) {}
127 return false;
128 }
129
130 } //namespace.
131
132