freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

resiprocate協(xié)議棧分析(編輯修改稿)

2024-12-12 06:08 本頁面
 

【文章內(nèi)容簡介】 TransactionTerminated*, TimerMessage*, SipMessage* or derived ApplicationMessage* */ Message* receiveAny()。 /** Return true if the stack has new messages for the TU. Since the addition of TransactionUsers, this method is deprecated. This only looks into the old TuFifo that is not associated with any TransactionUser. @deprecated */ bool hasMessage() const。 五、幾個成員變量的說明 /// if this object exists, it manages advanced security featues Security* mSecurity。 這是 如果需要安全處理而用到的類。 DnsStub* mDnsStub。 這是如果自己定義 DNS處理的話所需要的 DNS處理的存根和截取器。 /// if this object exists, it get39。s notified when ApplicationMessage39。s get posted AsyncProcessHandler* mAsyncProcessHandler。 異步處理的基類指針對象,可以自定義異步處理的方式。 /** fifo used to municate between the TU (Transaction User) and stack Note: since the introduction of multiple TU39。s this Fifo should no longer be used by most applications each TU now owns it39。s own Fifo. */ TimeLimitFifoMessage mTUFifo。 這個就不用說啦,看注釋吧。 /// Protection for AppTimerQueue mutable Mutex mAppTimerMutex。 整個協(xié)議棧的同步都是集中利用了源碼中實現(xiàn)的同步對象,非常不錯,實現(xiàn)同步類的理論基礎(chǔ)應(yīng)該是基于大師 BS的理論“資源開 始即初始化”。 /// All aspects of the Transaction State Machine / DNS resolver TransactionController mTransactionController。 /** store all domains that this stack is responsible for. Controlled by addAlias and addTransport interfaces and checks can be made with isMyDomain() */ std::setData mDomains。 /// Responsible for routing messages to the correct TU based on installed rules TuSelector mTuSelector。 TransactionController 模塊 在 SipStack中看到這樣的描述: /// All aspects of the Transaction State Machine / DNS resolver TransactionController mTransactionController。 注意 all aspects在我的理解中這又是一個界面類, SipStack是 Sip Core整個庭院的外圍的門面的話這又是進入庭院后第二道城墻;就如庭院高深的故宮和亭廊回環(huán)的蘇州園林它們的實現(xiàn)中更有層次的遞張以及庭院間的交互回環(huán)。 BS教導(dǎo)我們不要寫“臃腫的界面”, SipStack這個大界面里面又套這個實現(xiàn)層次的界面是不是一種 好的實踐呢?我的理解是,應(yīng)該是這樣的。―――努力達(dá)到界面和實現(xiàn)分離。 現(xiàn)在就看看這個 Transaction State Machine / DNS resolver界面類吧,在我的實現(xiàn)中,其實把 DNS Resolver部分清理掉啦,導(dǎo)致只是個 Transaction State Machine 的界面類吧。 如果仔細(xì)看看 TransactionControl 的函數(shù)也就是它的接口函數(shù)的話和 SipStack就差不離,翻版而也,就是一道門進去還是一道門,就連造型都差不多,外面是拱洞型的里面還是;故宮和蘇州園林的設(shè)計 把古建筑的設(shè)計模式推向了極致。 還是列一下吧: void process(FdSetamp。 fdset)。 unsigned int getTimeTillNextProcessMS()。 void buildFdSet(FdSetamp。 fdset)。 // graceful shutdown (eventually) void shutdown()。 TransportSelectoramp。 transportSelector() { return mTransportSelector。 } const TransportSelectoramp。 transportSelector() const { return mTransportSelector。 } bool isTUOverloaded() const。 void send(SipMessage* msg)。 再看一下幾個重要的成員變量: // fifo used to municate to the transaction state machine within the // stack. Not for external use by the application. May contain, sip // messages (requests and responses), timers (used by state machines), // asynchronous dns responses, transport errors from the underlying // transports, etc. FifoTransactionMessage mStateMacFifo。 // from the sipstack (for convenience) TuSelectoramp。 mTuSelector。 // Used to decide which transport to send a sip message on. TransportSelector mTransportSelector。 // stores all of the transactions that are currently active in this stack TransactionMap mClientTransactionMap。 TransactionMap mServerTransactionMap。 重點和關(guān)鍵成員變量: FifoTransactionMessage mStateMacFifo。 看看這個成員變量的價值: void TransactionController::send(SipMessage* msg) { (msg)。 } 消息的流動不可能到此為止,它要上傳下遞,如何實現(xiàn)的呢? 看看構(gòu)造函數(shù)吧: TransactionController::TransactionController(SipStackamp。 stack) : mStack(stack), mRegisteredForTransactionTermination(false), mDiscardStrayResponses(true), mStateMacFifo(), mTuSelector(), mTransportSelector(mStateMacFifo, (), ()), mTimers(mStateMacFifo), mShuttingDown(false), mStatsManager() { } 既然都點出來了,就繼續(xù)往下看看,看看流向 TransportSelector會怎樣呢 : TransportSelector::TransportSelector(FifoTransactionMessageamp。 fifo, Security* security, DnsStubamp。 dnsStub) : mDns(dnsStub), mStateMacFifo(fifo), mSecurity(security), mSocket( INVALID_SOCKET ), mSocket6( INVALID_SOCKET ) { memset(amp。, 0, sizeof(sockaddr_in))。 = AF_UNSPEC。 } 再讓我們看另外一支,只是一直在 Process中處理的: void TransactionController::process(FdSetamp。 fdset) { if (mShuttingDown amp。amp。 !() amp。amp。 !() amp。amp。 ()) { 。 } else { 。 while (()) { TransactionState::process(*this)。 } } } TransactionState 的這個靜態(tài)函數(shù) Process 的參數(shù)居然是 *this,也就是是說 TransactionState 能從TransactionControler 得到它所要的內(nèi)容,因此先讓我們過去瀏覽一下先: 想了一下這兒放下暫且不表,我們到 TransactionState 部分再詳細(xì)到來,但是我們知道下一步的流向?qū)⑹悄膬骸? 再粗粗的看了一下 TransactionControler 我們發(fā)現(xiàn)內(nèi)容并不多, Control 者只是一個控制調(diào)節(jié)的角色,它是一個 contact window。向外是聯(lián)系的窗口,向內(nèi)負(fù)責(zé)安排和 分派其他包容的角色去實現(xiàn)。 在 TransactionControler 中有兩個比較重要的成員變量: // from the sipstack (for convenience) TuSelectoramp。 mTuSelector。 // Used to decide which transport to send a sip message on. TransportSelector mTransportSelector。 // stores all of the transactions that are currently active in this stack TransactionMap mClientTransactionMap。 TransactionMap mServerTransactionMap。 可以看出它包含和管理的分別是三個層次的對象: Transaction User、 Transport、 TransactionState 它對這幾個對象的互動和控制基本就在 Process里面完成。 并且為了以示關(guān)聯(lián),我們先 看看 mClientTransactionMap 是在哪兒體現(xiàn)它的價值的: void TransactionState::add(const Dataamp。 tid) { if (mMachine == ClientNonInvite || mMachine == ClientInvite || mMachine == ClientStale || mMachine == Stateless )
點擊復(fù)制文檔內(nèi)容
黨政相關(guān)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1