range_limiter.cpp

Go to the documentation of this file.
00001 /*****************************************************************************\
00002 *                                                                             *
00003 *  Name   : range_limiter                                                     *
00004 *  Author : Chris Koeritz                                                     *
00005 *                                                                             *
00006 *******************************************************************************
00007 * Copyright (c) 2002-$now By Author.  This program is free software; you can  *
00008 * redistribute it and/or modify it under the terms of the GNU General Public  *
00009 * License as published by the Free Software Foundation; either version 2 of   *
00010 * the License or (at your option) any later version.  This is online at:      *
00011 *     http://www.fsf.org/copyleft/gpl.html                                    *
00012 * Please send any updates to: fred@gruntose.com                               *
00013 \*****************************************************************************/
00014 
00015 #include "range_limiter.h"
00016 #include "machine_uid.h"
00017 
00018 #include <basis/astring.h>
00019 #include <structures/amorph.h>
00020 
00021 using namespace basis;
00022 using namespace structures;
00023 
00024 namespace sockets {
00025 
00026 class range_record
00027 {
00028 public:
00029   machine_uid _first;
00030   machine_uid _second;
00031   astring _host;
00032   bool _is_host;  // true if the host has any useful information.
00033   bool _single;  // true if only the first address matters.
00034 };
00035 
00037 
00038 class limiter_range_list : public amorph<range_record>
00039 {
00040 public:
00041 };
00042 
00044 
00045 range_limiter::range_limiter()
00046 : _ranges(new limiter_range_list)
00047 {
00048 }
00049 
00050 range_limiter::range_limiter(const astring &source_file,
00051     const astring &section)
00052 : _ranges(new limiter_range_list)
00053 {
00054   load(source_file, section);
00055 }
00056 
00057 range_limiter::~range_limiter() { WHACK(_ranges); }
00058 
00059 bool range_limiter::is_allowed(const machine_uid &host)
00060 {
00061 if (host.valid()) {}
00062 return false;
00063 }
00064 
00065 bool range_limiter::is_allowed(const astring &hostname)
00066 {
00067 if (!hostname) {}
00068 return false;
00069 }
00070 
00071 range_limiter::capabilities range_limiter::get_default()
00072 {
00073 return DENY;
00074 }
00075 
00076 void range_limiter::set_default(capabilities rights)
00077 {
00078 if (!rights) {}
00079 }
00080 
00081 bool range_limiter::add(const machine_uid &address, capabilities rights)
00082 {
00083 if (address.valid() || rights) {}
00084 return false;
00085 }
00086 
00087 bool range_limiter::add(const astring &hostname, capabilities rights)
00088 {
00089 if (!hostname || rights) {}
00090 return false;
00091 }
00092 
00093 bool range_limiter::add(const machine_uid &first, const machine_uid &second,
00094     capabilities rights)
00095 {
00096 if (first.valid() || second.valid() || rights) {}
00097 return false;
00098 }
00099 
00100 bool range_limiter::remove(const machine_uid &address)
00101 {
00102 if (address.valid()) {}
00103 return false;
00104 }
00105 
00106 bool range_limiter::remove(const astring &hostname)
00107 {
00108 if (!hostname) {}
00109 return false;
00110 }
00111 
00112 bool range_limiter::remove(const machine_uid &first, const machine_uid &second)
00113 {
00114 if (first.valid() || second.valid()) {}
00115 return false;
00116 }
00117 
00118 bool range_limiter::load(const astring &file_name, const astring &section)
00119 {
00120 if (!file_name || !section) {}
00121 return false;
00122 }
00123 
00124 bool range_limiter::save(const astring &file_name, const astring &section)
00125 {
00126 if (!file_name || !section) {}
00127 return false;
00128 }
00129 
00130 } //namespace.
00131 
00132 
Generated on Sat Jan 28 04:22:43 2012 for hoople2 project by  doxygen 1.6.3