Critical: - Trunk HMAC-SHA1 auth: MsgTrunkHello now carries nonce+digest, peer disconnected on secret mismatch (was loaded but never verified) High: - Pre-hello guard: reject all trunk messages before handshake completes - CSPRNG for password generator: random.choice -> secrets.choice Medium: - Path traversal protection on callsign-based file operations - Replace assert() on network-derived UDP data with error handling - HTTP server connection throttling (matching main TCP server) - try/catch on regex compilation in callsignOk()/emailOk() - Per-link trunk talker tracking (clearAllTrunkTalkers scoped to peer) - Regenerate priority nonce on each new trunk connection - Cap active TGs and trunk talkers at 10000 each - Don't reset heartbeat for unauthenticated client app messages - Fix RENEW_AFTER integer division (2/3 -> 2.0/3.0) Low: - JSON-escape HTTP method in error response - snprintf for pidfile error message - MsgAuthResponse::digest() null check on empty vector - Check unpack() return values in AsyncMsg.h vector/map/string - Replace stack VLA with std::string; reserve+push_back vs resize - Require TalkerStart before accepting trunk audio
188 lines
4.5 KiB
C++
188 lines
4.5 KiB
C++
/**
|
|
@file AsyncAudioDeviceFactory.cpp
|
|
@brief A class for handling audio device types
|
|
@author Tobias Blomberg / SM0SVX
|
|
@date 2009-12-26
|
|
|
|
\verbatim
|
|
Async - A library for programming event driven applications
|
|
Copyright (C) 2003-2013 Tobias Blomberg / SM0SVX
|
|
|
|
This program 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; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program 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 this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
\endverbatim
|
|
*/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
*
|
|
* System Includes
|
|
*
|
|
****************************************************************************/
|
|
|
|
#include <iostream>
|
|
|
|
|
|
/****************************************************************************
|
|
*
|
|
* Project Includes
|
|
*
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
*
|
|
* Local Includes
|
|
*
|
|
****************************************************************************/
|
|
|
|
#include "AsyncAudioDeviceFactory.h"
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
*
|
|
* Namespaces to use
|
|
*
|
|
****************************************************************************/
|
|
|
|
using namespace std;
|
|
using namespace Async;
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
*
|
|
* Defines & typedefs
|
|
*
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
*
|
|
* Local class definitions
|
|
*
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
*
|
|
* Prototypes
|
|
*
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
*
|
|
* Exported Global Variables
|
|
*
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
*
|
|
* Local Global Variables
|
|
*
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
*
|
|
* Public static functions
|
|
*
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
*
|
|
* Public member functions
|
|
*
|
|
****************************************************************************/
|
|
|
|
AudioDeviceFactory::~AudioDeviceFactory(void)
|
|
{
|
|
} /* AudioDeviceFactory::~AudioDeviceFactory */
|
|
|
|
|
|
bool AudioDeviceFactory::registerCreator(const std::string &name,
|
|
CreatorFunc creator)
|
|
{
|
|
creator_map[name] = creator;
|
|
return true;
|
|
} /* AudioDeviceFactory::registerCreator */
|
|
|
|
|
|
AudioDevice *AudioDeviceFactory::create(const std::string &name,
|
|
const std::string &dev_name)
|
|
{
|
|
CreatorMap::iterator it = creator_map.find(name);
|
|
if (it == creator_map.end())
|
|
{
|
|
return 0;
|
|
}
|
|
return it->second(dev_name);
|
|
} /* AudioDeviceFactory::create */
|
|
|
|
|
|
std::string AudioDeviceFactory::validDevTypes(void) const
|
|
{
|
|
string type_list;
|
|
CreatorMap::const_iterator it;
|
|
for (it = creator_map.begin(); it != creator_map.end(); ++it)
|
|
{
|
|
if (!type_list.empty())
|
|
{
|
|
type_list += " ";
|
|
}
|
|
type_list += it->first;
|
|
}
|
|
return type_list;
|
|
} /* AudioDeviceFactory::validDevTypes */
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
*
|
|
* Protected member functions
|
|
*
|
|
****************************************************************************/
|
|
|
|
AudioDeviceFactory::AudioDeviceFactory(void)
|
|
{
|
|
} /* AudioDeviceFactory::AudioDeviceFactory */
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
*
|
|
* Private member functions
|
|
*
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
* This file has not been truncated
|
|
*/
|
|
|