Skip to content

Commit 1db40ed

Browse files
committed
esp32/ppp_set_auth: Add pppapi_set_auth from ESP-IDF.
This function was made private/static in IDF commit c67f4c2, so it add back here. Signed-off-by: Damien George <[email protected]>
1 parent 7c929d4 commit 1db40ed

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

LICENSE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ used during the build process and is not part of the compiled source code.
6767
/hal (BSD-3-clause)
6868
/simplelink (BSD-3-clause)
6969
/FreeRTOS (GPL-2.0 with FreeRTOS exception)
70+
/esp32
71+
/ppp_set_auth.* (Apache-2.0)
7072
/stm32
7173
/usbd*.c (MCD-ST Liberty SW License Agreement V2)
7274
/stm32_it.* (MIT + BSD-3-clause)

ports/esp32/main/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ set(MICROPY_SOURCE_DRIVERS
5353

5454
set(MICROPY_SOURCE_PORT
5555
main.c
56+
ppp_set_auth.c
5657
uart.c
5758
usb.c
5859
usb_serial_jtag.c

ports/esp32/ppp_set_auth.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
// The pppapi_set_auth function was made static in the ESP-IDF, so it's re-added here.
8+
// See ESP-IDF commit c67f4c2b4c2bb4b7740f988fc0f8a3e911e56afe
9+
10+
#include "ppp_set_auth.h"
11+
12+
#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP
13+
14+
#include "netif/ppp/pppapi.h"
15+
16+
typedef struct {
17+
struct tcpip_api_call_data call;
18+
ppp_pcb *ppp;
19+
u8_t authtype;
20+
const char *user;
21+
const char *passwd;
22+
} set_auth_msg_t;
23+
24+
static err_t pppapi_do_ppp_set_auth(struct tcpip_api_call_data *m) {
25+
set_auth_msg_t *msg = (set_auth_msg_t *)m;
26+
ppp_set_auth(msg->ppp, msg->authtype, msg->user, msg->passwd);
27+
return ERR_OK;
28+
}
29+
30+
void pppapi_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd) {
31+
set_auth_msg_t msg = { .ppp = pcb, .authtype = authtype, .user = user, .passwd = passwd};
32+
tcpip_api_call(pppapi_do_ppp_set_auth, &msg.call);
33+
}
34+
35+
#endif

ports/esp32/ppp_set_auth.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
// The pppapi_set_auth function was made static in the ESP-IDF, so it's re-added here.
8+
// See ESP-IDF commit c67f4c2b4c2bb4b7740f988fc0f8a3e911e56afe
9+
10+
#pragma once
11+
12+
#include "esp_netif.h"
13+
14+
#ifdef CONFIG_ESP_NETIF_TCPIP_LWIP
15+
16+
#include "lwip/netif.h"
17+
18+
typedef struct ppp_pcb_s ppp_pcb;
19+
20+
void pppapi_set_auth(ppp_pcb *pcb, u8_t authtype, const char *user, const char *passwd);
21+
22+
#endif

0 commit comments

Comments
 (0)