1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-08-24 14:48:14 +03:00

Migrate from astyle to clang-format (#8464)

This commit is contained in:
Maxim Prokhorov
2022-02-20 19:23:33 +03:00
committed by Max Prokhorov
parent 46190b61f1
commit 19b7a29720
241 changed files with 15925 additions and 16197 deletions

View File

@@ -2,8 +2,8 @@
// This is still beta / a work in progress
// testing on linux:
// sudo /usr/sbin/pppd /dev/ttyUSB1 38400 noipdefault nocrtscts local defaultroute noauth nodetach debug dump
// sudo /usr/sbin/pppd /dev/ttyUSB1 38400 noipdefault nocrtscts local defaultroute noauth
// sudo /usr/sbin/pppd /dev/ttyUSB1 38400 noipdefault nocrtscts local defaultroute noauth nodetach
// debug dump sudo /usr/sbin/pppd /dev/ttyUSB1 38400 noipdefault nocrtscts local defaultroute noauth
// proxy arp is needed but we don't have it
// http://lwip.100.n7.nabble.com/PPP-proxy-arp-support-tp33286p33345.html
@@ -16,9 +16,7 @@
#include "PPPServer.h"
PPPServer::PPPServer(Stream* sio): _sio(sio), _cb(netif_status_cb_s), _enabled(false)
{
}
PPPServer::PPPServer(Stream* sio) : _sio(sio), _cb(netif_status_cb_s), _enabled(false) { }
bool PPPServer::handlePackets()
{
@@ -38,15 +36,15 @@ bool PPPServer::handlePackets()
void PPPServer::link_status_cb_s(ppp_pcb* pcb, int err_code, void* ctx)
{
bool stop = true;
netif* nif = ppp_netif(pcb);
bool stop = true;
netif* nif = ppp_netif(pcb);
switch (err_code)
{
case PPPERR_NONE: /* No error. */
case PPPERR_NONE: /* No error. */
{
#if LWIP_DNS
const ip_addr_t *ns;
const ip_addr_t* ns;
#endif /* LWIP_DNS */
ets_printf("ppp_link_status_cb: PPPERR_NONE\n\r");
#if LWIP_IPV4
@@ -68,54 +66,54 @@ void PPPServer::link_status_cb_s(ppp_pcb* pcb, int err_code, void* ctx)
ets_printf(" our6_ipaddr = %s\n\r", ip6addr_ntoa(netif_ip6_addr(nif, 0)));
#endif /* PPP_IPV6_SUPPORT */
}
stop = false;
break;
stop = false;
break;
case PPPERR_PARAM: /* Invalid parameter. */
case PPPERR_PARAM: /* Invalid parameter. */
ets_printf("ppp_link_status_cb: PPPERR_PARAM\n");
break;
case PPPERR_OPEN: /* Unable to open PPP session. */
case PPPERR_OPEN: /* Unable to open PPP session. */
ets_printf("ppp_link_status_cb: PPPERR_OPEN\n");
break;
case PPPERR_DEVICE: /* Invalid I/O device for PPP. */
case PPPERR_DEVICE: /* Invalid I/O device for PPP. */
ets_printf("ppp_link_status_cb: PPPERR_DEVICE\n");
break;
case PPPERR_ALLOC: /* Unable to allocate resources. */
case PPPERR_ALLOC: /* Unable to allocate resources. */
ets_printf("ppp_link_status_cb: PPPERR_ALLOC\n");
break;
case PPPERR_USER: /* User interrupt. */
case PPPERR_USER: /* User interrupt. */
ets_printf("ppp_link_status_cb: PPPERR_USER\n");
break;
case PPPERR_CONNECT: /* Connection lost. */
case PPPERR_CONNECT: /* Connection lost. */
ets_printf("ppp_link_status_cb: PPPERR_CONNECT\n");
break;
case PPPERR_AUTHFAIL: /* Failed authentication challenge. */
case PPPERR_AUTHFAIL: /* Failed authentication challenge. */
ets_printf("ppp_link_status_cb: PPPERR_AUTHFAIL\n");
break;
case PPPERR_PROTOCOL: /* Failed to meet protocol. */
case PPPERR_PROTOCOL: /* Failed to meet protocol. */
ets_printf("ppp_link_status_cb: PPPERR_PROTOCOL\n");
break;
case PPPERR_PEERDEAD: /* Connection timeout. */
case PPPERR_PEERDEAD: /* Connection timeout. */
ets_printf("ppp_link_status_cb: PPPERR_PEERDEAD\n");
break;
case PPPERR_IDLETIMEOUT: /* Idle Timeout. */
case PPPERR_IDLETIMEOUT: /* Idle Timeout. */
ets_printf("ppp_link_status_cb: PPPERR_IDLETIMEOUT\n");
break;
case PPPERR_CONNECTTIME: /* PPPERR_CONNECTTIME. */
case PPPERR_CONNECTTIME: /* PPPERR_CONNECTTIME. */
ets_printf("ppp_link_status_cb: PPPERR_CONNECTTIME\n");
break;
case PPPERR_LOOPBACK: /* Connection timeout. */
case PPPERR_LOOPBACK: /* Connection timeout. */
ets_printf("ppp_link_status_cb: PPPERR_LOOPBACK\n");
break;
@@ -165,22 +163,24 @@ bool PPPServer::begin(const IPAddress& ourAddress, const IPAddress& peer)
ppp_set_ipcp_ouraddr(_ppp, ip_2_ip4((const ip_addr_t*)ourAddress));
ppp_set_ipcp_hisaddr(_ppp, ip_2_ip4((const ip_addr_t*)peer));
//ip4_addr_t addr;
//IP4_ADDR(&addr, 10,0,1,254);
//ppp_set_ipcp_dnsaddr(_ppp, 0, &addr);
// ip4_addr_t addr;
// IP4_ADDR(&addr, 10,0,1,254);
// ppp_set_ipcp_dnsaddr(_ppp, 0, &addr);
//ppp_set_auth(_ppp, PPPAUTHTYPE_ANY, "login", "password");
//ppp_set_auth_required(_ppp, 1);
// ppp_set_auth(_ppp, PPPAUTHTYPE_ANY, "login", "password");
// ppp_set_auth_required(_ppp, 1);
ppp_set_silent(_ppp, 1);
ppp_listen(_ppp);
netif_set_status_callback(&_netif, _cb);
_enabled = true;
if (!schedule_recurrent_function_us([&]()
{
return this->handlePackets();
}, 1000))
if (!schedule_recurrent_function_us(
[&]()
{
return this->handlePackets();
},
1000))
{
netif_remove(&_netif);
return false;