从
VocalsipbaseBaseProxyTestMain.cxx入手开始学习Vocal程序。
It is specified as a test program in the Makefile.
It creates Builder and HeartlessProxy objects and then runs the proxy object. SIP messages can then be sent to the Proxy IP address:port and will be passed to the Proxy Builder. After that, it is up the designer to add his/her message processing code.
首先建立了Builder对象。
Builder is a base class. It is passed Events by the WorkerThread. for processing. It is a Feature container. Feature is a State container.State is an Operator container. It also contains a pointer to the proxy CallContainer. A builder object is used in constructing a HeartLessProxy/BasicProxy object.
/* C++ 的成员初始化表 , C++ Primer pg570 */
class Account {
...
inline Account ()
: _name(0), _balance(0.0), _acct_nmbr(0)
{} //_name = 0, _balance = 0.0, _acct_nmbr = 0
...
}
然后以Builder对象等为参数建立HeartLessProxy对象,该对象的run方法启动以下两个类的thread方法:
SipThread
SipThread is a ThreadIf. SipThread blocks on sipstack receive. On
receiving a SipMsg it creates a SipEvent. The SipEvent then gets posted
to fifo. The SipThread::thread() has the while loop.
WorkerThread
WorkerThread is a ThreadIf. It has a input queue on which it is blocked.
The input queue contains sip proxy events.
以上的总体工作就是新建两个线程,一个线程等待接收message,当收到的时候就建立event对象放
入到FIFO队列;另一个线程从该FIFO队列中取出事件进行处理。