mirror of https://github.com/ARMmbed/mbed-os.git
lwipstack: fix astyle coding style
parent
e54ce88bca
commit
41c1901318
|
@ -186,7 +186,7 @@ void LWIP::Interface::netif_link_irq(struct netif *netif)
|
|||
|
||||
if (interface->client_callback && connectedStatusPrev != interface->connected
|
||||
&& interface->connected != NSAPI_STATUS_GLOBAL_UP /* advertised by netif_status_irq */
|
||||
&& interface->connected != NSAPI_STATUS_DISCONNECTED) /* advertised by bring_down */ {
|
||||
&& interface->connected != NSAPI_STATUS_DISCONNECTED) { /* advertised by bring_down */
|
||||
interface->client_callback(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, interface->connected);
|
||||
}
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ void LWIP::Interface::netif_status_irq(struct netif *netif)
|
|||
}
|
||||
|
||||
if (interface->client_callback && (connectedStatusPrev != interface->connected)
|
||||
&& interface->connected != NSAPI_STATUS_DISCONNECTED) /* advertised by bring_down */ {
|
||||
&& interface->connected != NSAPI_STATUS_DISCONNECTED) { /* advertised by bring_down */
|
||||
interface->client_callback(NSAPI_EVENT_CONNECTION_STATUS_CHANGE, interface->connected);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,8 +74,7 @@ err_t LWIP::Interface::emac_igmp_mac_filter(struct netif *netif, const ip4_addr_
|
|||
LWIP::Interface *mbed_if = static_cast<LWIP::Interface *>(netif->state);
|
||||
|
||||
switch (action) {
|
||||
case NETIF_ADD_MAC_FILTER:
|
||||
{
|
||||
case NETIF_ADD_MAC_FILTER: {
|
||||
uint32_t group23 = ntohl(group->addr) & 0x007FFFFF;
|
||||
uint8_t addr[6];
|
||||
addr[0] = LL_IP4_MULTICAST_ADDR_0;
|
||||
|
@ -112,8 +111,7 @@ err_t LWIP::Interface::emac_mld_mac_filter(struct netif *netif, const ip6_addr_t
|
|||
LWIP::Interface *mbed_if = static_cast<LWIP::Interface *>(netif->state);
|
||||
|
||||
switch (action) {
|
||||
case NETIF_ADD_MAC_FILTER:
|
||||
{
|
||||
case NETIF_ADD_MAC_FILTER: {
|
||||
uint32_t group32 = ntohl(group->addr[3]);
|
||||
uint8_t addr[6];
|
||||
addr[0] = LL_IP6_MULTICAST_ADDR_0;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "LWIPStack.h"
|
||||
|
||||
#ifndef LWIP_SOCKET_MAX_MEMBERSHIPS
|
||||
#define LWIP_SOCKET_MAX_MEMBERSHIPS 4
|
||||
#define LWIP_SOCKET_MAX_MEMBERSHIPS 4
|
||||
#endif
|
||||
|
||||
void LWIP::socket_callback(struct netconn *nc, enum netconn_evt eh, u16_t len)
|
||||
|
@ -273,7 +273,7 @@ nsapi_error_t LWIP::socket_open(nsapi_socket_t *handle, nsapi_protocol_t proto)
|
|||
|
||||
#if LWIP_IPV6
|
||||
// Enable IPv6 (or dual-stack)
|
||||
lwip_proto = (enum netconn_type) (lwip_proto | NETCONN_TYPE_IPV6);
|
||||
lwip_proto = (enum netconn_type)(lwip_proto | NETCONN_TYPE_IPV6);
|
||||
#endif
|
||||
|
||||
s->conn = netconn_new_with_callback(lwip_proto, &LWIP::socket_callback);
|
||||
|
@ -485,7 +485,8 @@ nsapi_size_or_error_t LWIP::socket_recvfrom(nsapi_socket_t handle, SocketAddress
|
|||
return recv;
|
||||
}
|
||||
|
||||
int32_t LWIP::find_multicast_member(const struct mbed_lwip_socket *s, const nsapi_ip_mreq_t *imr) {
|
||||
int32_t LWIP::find_multicast_member(const struct mbed_lwip_socket *s, const nsapi_ip_mreq_t *imr)
|
||||
{
|
||||
uint32_t count = 0;
|
||||
uint32_t index = 0;
|
||||
// Set upper limit on while loop, should break out when the membership pair is found
|
||||
|
@ -522,7 +523,7 @@ nsapi_error_t LWIP::setsockopt(nsapi_socket_t handle, int level, int optname, co
|
|||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
s->conn->pcb.tcp->keep_idle = *(int*)optval;
|
||||
s->conn->pcb.tcp->keep_idle = *(int *)optval;
|
||||
return 0;
|
||||
|
||||
case NSAPI_KEEPINTVL:
|
||||
|
@ -530,7 +531,7 @@ nsapi_error_t LWIP::setsockopt(nsapi_socket_t handle, int level, int optname, co
|
|||
return NSAPI_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
s->conn->pcb.tcp->keep_intvl = *(int*)optval;
|
||||
s->conn->pcb.tcp->keep_intvl = *(int *)optval;
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
|
@ -582,11 +583,11 @@ nsapi_error_t LWIP::setsockopt(nsapi_socket_t handle, int level, int optname, co
|
|||
if (optname == NSAPI_ADD_MEMBERSHIP) {
|
||||
if (!s->multicast_memberships) {
|
||||
// First multicast join on this socket, allocate space for membership tracking
|
||||
s->multicast_memberships = (nsapi_ip_mreq_t*)malloc(sizeof(nsapi_ip_mreq_t) * LWIP_SOCKET_MAX_MEMBERSHIPS);
|
||||
s->multicast_memberships = (nsapi_ip_mreq_t *)malloc(sizeof(nsapi_ip_mreq_t) * LWIP_SOCKET_MAX_MEMBERSHIPS);
|
||||
if (!s->multicast_memberships) {
|
||||
return NSAPI_ERROR_NO_MEMORY;
|
||||
}
|
||||
} else if(s->multicast_memberships_count == LWIP_SOCKET_MAX_MEMBERSHIPS) {
|
||||
} else if (s->multicast_memberships_count == LWIP_SOCKET_MAX_MEMBERSHIPS) {
|
||||
return NSAPI_ERROR_NO_MEMORY;
|
||||
}
|
||||
|
||||
|
@ -598,16 +599,16 @@ nsapi_error_t LWIP::setsockopt(nsapi_socket_t handle, int level, int optname, co
|
|||
|
||||
adaptation.lock();
|
||||
|
||||
#if LWIP_IPV4
|
||||
#if LWIP_IPV4
|
||||
if (IP_IS_V4(&if_addr)) {
|
||||
igmp_err = igmp_joingroup(ip_2_ip4(&if_addr), ip_2_ip4(&multi_addr));
|
||||
}
|
||||
#endif
|
||||
#if LWIP_IPV6
|
||||
#endif
|
||||
#if LWIP_IPV6
|
||||
if (IP_IS_V6(&if_addr)) {
|
||||
igmp_err = mld6_joingroup(ip_2_ip6(&if_addr), ip_2_ip6(&multi_addr));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
adaptation.unlock();
|
||||
|
||||
|
@ -626,16 +627,16 @@ nsapi_error_t LWIP::setsockopt(nsapi_socket_t handle, int level, int optname, co
|
|||
|
||||
adaptation.lock();
|
||||
|
||||
#if LWIP_IPV4
|
||||
#if LWIP_IPV4
|
||||
if (IP_IS_V4(&if_addr)) {
|
||||
igmp_err = igmp_leavegroup(ip_2_ip4(&if_addr), ip_2_ip4(&multi_addr));
|
||||
}
|
||||
#endif
|
||||
#if LWIP_IPV6
|
||||
#endif
|
||||
#if LWIP_IPV6
|
||||
if (IP_IS_V6(&if_addr)) {
|
||||
igmp_err = mld6_leavegroup(ip_2_ip6(&if_addr), ip_2_ip6(&multi_addr));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
adaptation.unlock();
|
||||
}
|
||||
|
@ -662,7 +663,8 @@ void LWIP::socket_attach(nsapi_socket_t handle, void (*callback)(void *), void *
|
|||
s->data = data;
|
||||
}
|
||||
|
||||
LWIP &LWIP::get_instance() {
|
||||
LWIP &LWIP::get_instance()
|
||||
{
|
||||
static LWIP lwip;
|
||||
return lwip;
|
||||
}
|
||||
|
@ -672,7 +674,8 @@ LWIP &LWIP::get_instance() {
|
|||
#define LWIP 0x11991199
|
||||
#if MBED_CONF_NSAPI_DEFAULT_STACK == LWIP
|
||||
#undef LWIP
|
||||
OnboardNetworkStack &OnboardNetworkStack::get_default_instance() {
|
||||
OnboardNetworkStack &OnboardNetworkStack::get_default_instance()
|
||||
{
|
||||
return LWIP::get_instance();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -120,24 +120,24 @@ public:
|
|||
static void netif_status_irq(struct netif *netif);
|
||||
static Interface *our_if_from_netif(struct netif *netif);
|
||||
|
||||
#if LWIP_ETHERNET
|
||||
#if LWIP_ETHERNET
|
||||
static err_t emac_low_level_output(struct netif *netif, struct pbuf *p);
|
||||
void emac_input(emac_mem_buf_t *buf);
|
||||
void emac_state_change(bool up);
|
||||
#if LWIP_IGMP
|
||||
#if LWIP_IGMP
|
||||
static err_t emac_igmp_mac_filter(struct netif *netif, const ip4_addr_t *group, enum netif_mac_filter_action action);
|
||||
#endif
|
||||
#if LWIP_IPV6_MLD
|
||||
#endif
|
||||
#if LWIP_IPV6_MLD
|
||||
static err_t emac_mld_mac_filter(struct netif *netif, const ip6_addr_t *group, enum netif_mac_filter_action action);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static err_t emac_if_init(struct netif *netif);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
union {
|
||||
#if LWIP_ETHERNET
|
||||
#if LWIP_ETHERNET
|
||||
EMAC *emac; /**< HW specific emac implementation */
|
||||
#endif
|
||||
#endif
|
||||
void *hw; /**< alternative implementation pointer - used for PPP */
|
||||
};
|
||||
|
||||
|
@ -147,17 +147,17 @@ public:
|
|||
osSemaphoreId_t unlinked;
|
||||
mbed_rtos_storage_semaphore_t has_any_addr_sem;
|
||||
osSemaphoreId_t has_any_addr;
|
||||
#define HAS_ANY_ADDR 1
|
||||
#if PREF_ADDR_TIMEOUT
|
||||
#define HAS_ANY_ADDR 1
|
||||
#if PREF_ADDR_TIMEOUT
|
||||
mbed_rtos_storage_semaphore_t has_pref_addr_sem;
|
||||
osSemaphoreId_t has_pref_addr;
|
||||
#define HAS_PREF_ADDR 2
|
||||
#endif
|
||||
#if BOTH_ADDR_TIMEOUT
|
||||
#define HAS_PREF_ADDR 2
|
||||
#endif
|
||||
#if BOTH_ADDR_TIMEOUT
|
||||
mbed_rtos_storage_semaphore_t has_both_addr_sem;
|
||||
osSemaphoreId_t has_both_addr;
|
||||
#define HAS_BOTH_ADDR 4
|
||||
#endif
|
||||
#define HAS_BOTH_ADDR 4
|
||||
#endif
|
||||
char has_addr_state;
|
||||
nsapi_connection_status_t connected;
|
||||
bool dhcp_started;
|
||||
|
@ -301,7 +301,7 @@ protected:
|
|||
* @return 0 on success, negative error code on failure
|
||||
*/
|
||||
virtual nsapi_error_t socket_accept(nsapi_socket_t server,
|
||||
nsapi_socket_t *handle, SocketAddress *address=0);
|
||||
nsapi_socket_t *handle, SocketAddress *address = 0);
|
||||
|
||||
/** Send data over a TCP socket
|
||||
*
|
||||
|
@ -487,21 +487,29 @@ private:
|
|||
struct mbed_lwip_socket *arena_alloc();
|
||||
void arena_dealloc(struct mbed_lwip_socket *s);
|
||||
|
||||
static uint32_t next_registered_multicast_member(const struct mbed_lwip_socket *s, uint32_t index) {
|
||||
while (!(s->multicast_memberships_registry & (0x0001 << index))) { index++; }
|
||||
static uint32_t next_registered_multicast_member(const struct mbed_lwip_socket *s, uint32_t index)
|
||||
{
|
||||
while (!(s->multicast_memberships_registry & (0x0001 << index))) {
|
||||
index++;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
static uint32_t next_free_multicast_member(const struct mbed_lwip_socket *s, uint32_t index) {
|
||||
while ((s->multicast_memberships_registry & (0x0001 << index))) { index++; }
|
||||
static uint32_t next_free_multicast_member(const struct mbed_lwip_socket *s, uint32_t index)
|
||||
{
|
||||
while ((s->multicast_memberships_registry & (0x0001 << index))) {
|
||||
index++;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
static void set_multicast_member_registry_bit(struct mbed_lwip_socket *s, uint32_t index) {
|
||||
static void set_multicast_member_registry_bit(struct mbed_lwip_socket *s, uint32_t index)
|
||||
{
|
||||
s->multicast_memberships_registry |= (0x0001 << index);
|
||||
}
|
||||
|
||||
static void clear_multicast_member_registry_bit(struct mbed_lwip_socket *s, uint32_t index) {
|
||||
static void clear_multicast_member_registry_bit(struct mbed_lwip_socket *s, uint32_t index)
|
||||
{
|
||||
s->multicast_memberships_registry &= ~(0x0001 << index);
|
||||
}
|
||||
static int32_t find_multicast_member(const struct mbed_lwip_socket *s, const nsapi_ip_mreq_t *imr);
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
#include "netsocket/nsapi_types.h"
|
||||
|
||||
/* LWIP error remapping */
|
||||
nsapi_error_t LWIP::err_remap(err_t err) {
|
||||
nsapi_error_t LWIP::err_remap(err_t err)
|
||||
{
|
||||
switch (err) {
|
||||
case ERR_OK:
|
||||
case ERR_CLSD:
|
||||
|
|
|
@ -120,7 +120,7 @@ static void ppp_link_status(ppp_pcb *pcb, int err_code, void *ctx)
|
|||
{
|
||||
nsapi_error_t mapped_err_code = NSAPI_ERROR_NO_CONNECTION;
|
||||
|
||||
switch(err_code) {
|
||||
switch (err_code) {
|
||||
case PPPERR_NONE:
|
||||
mapped_err_code = NSAPI_ERROR_OK;
|
||||
tr_info("status_cb: Connected");
|
||||
|
@ -247,7 +247,7 @@ static void ppp_input()
|
|||
fhs.fh = my_stream;
|
||||
fhs.events = POLLIN;
|
||||
poll(&fhs, 1, 0);
|
||||
if (fhs.revents & (POLLHUP|POLLERR|POLLNVAL)) {
|
||||
if (fhs.revents & (POLLHUP | POLLERR | POLLNVAL)) {
|
||||
handle_modem_hangup();
|
||||
return;
|
||||
}
|
||||
|
@ -268,7 +268,8 @@ static void ppp_input()
|
|||
return;
|
||||
}
|
||||
|
||||
static void stream_cb() {
|
||||
static void stream_cb()
|
||||
{
|
||||
if (my_stream && !event_queued) {
|
||||
event_queued = true;
|
||||
if (event_queue->call(callback(ppp_input)) == 0) {
|
||||
|
|
Loading…
Reference in New Issue