<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                從前面的章節,我們知道消息有多種類型,LwIP中消息是有多種結構的的,對于不同的消息類型其封裝是不一樣的,tcpip\_thread線程是通過tcpip\_msg描述消息的,tcpip\_thread線程接收到消息后,根據消息的類型進行不同的處理。LwIP中使用tcpip\_msg\_type枚舉類型定義了系統中可能出現的消息的類型,消息結構msg字段是一個共用體,其中定義了各種消息類型的具體內容,每種類型的消息對應了共用體中的一個字段,其中注冊與刪除事件的消息使用了同一個tmo字段。LwIP中的API相關的消息內容很多,不適合直接放在tcpip\_msg中,所以LwIP用一個api\_msg結構體來描述API消息,在 tcpip\_msg中只存放指向api\_msg結構體的指針,具體見代碼清單 9?9。 ``` 1 enum tcpip_msg_type 2 { 3 TCPIP_MSG_API, 4 TCPIP_MSG_API_CALL, //API函數調用 5 TCPIP_MSG_INPKT, //底層數據包輸入 6 TCPIP_MSG_TIMEOUT, //注冊超時事件 7 TCPIP_MSG_UNTIMEOUT, //刪除超時事件 8 TCPIP_MSG_CALLBACK, 9 TCPIP_MSG_CALLBACK_STATIC //執行回調函數 10 }; 11 12 struct tcpip_msg 13 { 14 enum tcpip_msg_type type; (1) 15 union 16 { 17 struct 18 { 19 tcpip_callback_fn function; 20 void* msg; 21 } api_msg; (2) 22 23 struct 24 { 25 tcpip_api_call_fn function; 26 struct tcpip_api_call_data *arg; 27 sys_sem_t *sem; 28 } api_call; (3) 29 30 struct 31 { 32 struct pbuf *p; 33 struct netif *netif; 34 netif_input_fn input_fn; 35 } inp; (4) 36 37 struct 38 { 39 tcpip_callback_fn function; 40 void *ctx; 41 } cb; (5) 42 43 struct 44 { 45 u32_t msecs; 46 sys_timeout_handler h; 47 void *arg; 48 } tmo; (6) 49 50 } msg; 51 }; ``` (1):消息的類型,目前有7種。 (2):API消息主要由兩部分組成,一部分是用于表示內核執行的API函數,另一部分是執行函數時候的參數,都會被記錄在api_msg中。 (3):與API消息差不多,也是由兩部分組成,一部分是tcpip_api_call_fn類型的函數,另一部分是其對應的形參,此外還有用于同步的信號量。 (4):inp用于記錄數據包消息的內容,p指向接收到的數據包;netif表示接收到數據包的網卡;input_fn表示輸入的函數接口,在tcpip_inpkt進行配置。 (5):cb用于記錄回調函數與其對應的形參。 (6):tmo用于記錄超時相關信息,如超時的時間,超時回調函數,參數等。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看