00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef CCXX_PHONE_H_
00018 #define CCXX_PHONE_H_
00019
00020 #ifndef CCXX_RTP_H_
00021 #include <ccrtp/rtp.h>
00022 #endif
00023
00024 #ifdef CCXX_NAMESPACES
00025 namespace ost {
00026 #endif
00027
00035 class KeyRTP : public Keydata
00036 {
00037 public:
00041 KeyRTP();
00042
00046 inline InetHostAddress getInterface(void)
00047 {return InetHostAddress(getLast("interface"));};
00048
00052 inline tpport_t getPort(void)
00053 {return (tpport_t) atoi(getLast("port"));};
00054
00058 inline microtimeout_t getTimer(void)
00059 {return (microtimeout_t)atol(getLast("timer")) * 1000l;};
00060
00064 inline microtimeout_t getExpire(void)
00065 {return (microtimeout_t)atol(getLast("expire")) * 1000l;};
00066 };
00067
00075 class KeyAudio : public Keydata
00076 {
00077 public:
00081 KeyAudio();
00082 };
00083
00091 class KeyThreads : public Keydata
00092 {
00093 public:
00097 KeyThreads();
00098
00104 inline int priAudio(void)
00105 {return atoi(getLast("audio"));};
00106
00112 inline int priRTP(void)
00113 {return atoi(getLast("rtp"));};
00114
00120 inline int getPriority(void)
00121 {return atoi(getLast("priority"));};
00122
00128 inline unsigned getStack(void)
00129 {return atoi(getLast("stack"));};
00130
00131
00137 inline const char *getPolicy(void)
00138 {return getLast("priority");};
00139 };
00140
00147 class RTPEvent
00148 {
00149 private:
00150 friend class RTPAudio;
00151
00152 static RTPEvent *first;
00153 RTPEvent *next;
00154
00155 protected:
00156 RTPEvent();
00157
00158 virtual void gotHello(const SyncSource &src)
00159 {return;};
00160
00161 virtual void gotGoodbye(const SyncSource &src,
00162 const std::string& reason)
00163 {return;};
00164 };
00165
00173 class RTPAudio : public RTPSocket
00174 {
00175 private:
00176 unsigned groups;
00177 bool unicast;
00178 bool shutdown;
00179
00180 void onGotHello(const SyncSource &src);
00181 void onGotGoodbye(const SyncSource &src, const std::string& reason);
00182
00183 public:
00184 RTPAudio();
00185
00186 void exit(const char *reason);
00187 };
00188
00195 class DevAudio
00196 {
00197 protected:
00198 DevAudio();
00199
00200 public:
00201 virtual void open(void) = 0;
00202 virtual void close(void) = 0;
00203 };
00204
00205 extern bool multicast;
00206 extern bool daemon;
00207 extern KeyThreads keythreads;
00208 extern KeyRTP keyrtp;
00209 extern KeyAudio keyaudio;
00210 extern RTPAudio *rtp;
00211 extern DevAudio *audio;
00212
00213 #ifdef CCXX_NAMESPACES
00214 };
00215 #endif
00216
00217 #endif