• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef _ESP_NETIF_LWIP_PPP_H_
16 #define _ESP_NETIF_LWIP_PPP_H_
17 
18 #if CONFIG_ESP_NETIF_TCPIP_LWIP
19 
20 /**
21  * @brief  Creates new PPP related structure
22  *
23  * @param[in]     esp_netif pointer esp-netif instance
24  * @param[in]     stack_config TCP/IP stack configuration structure
25  *
26  * @return
27  *         - pointer to ppp-netif object on success
28  *         - NULL otherwise
29  */
30 netif_related_data_t * esp_netif_new_ppp(esp_netif_t *esp_netif, const esp_netif_netstack_config_t *esp_netif_stack_config);
31 
32 /**
33  * @brief  Creates new PPP related structure
34  *
35  * @param[in]    netif_related pointer to internal ppp context instance
36  *
37  * @return
38  *         - ESP_OK on success
39  */
40 esp_err_t esp_netif_start_ppp(netif_related_data_t *netif_related);
41 
42 /**
43  * @brief  Data path API to input incoming packets to PPP
44  *
45  * @param[in]    ppp pointer to internal ppp context instance
46  * @param[in]    buffer pointer to the incoming data
47  * @param[in]    len length of the data
48  * @param[in]    eb external buffer ptr not used here (to be inline with input function prototypes)
49  *
50  * @return
51  *         - ESP_OK on success
52  */
53 void esp_netif_lwip_ppp_input(void *ppp, void *buffer, size_t len, void *eb);
54 
55 /**
56  * @brief   Destroys the ppp netif object
57  *
58  * @param[in]    netif_related pointer to internal ppp context instance
59  */
60 void esp_netif_destroy_ppp(netif_related_data_t *netif_related);
61 
62 /**
63  * @brief  Stops the PPP interface
64  *
65  * @param[in]    netif_related pointer to internal ppp context instance
66  *
67  * @return
68  *         - ESP_OK on success
69  */
70 esp_err_t esp_netif_stop_ppp(netif_related_data_t *netif_related);
71 
72 /**
73  * @brief  Sets default netif for routing priority config
74  *
75  * @note: This function must be called from lwip thread
76  *
77  */
78 void esp_netif_ppp_set_default_netif(netif_related_data_t *netif_related);
79 
80 #endif /* CONFIG_ESP_NETIF_TCPIP_LWIP */
81 
82 
83 #endif // _ESP_NETIF_LWIP_PPP_H_
84