Files
GeuReflector/src/async/audio/AsyncAudioDecoderSpeex.h
T
Audric fca7c33794 Security hardening: fix 19 of 22 vulnerabilities found in audit
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
2026-03-20 11:54:18 +01:00

194 lines
4.9 KiB
C++

/**
@file AsyncAudioDecoderSpeex.h
@brief An audio decoder that use the Speex audio codec
@author Tobias Blomberg / SM0SVX
@date 2008-10-15
\verbatim
Async - A library for programming event driven applications
Copyright (C) 2003-2008 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
*/
#ifndef ASYNC_AUDIO_DECODER_SPEEX_INCLUDED
#define ASYNC_AUDIO_DECODER_SPEEX_INCLUDED
/****************************************************************************
*
* System Includes
*
****************************************************************************/
#include <speex/speex.h>
/****************************************************************************
*
* Project Includes
*
****************************************************************************/
#include <AsyncAudioDecoder.h>
/****************************************************************************
*
* Local Includes
*
****************************************************************************/
/****************************************************************************
*
* Forward declarations
*
****************************************************************************/
/****************************************************************************
*
* Namespace
*
****************************************************************************/
namespace Async
{
/****************************************************************************
*
* Forward declarations of classes inside of the declared namespace
*
****************************************************************************/
/****************************************************************************
*
* Defines & typedefs
*
****************************************************************************/
/****************************************************************************
*
* Exported Global Variables
*
****************************************************************************/
/****************************************************************************
*
* Class definitions
*
****************************************************************************/
/**
@brief An audio decoder that use the Speex audio codec
@author Tobias Blomberg / SM0SVX
@date 2008-10-15
This class implements an audio decoder that use the Speex audio codec.
*/
class AudioDecoderSpeex : public AudioDecoder
{
public:
/**
* @brief Default constuctor
*/
AudioDecoderSpeex(void);
/**
* @brief Destructor
*/
virtual ~AudioDecoderSpeex(void);
/**
* @brief Get the name of the codec
* @returns Return the name of the codec
*/
virtual const char *name(void) const { return "SPEEX"; }
/**
* @brief Set an option for the decoder
* @param name The name of the option
* @param value The value of the option
*/
virtual void setOption(const std::string &name, const std::string &value);
/**
* @brief Print codec parameter settings
*/
virtual void printCodecParams(void) const;
/**
* @brief Get the frame size for the decoder
* @return Returns the decoder frame size
*/
int frameSize(void) const { return frame_size; }
/**
* @brief Enable or disable the perceptual enhancer
* @param enable Set to \em true to enable or \em false to disable
* @return Returns the new setting
*/
bool enableEnhancer(bool enable);
/**
* @brief Get the perceptual enhance enable/disable state
* @return Returns \em true if the enhancer is enabled or \em false if
* it's not
*/
bool enhancerEnabled(void) const;
/**
* @brief Write encoded samples into the decoder
* @param buf Buffer containing encoded samples
* @param size The size of the buffer
*/
virtual void writeEncodedSamples(void *buf, int size);
protected:
private:
SpeexBits bits;
void *dec_state;
int frame_size;
AudioDecoderSpeex(const AudioDecoderSpeex&);
AudioDecoderSpeex& operator=(const AudioDecoderSpeex&);
}; /* class AudioDecoderSpeex */
} /* namespace */
#endif /* ASYNC_AUDIO_DECODER_SPEEX_INCLUDED */
/*
* This file has not been truncated
*/