- clang format + naming improved

This commit is contained in:
2026-09-03 10:03:42 +03:00
parent 249e614def
commit e166bae1ea
204 changed files with 20621 additions and 21019 deletions
+86 -87
View File
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2007-2010 Dmytro Bogovych <dmytro.bogovych@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -13,7 +13,7 @@
*
* 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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __RELIABLE_TUNNEL_H
#define __RELIABLE_TUNNEL_H
@@ -26,122 +26,121 @@
#include "../ICE/ICEReliableTransport.h"
#ifdef USE_CRYPTOPP
# include "../Libs/CryptoPP/blowfish.h"
#include "../Libs/CryptoPP/blowfish.h"
#endif
#ifdef USE_OPENSSL
# include "../Libs/openssl/include/openssl/blowfish.h"
#include "../Libs/openssl/include/openssl/blowfish.h"
#endif
class ReliableTunnel: public DataProvider, public resip::ThreadIf, public ICEImpl::ReliableTransport::Encryption
class ReliableTunnel : public DataProvider, public resip::ThreadIf, public ICEImpl::ReliableTransport::Encryption
{
public:
ReliableTunnel(const char* streamname);
virtual ~ReliableTunnel();
// Returns provider RTP name
virtual std::string streamName();
// Returns provider RTP profile name
virtual std::string streamProfile();
// Sets destination IP address
virtual void setDestinationAddress(InternetAddress& addr);
ReliableTunnel(const char* streamname);
virtual ~ReliableTunnel();
// Processes incoming data
virtual void processData(const void* dataBuffer, int dataSize);
// Returns provider RTP name
virtual std::string streamName();
// This method is called by user agent to send ICE packet from mediasocket
virtual void sendData(InternetAddress& destination, const void* dataBuffer, unsigned int datasize);
// Returns provider RTP profile name
virtual std::string streamProfile();
// Updates SDP offer
virtual void updateSdpOffer(resip::SdpContents::Session::Medium& sdp);
// Sets destination IP address
virtual void setDestinationAddress(InternetAddress& addr);
// Called by user agent when session is terminated.
virtual void sessionTerminated();
// Processes incoming data
virtual void processData(const void* dataBuffer, int dataSize);
// Called by user agent when session is started.
virtual void sessionEstablished(int conntype);
// This method is called by user agent to send ICE packet from mediasocket
virtual void sendData(InternetAddress& destination, const void* dataBuffer, unsigned int datasize);
// Updates SDP offer
virtual void updateSdpOffer(resip::SdpContents::Session::Medium& sdp);
// Called by user agent when session is terminated.
virtual void sessionTerminated();
// Called by user agent when session is started.
virtual void sessionEstablished(int conntype);
// Called by user agent to save media socket for this provider
virtual void setSocket(DatagramSocket& socket4, DatagramSocket& socket6);
// Called by user agent to get media socket for this provider
virtual DatagramSocket& socket(int family);
virtual void setSocket(DatagramSocket& socket4, DatagramSocket& socket6);
// Called by user agent to process media stream description from remote peer.
// Returns true if description is processed succesfully. Otherwise method returns false.
virtual bool processSdpOffer(const resip::SdpContents::Session::Medium& media);
// Called by user agent to get media socket for this provider
virtual DatagramSocket& socket(int family);
virtual void thread();
// Called by user agent to process media stream description from remote peer.
// Returns true if description is processed succesfully. Otherwise method returns false.
virtual bool processSdpOffer(const resip::SdpContents::Session::Medium& media);
// Enqueues outgoing packet to sending queue
void queueData(const void* bufferPtr, int bufferSize);
void setBandwidth(unsigned int bytesPerSecond);
unsigned int bandwidth();
// Checks if there is any received application data
bool hasData();
// Reads received data. If ptr is NULL - the length of available data is returned.
unsigned getData(void* ptr, unsigned capacity);
virtual void thread();
void setEncryptionKey(void* ptr, unsigned length);
// Enqueues outgoing packet to sending queue
void queueData(const void* bufferPtr, int bufferSize);
void setBandwidth(unsigned int bytesPerSecond);
unsigned int bandwidth();
// Checks if there is any received application data
bool hasData();
// Reads received data. If ptr is NULL - the length of available data is returned.
unsigned getData(void* ptr, unsigned capacity);
void setEncryptionKey(void* ptr, unsigned length);
protected:
// SDP's stream name
std::string mStreamName;
// SDP's stream name
std::string mStreamName;
// Transport stack
ICEImpl::ReliableTransport mStack;
// Socket handles to operate
DatagramSocket mSocket4;
DatagramSocket mSocket6;
// Transport stack
ICEImpl::ReliableTransport mStack;
// Destination IP4/6 address
InternetAddress mDestination;
// Win32 exit signal
HANDLE mExitSignal;
// Win32 "new outgoing data" signal
HANDLE mDataSignal;
// Mutex to protect queuing/sending outgoing data
resip::Mutex mOutgoingMtx;
std::vector<std::string>
mNewQueued;
resip::Mutex mNewQueuedGuard;
resip::Mutex mStackGuard;
// Socket handles to operate
DatagramSocket mSocket4;
DatagramSocket mSocket6;
// Destination IP4/6 address
InternetAddress mDestination;
// Win32 exit signal
HANDLE mExitSignal;
// Win32 "new outgoing data" signal
HANDLE mDataSignal;
// Mutex to protect queuing/sending outgoing data
resip::Mutex mOutgoingMtx;
std::vector<std::string> mNewQueued;
resip::Mutex mNewQueuedGuard;
resip::Mutex mStackGuard;
unsigned int mBandwidth;
std::string mEncryptionKey;
unsigned int mBandwidth;
std::string mEncryptionKey;
#ifdef USE_CRYPTOPP
CryptoPP::BlowfishEncryption mEncryptor;
CryptoPP::BlowfishDecryption mDecryptor;
CryptoPP::BlowfishEncryption mEncryptor;
CryptoPP::BlowfishDecryption mDecryptor;
#endif
#ifdef USE_OPENSSL
BF_KEY mCipher;
BF_KEY mCipher;
#endif
ICEImpl::ICEByteBuffer mIncomingData;
ICEImpl::ICEByteBuffer mIncomingData;
// Returns block size for encryption algorythm
int blockSize();
// Encrypts dataPtr buffer inplace. dataSize must be odd to GetBlockSize() returned value.
void encrypt(void* dataPtr, int dataSize);
// Returns block size for encryption algorythm
int blockSize();
// Decrypts dataPtr buffer inplace. dataSize must be odd to GetBlockSize() returned value.
void decrypt(void* dataPtr, int dataSize);
// Encrypts dataPtr buffer inplace. dataSize must be odd to GetBlockSize() returned value.
void encrypt(void* dataPtr, int dataSize);
// Calculates CRC
unsigned crc(const void* dataptr, int datasize);
// Decrypts dataPtr buffer inplace. dataSize must be odd to GetBlockSize() returned value.
void decrypt(void* dataPtr, int dataSize);
void sendOutgoing();
// Calculates CRC
unsigned crc(const void* dataptr, int datasize);
void sendOutgoing();
};
#endif