mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-29 10:17:30 +02:00
CI: fixing the files to be complient with pre-commit hooks
This commit is contained in:
@ -20,4 +20,3 @@ idf_component_register(SRCS esp_netif_linux.cpp tun_io.c ip4_stub.c ip6_stub.c $
|
||||
INCLUDE_DIRS include ${LWIP_INCLUDE_DIRS}
|
||||
PRIV_INCLUDE_DIRS .
|
||||
REQUIRES esp_system_protocols_linux)
|
||||
|
||||
|
@ -39,8 +39,8 @@ struct esp_netif_driver_ifconfig {
|
||||
};
|
||||
|
||||
struct esp_netif_config {
|
||||
const char * dev_name; /**< Name of the file device */
|
||||
const char * if_name; /**< Network interface name */
|
||||
const char *dev_name; /**< Name of the file device */
|
||||
const char *if_name; /**< Network interface name */
|
||||
};
|
||||
|
||||
struct esp_netif_obj {
|
||||
|
@ -158,7 +158,7 @@ typedef struct {
|
||||
*
|
||||
* @return IPv6 type in form of enum esp_ip6_addr_type_t
|
||||
*/
|
||||
esp_ip6_addr_type_t esp_netif_ip6_get_addr_type(esp_ip6_addr_t* ip6_addr);
|
||||
esp_ip6_addr_type_t esp_netif_ip6_get_addr_type(esp_ip6_addr_t *ip6_addr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -4,14 +4,20 @@ err_t
|
||||
ip4_output_if(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
|
||||
u8_t ttl, u8_t tos,
|
||||
u8_t proto, struct netif *netif)
|
||||
{ return ERR_OK; }
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
struct netif *
|
||||
ip4_route(const ip4_addr_t *dest)
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
err_t
|
||||
ip4_output_if_src(struct pbuf *p, const ip4_addr_t *src, const ip4_addr_t *dest,
|
||||
u8_t ttl, u8_t tos,
|
||||
u8_t proto, struct netif *netif)
|
||||
{ return ERR_OK; }
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -4,22 +4,32 @@ err_t
|
||||
ip6_output_if(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
u8_t hl, u8_t tc,
|
||||
u8_t nexth, struct netif *netif)
|
||||
{ return ERR_OK; }
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
struct netif *
|
||||
ip6_route(const ip6_addr_t *src, const ip6_addr_t *dest)
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
err_t
|
||||
ip6_output_if_src(struct pbuf *p, const ip6_addr_t *src, const ip6_addr_t *dest,
|
||||
u8_t hl, u8_t tc,
|
||||
u8_t nexth, struct netif *netif)
|
||||
{ return ERR_OK; }
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
const ip_addr_t *
|
||||
ip6_select_source_address(struct netif *netif, const ip6_addr_t *dest)
|
||||
{ return NULL; }
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
err_t
|
||||
ip6_options_add_hbh_ra(struct pbuf *p, u8_t nexth, u8_t value)
|
||||
{ return ERR_OK; }
|
||||
{
|
||||
return ERR_OK;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@
|
||||
#define PPP_DEBUG LWIP_DBG_ON
|
||||
#define LWIP_DEBUG LWIP_DBG_ON
|
||||
|
||||
#define PPP_IPV6_SUPPORT 0
|
||||
#define PPP_IPV6_SUPPORT 0
|
||||
|
||||
#define PPP_NOTIFY_PHASE 1
|
||||
|
||||
|
@ -23,93 +23,93 @@ static void ppp_link_status_cb(ppp_pcb *pcb, int err_code, void *ctx)
|
||||
struct netif *pppif = ppp_netif(pcb);
|
||||
LWIP_UNUSED_ARG(ctx);
|
||||
|
||||
switch(err_code) {
|
||||
case PPPERR_NONE: /* No error. */
|
||||
{
|
||||
switch (err_code) {
|
||||
case PPPERR_NONE: { /* No error. */
|
||||
#if LWIP_DNS
|
||||
const ip_addr_t *ns;
|
||||
const ip_addr_t *ns;
|
||||
#endif /* LWIP_DNS */
|
||||
fprintf(stderr, "ppp_link_status_cb: PPPERR_NONE\n\r");
|
||||
fprintf(stderr, "ppp_link_status_cb: PPPERR_NONE\n\r");
|
||||
#if LWIP_IPV4
|
||||
fprintf(stderr, " our_ip4addr = %s\n\r", ip4addr_ntoa(netif_ip4_addr(pppif)));
|
||||
fprintf(stderr, " his_ipaddr = %s\n\r", ip4addr_ntoa(netif_ip4_gw(pppif)));
|
||||
fprintf(stderr, " netmask = %s\n\r", ip4addr_ntoa(netif_ip4_netmask(pppif)));
|
||||
fprintf(stderr, " our_ip4addr = %s\n\r", ip4addr_ntoa(netif_ip4_addr(pppif)));
|
||||
fprintf(stderr, " his_ipaddr = %s\n\r", ip4addr_ntoa(netif_ip4_gw(pppif)));
|
||||
fprintf(stderr, " netmask = %s\n\r", ip4addr_ntoa(netif_ip4_netmask(pppif)));
|
||||
#endif /* LWIP_IPV4 */
|
||||
#if LWIP_IPV6
|
||||
fprintf(stderr, " our_ip6addr = %s\n\r", ip6addr_ntoa(netif_ip6_addr(pppif, 0)));
|
||||
fprintf(stderr, " our_ip6addr = %s\n\r", ip6addr_ntoa(netif_ip6_addr(pppif, 0)));
|
||||
#endif /* LWIP_IPV6 */
|
||||
|
||||
#if LWIP_DNS
|
||||
ns = dns_getserver(0);
|
||||
fprintf(stderr, " dns1 = %s\n\r", ipaddr_ntoa(ns));
|
||||
ns = dns_getserver(1);
|
||||
fprintf(stderr, " dns2 = %s\n\r", ipaddr_ntoa(ns));
|
||||
ns = dns_getserver(0);
|
||||
fprintf(stderr, " dns1 = %s\n\r", ipaddr_ntoa(ns));
|
||||
ns = dns_getserver(1);
|
||||
fprintf(stderr, " dns2 = %s\n\r", ipaddr_ntoa(ns));
|
||||
#endif /* LWIP_DNS */
|
||||
#if PPP_IPV6_SUPPORT
|
||||
fprintf(stderr, " our6_ipaddr = %s\n\r", ip6addr_ntoa(netif_ip6_addr(pppif, 0)));
|
||||
fprintf(stderr, " our6_ipaddr = %s\n\r", ip6addr_ntoa(netif_ip6_addr(pppif, 0)));
|
||||
#endif /* PPP_IPV6_SUPPORT */
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case PPPERR_PARAM: /* Invalid parameter. */
|
||||
printf("ppp_link_status_cb: PPPERR_PARAM\n");
|
||||
break;
|
||||
case PPPERR_PARAM: /* Invalid parameter. */
|
||||
printf("ppp_link_status_cb: PPPERR_PARAM\n");
|
||||
break;
|
||||
|
||||
case PPPERR_OPEN: /* Unable to open PPP session. */
|
||||
printf("ppp_link_status_cb: PPPERR_OPEN\n");
|
||||
break;
|
||||
case PPPERR_OPEN: /* Unable to open PPP session. */
|
||||
printf("ppp_link_status_cb: PPPERR_OPEN\n");
|
||||
break;
|
||||
|
||||
case PPPERR_DEVICE: /* Invalid I/O device for PPP. */
|
||||
printf("ppp_link_status_cb: PPPERR_DEVICE\n");
|
||||
break;
|
||||
case PPPERR_DEVICE: /* Invalid I/O device for PPP. */
|
||||
printf("ppp_link_status_cb: PPPERR_DEVICE\n");
|
||||
break;
|
||||
|
||||
case PPPERR_ALLOC: /* Unable to allocate resources. */
|
||||
printf("ppp_link_status_cb: PPPERR_ALLOC\n");
|
||||
break;
|
||||
case PPPERR_ALLOC: /* Unable to allocate resources. */
|
||||
printf("ppp_link_status_cb: PPPERR_ALLOC\n");
|
||||
break;
|
||||
|
||||
case PPPERR_USER: /* User interrupt. */
|
||||
printf("ppp_link_status_cb: PPPERR_USER\n");
|
||||
break;
|
||||
case PPPERR_USER: /* User interrupt. */
|
||||
printf("ppp_link_status_cb: PPPERR_USER\n");
|
||||
break;
|
||||
|
||||
case PPPERR_CONNECT: /* Connection lost. */
|
||||
printf("ppp_link_status_cb: PPPERR_CONNECT\n");
|
||||
break;
|
||||
case PPPERR_CONNECT: /* Connection lost. */
|
||||
printf("ppp_link_status_cb: PPPERR_CONNECT\n");
|
||||
break;
|
||||
|
||||
case PPPERR_AUTHFAIL: /* Failed authentication challenge. */
|
||||
printf("ppp_link_status_cb: PPPERR_AUTHFAIL\n");
|
||||
break;
|
||||
case PPPERR_AUTHFAIL: /* Failed authentication challenge. */
|
||||
printf("ppp_link_status_cb: PPPERR_AUTHFAIL\n");
|
||||
break;
|
||||
|
||||
case PPPERR_PROTOCOL: /* Failed to meet protocol. */
|
||||
printf("ppp_link_status_cb: PPPERR_PROTOCOL\n");
|
||||
break;
|
||||
case PPPERR_PROTOCOL: /* Failed to meet protocol. */
|
||||
printf("ppp_link_status_cb: PPPERR_PROTOCOL\n");
|
||||
break;
|
||||
|
||||
case PPPERR_PEERDEAD: /* Connection timeout. */
|
||||
printf("ppp_link_status_cb: PPPERR_PEERDEAD\n");
|
||||
break;
|
||||
case PPPERR_PEERDEAD: /* Connection timeout. */
|
||||
printf("ppp_link_status_cb: PPPERR_PEERDEAD\n");
|
||||
break;
|
||||
|
||||
case PPPERR_IDLETIMEOUT: /* Idle Timeout. */
|
||||
printf("ppp_link_status_cb: PPPERR_IDLETIMEOUT\n");
|
||||
break;
|
||||
case PPPERR_IDLETIMEOUT: /* Idle Timeout. */
|
||||
printf("ppp_link_status_cb: PPPERR_IDLETIMEOUT\n");
|
||||
break;
|
||||
|
||||
case PPPERR_CONNECTTIME: /* PPPERR_CONNECTTIME. */
|
||||
printf("ppp_link_status_cb: PPPERR_CONNECTTIME\n");
|
||||
break;
|
||||
case PPPERR_CONNECTTIME: /* PPPERR_CONNECTTIME. */
|
||||
printf("ppp_link_status_cb: PPPERR_CONNECTTIME\n");
|
||||
break;
|
||||
|
||||
case PPPERR_LOOPBACK: /* Connection timeout. */
|
||||
printf("ppp_link_status_cb: PPPERR_LOOPBACK\n");
|
||||
break;
|
||||
case PPPERR_LOOPBACK: /* Connection timeout. */
|
||||
printf("ppp_link_status_cb: PPPERR_LOOPBACK\n");
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("ppp_link_status_cb: unknown errCode %d\n", err_code);
|
||||
break;
|
||||
default:
|
||||
printf("ppp_link_status_cb: unknown errCode %d\n", err_code);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static u32_t ppp_output_cb(struct ppp_pcb_s *pcb, const void *data, u32_t len, void *ctx)
|
||||
{
|
||||
esp_netif_t *netif = (esp_netif_t *)ctx;
|
||||
if (netif->transmit)
|
||||
return netif->transmit(netif->ctx, (uint8_t*)data, len);
|
||||
if (netif->transmit) {
|
||||
return netif->transmit(netif->ctx, (uint8_t *)data, len);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ int ppp_netif_init(esp_netif_t *netif)
|
||||
sys_timeouts_init();
|
||||
|
||||
// init and start connection attempts on PPP interface
|
||||
ppp = pppos_create(&pppos_netif, ppp_output_cb, ppp_link_status_cb, (void*)netif);
|
||||
ppp = pppos_create(&pppos_netif, ppp_output_cb, ppp_link_status_cb, (void *)netif);
|
||||
if (ppp == NULL) {
|
||||
return 0;
|
||||
}
|
||||
@ -175,7 +175,7 @@ int tun_read(void)
|
||||
FD_SET(esp_netif->fd, &fds);
|
||||
struct timeval tv = { .tv_usec = 0, .tv_sec = 1 };
|
||||
|
||||
if (select(esp_netif->fd +1, &fds, NULL, NULL, &tv) <= 0) {
|
||||
if (select(esp_netif->fd + 1, &fds, NULL, NULL, &tv) <= 0) {
|
||||
sys_check_timeouts();
|
||||
return 0;
|
||||
}
|
||||
@ -206,4 +206,4 @@ int tun_read(void)
|
||||
}
|
||||
pbuf_free(p);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user