X-Git-Url: https://git.syn-net.org/debian/?a=blobdiff_plain;f=src%2FconnectionList.h;h=750a1423f36696553db65eb9be30ec894e922a28;hb=bd02a5f6be4815d46524d613f727199ca756c971;hp=cdf5268929f8cbfaf70aa99c1bff40a9cda4dcf2;hpb=058ae090a970436caec3b3059e9e18b310dd6b0d;p=anytun.git diff --git a/src/connectionList.h b/src/connectionList.h index cdf5268..750a142 100644 --- a/src/connectionList.h +++ b/src/connectionList.h @@ -11,14 +11,15 @@ * 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 * * 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 @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _CONNECTION_LIST_H -#define _CONNECTION_LIST_H +#ifndef ANYTUN_connectionList_h_INCLUDED +#define ANYTUN_connectionList_h_INCLUDED #include #include @@ -39,37 +40,40 @@ #include "datatypes.h" #include "connectionParam.h" #include "networkAddress.h" -typedef std::map ConnectionMap; +typedef std::map 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_; };