Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

phone.h

Go to the documentation of this file.
00001 // Copyright (C) 2000-2002 Open Source Telecom Corporation.
00002 //
00003 // This program is free software; you can redistribute it and/or modify
00004 // it under the terms of the GNU General Public License as published by
00005 // the Free Software Foundation; either version 2 of the License, or
00006 // (at your option) any later version.
00007 //
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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;        // multicast groups joined
00177         bool    unicast;        // indicate if in unicast call
00178         bool    shutdown;       // tracks shutdown state
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;    // open device channel
00202         virtual void close(void) = 0;   // close device channel
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

© sourcejam.com 2005-2008