1 #ifndef __NETWORKCOMM_H
2 #define __NETWORKCOMM_H
6 #include <crypto++/randpool.h>
7 using namespace CryptoPP;
15 #include "boost/shared_ptr.hpp"
24 class JVOIPSessionParams;
25 class JVOIPRTPTransmissionParams;
28 #ifdef NETCOMM_PORTAUDIO
29 #include <pa/portaudio.h>
30 #define MAX_PA_CPU_LOAD 0.5
45 std::deque< std::string >message_history;
46 unsigned short max_messages;
47 std::list< ClientPtr > commClients;
51 float min_freq, max_freq;
59 boost::shared_ptr< VsnetDownload::Client::Manager >_downloader;
60 boost::shared_ptr< VsnetDownload::Server::Manager >_downloadServer;
65 JVOIPSession *session;
66 JVOIPSessionParams *params;
67 JVOIPRTPTransmissionParams *rtpparams;
69 #ifdef NETCOMM_PORTAUDIO
72 PaDeviceInfo *devinfo;
73 PortAudioStream *instream;
74 PortAudioStream *outstream;
79 unsigned short audio_outbuffer[
MAXBUFFER];
81 friend int Pa_RecordCallback(
void *inputBuffer,
83 unsigned long framesPerBuffer,
86 friend int Pa_PlayCallback(
void *inputBuffer,
88 unsigned long framesPerBuffer,
95 std::string crypto_method;
97 unsigned int key_length;
98 std::string pubKeyFilename;
99 std::string privKeyFilename;
105 std::string EncryptBuffer(
const char *
buffer,
unsigned int length = 0 );
106 std::string DecryptBuffer(
const char *buffer,
unsigned int length = 0 );
112 NetworkCommunication(
float minfreq,
float maxfreq,
bool video,
bool secured, std::string method );
116 int InitSession(
float frequency );
120 void RecvSound(
const char *sndbuffer,
int length,
bool encrypted =
false );
121 void RecvMessage( std::string message,
bool encrypted =
false );
122 int DestroySession();
131 char * GetWebcamCapture();
132 char * GetWebcamFromNetwork(
int &length );
133 void StartWebcamTransfer();
134 void StopWebcamTransfer();
143 void SwitchSecured();
148 return this->min_freq;
152 return this->max_freq;