* tunneling and relaying of packets of any protocol.
*
*
- * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl,
+ * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl,
* Christian Pointner <satp@wirdorange.org>
*
* This file is part of Anytun.
*
* Anytun is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * any later version.
*
* Anytun is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* along with anytun. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _CONNECTION_LIST_H
-#define _CONNECTION_LIST_H
+#ifndef ANYTUN_connectionList_h_INCLUDED
+#define ANYTUN_connectionList_h_INCLUDED
#include <map>
#include <deque>
#include "datatypes.h"
#include "connectionParam.h"
#include "networkAddress.h"
-typedef std::map<u_int16_t, ConnectionParam> ConnectionMap;
+typedef std::map<uint16_t, ConnectionParam> ConnectionMap;
class ConnectionList
{
public:
- ConnectionList();
- ~ConnectionList();
- static ConnectionList& instance();
- void addConnection(ConnectionParam &conn, u_int16_t mux);
- const ConnectionMap::iterator getConnection(u_int16_t mux);
- const ConnectionMap::iterator getEnd();
- ConnectionMap::iterator getEndUnlocked();
- ConnectionMap::iterator getBeginUnlocked();
- const ConnectionMap::iterator getBegin();
- ConnectionParam & getOrNewConnectionUnlocked(u_int16_t mux);
- bool empty();
- void clear();
+ ConnectionList();
+ ~ConnectionList();
+ static ConnectionList& instance();
+ void addConnection(ConnectionParam& conn, uint16_t mux);
+ const ConnectionMap::iterator getConnection(uint16_t mux);
+ const ConnectionMap::iterator getEnd();
+ ConnectionMap::iterator getEndUnlocked();
+ ConnectionMap::iterator getBeginUnlocked();
+ const ConnectionMap::iterator getBegin();
+ ConnectionParam& getOrNewConnectionUnlocked(uint16_t mux);
+ bool empty();
+ void clear();
Mutex& getMutex();
private:
static Mutex instMutex;
- static ConnectionList* inst;
- class instanceCleaner {
- public: ~instanceCleaner() {
- if(ConnectionList::inst != 0)
- delete ConnectionList::inst;
- }
+ static ConnectionList* inst;
+ class instanceCleaner
+ {
+ public:
+ ~instanceCleaner() {
+ if(ConnectionList::inst != 0) {
+ delete ConnectionList::inst;
+ }
+ }
};
- ConnectionList(const ConnectionList &s);
- void operator=(const ConnectionList &s);
- ConnectionMap connections_;
+ ConnectionList(const ConnectionList& s);
+ void operator=(const ConnectionList& s);
+ ConnectionMap connections_;
Mutex mutex_;
};