Newer
Older
Copyright (C) 2008 Sebastien LUTTRINGER <contact@seblu.net>
SLS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
SLS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SLS; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// -----------------------------------------------------------------------------
// Classes
// -----------------------------------------------------------------------------
// Host
struct Host {
string login;
string pass;
string ipv4;
int level;
};
typedef std::list<Host> Hosts;
// Group
struct Group {
string name;
Hosts hosts;
};
typedef std::list<Group> Groups;
// User
struct User {
string login;
string pass;
int level;
bool priv;
};
typedef std::list<User> Users;
// Script
struct Script {
string name;
string path;
int level;
};
typedef std::list<Script> Scripts;
// Alias
struct Alias {
string name;
string val;
};
typedef std::list<Alias> Aliases;
// Data container
void close();
protected:
void load_hosts_();
void load_groups_();
void load_users_();
void load_scripts_();
void load_aliases_();
void save_hosts_();
void save_groups_();
void save_users_();
void save_scripts_();
void save_aliases_();
void exec(const string &sql);
private:
sqlite3 *db_;
Hosts hosts_;
Groups groups_;
Users users_;
Scripts scripts_;
Aliases aliases_;