ccRTP 2.1.2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
phone.h
Go to the documentation of this file.
1 // Copyright (C) 2000-2005 Open Source Telecom Corporation.
2 // Copyright (C) 2006-2014 David Sugar, Tycho Softworks.
3 // Copyright (C) 2015 Cherokees of Idaho.
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 #ifndef CCXX_PHONE_H_
20 #define CCXX_PHONE_H_
21 
22 #ifndef CCXX_RTP_H_
23 #include <ccrtp/rtp.h>
24 #endif
25 
26 #ifdef CCXX_NAMESPACES
27 namespace ost {
28 #endif
29 
37 class KeyRTP : public Keydata
38 {
39 public:
43  KeyRTP();
44 
48  inline InetHostAddress getInterface(void)
49  {return InetHostAddress(getLast("interface"));};
50 
54  inline tpport_t getPort(void)
55  {return (tpport_t) atoi(getLast("port"));};
56 
60  inline microtimeout_t getTimer(void)
61  {return (microtimeout_t)atol(getLast("timer")) * 1000l;};
62 
67  {return (microtimeout_t)atol(getLast("expire")) * 1000l;};
68 };
69 
77 class KeyAudio : public Keydata
78 {
79 public:
83  KeyAudio();
84 };
85 
93 class KeyThreads : public Keydata
94 {
95 public:
99  KeyThreads();
100 
106  inline int priAudio(void)
107  {return atoi(getLast("audio"));};
108 
114  inline int priRTP(void)
115  {return atoi(getLast("rtp"));};
116 
122  inline int getPriority(void)
123  {return atoi(getLast("priority"));};
124 
130  inline unsigned getStack(void)
131  {return atoi(getLast("stack"));};
132 
133 
139  inline const char *getPolicy(void)
140  {return getLast("priority");};
141 };
142 
149 class RTPEvent
150 {
151 private:
152  friend class RTPAudio;
153 
154  static RTPEvent *first;
156 
157 protected:
158  RTPEvent();
159 
160  virtual void gotHello(const SyncSource &src)
161  {return;};
162 
163  virtual void gotGoodbye(const SyncSource &src,
164  const std::string& reason)
165  {return;};
166 };
167 
175 class RTPAudio : public RTPSocket
176 {
177 private:
178  unsigned groups; // multicast groups joined
179  bool unicast; // indicate if in unicast call
180  bool shutdown; // tracks shutdown state
181 
182  void onGotHello(const SyncSource &src);
183  void onGotGoodbye(const SyncSource &src, const std::string& reason);
184 
185 public:
186  RTPAudio();
187 
188  void exit(const char *reason);
189 };
190 
197 class DevAudio
198 {
199 protected:
200  DevAudio();
201 
202 public:
203  virtual void open(void) = 0; // open device channel
204  virtual void close(void) = 0; // close device channel
205 };
206 
207 extern bool multicast;
208 extern bool daemon;
209 extern KeyThreads keythreads;
210 extern KeyRTP keyrtp;
211 extern KeyAudio keyaudio;
212 extern RTPAudio *rtp;
213 extern DevAudio *audio;
214 
215 #ifdef CCXX_NAMESPACES
216 }
217 #endif
218 
219 #endif
KeyAudio keyaudio
Definition: config.cpp:74
bool unicast
Definition: phone.h:179
int priRTP(void)
Get relative priority for the rtp stack.
Definition: phone.h:114
RTPAudio * rtp
Definition: rtp.cpp:88
Synchronization source in an RTP session.
Definition: sources.h:192
KeyRTP keyrtp
Definition: config.cpp:75
This is the base interface for DSO loadable audio devices.
Definition: phone.h:197
uint32 microtimeout_t
Time interval expressed in microseconds.
Definition: base.h:67
unsigned groups
Definition: phone.h:178
microtimeout_t getExpire(void)
Get packet expiration timer.
Definition: phone.h:66
Load /etc/phone.conf [audio] key value pairs.
Definition: phone.h:77
tpport_t getPort(void)
Get binding port number.
Definition: phone.h:54
RTPEvent * next
Definition: phone.h:155
bool daemon
Definition: phone.cpp:34
Process RTP Events for plugins and special purpose classes.
Definition: phone.h:149
bool multicast
Definition: phone.cpp:33
DevAudio * audio
unsigned getStack(void)
Get thread stack frame size.
Definition: phone.h:130
virtual void gotHello(const SyncSource &src)
Definition: phone.h:160
const char * getPolicy(void)
Get scheduler policy to use.
Definition: phone.h:139
int getPriority(void)
Get relative process priority.
Definition: phone.h:122
This is the base session stack that will maintain all network audio activity.
Definition: phone.h:175
static RTPEvent * first
Definition: phone.h:154
Load /etc/phone.conf [thread] key value pairs.
Definition: phone.h:37
virtual void gotGoodbye(const SyncSource &src, const std::string &reason)
Definition: phone.h:163
This template class adds the threading aspect to the RTPSessionBase template in one of the many possi...
Definition: rtp.h:418
Load /etc/phone.conf [thread] key value pairs.
Definition: phone.h:93
InetHostAddress getInterface(void)
Get unicast address.
Definition: phone.h:48
int priAudio(void)
Get relative priority to run service threads at.
Definition: phone.h:106
Generic and audio/video profile specific RTP interface of ccRTP.
microtimeout_t getTimer(void)
Get stack timer.
Definition: phone.h:60
bool shutdown
Definition: phone.h:180
KeyThreads keythreads
Definition: config.cpp:73