feisty meow concerns codebase  2.140
range_limiter.cpp
Go to the documentation of this file.
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 
37 
38 class limiter_range_list : public amorph<range_record>
39 {
40 public:
41 };
42 
44 
45 range_limiter::range_limiter()
46 : _ranges(new limiter_range_list)
47 {
48 }
49 
51  const astring &section)
52 : _ranges(new limiter_range_list)
53 {
54  load(source_file, section);
55 }
56 
58 
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 
72 {
73 return DENY;
74 }
75 
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 
Provides a dynamically resizable ASCII character string.
Definition: astring.h:35
bool valid() const
Definition: machine_uid.h:68
bool add(const machine_uid &address, capabilities rights)
bool remove(const machine_uid &address)
bool load(const basis::astring &file_name, const basis::astring &section)
bool save(const basis::astring &file_name, const basis::astring &section)
capabilities get_default()
bool is_allowed(const machine_uid &host)
void set_default(capabilities rights)
The guards collection helps in testing preconditions and reporting errors.
Definition: array.h:30
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
Definition: functions.h:121
Provides access to the operating system's socket methods.
Definition: base_address.h:26
A dynamic container class that holds any kind of object via pointers.
Definition: amorph.h:55