X-Git-Url: https://git.syn-net.org/debian/?a=blobdiff_plain;f=src%2Fanyrtpproxy%2FportWindow.cpp;h=3ef17672d0f8063ac2d2240fb48235f532596d2c;hb=99099a6ccd03e2917bf29f8905e376c20033252a;hp=99dafd700f218af9c9f23b64442d410f52606f4d;hpb=058ae090a970436caec3b3059e9e18b310dd6b0d;p=anytun.git diff --git a/src/anyrtpproxy/portWindow.cpp b/src/anyrtpproxy/portWindow.cpp index 99dafd7..3ef1767 100644 --- a/src/anyrtpproxy/portWindow.cpp +++ b/src/anyrtpproxy/portWindow.cpp @@ -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 @@ -31,7 +32,7 @@ #include "portWindow.h" -PortWindow::PortWindow(u_int16_t start, u_int16_t end) : start_port_(start), end_port_(end) +PortWindow::PortWindow(uint16_t start, uint16_t end) : start_port_(start), end_port_(end) { } @@ -45,37 +46,41 @@ PortWindow::PortSet::size_type PortWindow::getLength() return ports_.size(); } -bool PortWindow::hasPort(u_int16_t port) +bool PortWindow::hasPort(uint16_t port) { Lock lock(mutex_); PortSet::const_iterator it=ports_.find(port); - if(it == ports_.end()) + if(it == ports_.end()) { return false; + } return true; } -bool PortWindow::freePort(u_int16_t port) +bool PortWindow::freePort(uint16_t port) { Lock lock(mutex_); PortSet::iterator it=ports_.find(port); - if(it == ports_.end()) + if(it == ports_.end()) { return false; - ports_.erase(it); + } + ports_.erase(it); return true; } -u_int16_t PortWindow::newPort() +uint16_t PortWindow::newPort() { Lock lock(mutex_); - u_int16_t port= start_port_; - while (port=end_port_) - return 0; - ports_.insert(port); - return port; + uint16_t port= start_port_; + while(port=end_port_) { + return 0; + } + ports_.insert(port); + return port; } void PortWindow::clear()