mirror of https://github.com/ARMmbed/mbed-os.git
C++11-ify virtualisation in lwIP classes
Use `override` and `final` where appropriate, and eliminate unnecessary `virtual`. Some other C++11 simplifications.pull/12489/head
parent
b4c1f7f3da
commit
aa9058a293
|
@ -19,7 +19,7 @@
|
||||||
#include "EMACMemoryManager.h"
|
#include "EMACMemoryManager.h"
|
||||||
|
|
||||||
|
|
||||||
class LWIPMemoryManager : public EMACMemoryManager {
|
class LWIPMemoryManager final : public EMACMemoryManager {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +31,7 @@ public:
|
||||||
* @param align Memory alignment requirement in bytes
|
* @param align Memory alignment requirement in bytes
|
||||||
* @return Allocated memory buffer, or NULL in case of error
|
* @return Allocated memory buffer, or NULL in case of error
|
||||||
*/
|
*/
|
||||||
virtual net_stack_mem_buf_t *alloc_heap(uint32_t size, uint32_t align);
|
net_stack_mem_buf_t *alloc_heap(uint32_t size, uint32_t align) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocates memory buffer chain from a pool
|
* Allocates memory buffer chain from a pool
|
||||||
|
@ -44,7 +44,7 @@ public:
|
||||||
* @param align Memory alignment requirement for each buffer in bytes
|
* @param align Memory alignment requirement for each buffer in bytes
|
||||||
* @return Allocated memory buffer chain, or NULL in case of error
|
* @return Allocated memory buffer chain, or NULL in case of error
|
||||||
*/
|
*/
|
||||||
virtual net_stack_mem_buf_t *alloc_pool(uint32_t size, uint32_t align);
|
net_stack_mem_buf_t *alloc_pool(uint32_t size, uint32_t align) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get memory buffer pool allocation unit
|
* Get memory buffer pool allocation unit
|
||||||
|
@ -54,7 +54,7 @@ public:
|
||||||
* @param align Memory alignment requirement in bytes
|
* @param align Memory alignment requirement in bytes
|
||||||
* @return Contiguous memory size
|
* @return Contiguous memory size
|
||||||
*/
|
*/
|
||||||
virtual uint32_t get_pool_alloc_unit(uint32_t align) const;
|
uint32_t get_pool_alloc_unit(uint32_t align) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free memory buffer chain
|
* Free memory buffer chain
|
||||||
|
@ -64,7 +64,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param buf Memory buffer chain to be freed.
|
* @param buf Memory buffer chain to be freed.
|
||||||
*/
|
*/
|
||||||
virtual void free(net_stack_mem_buf_t *buf);
|
void free(net_stack_mem_buf_t *buf) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return total length of a memory buffer chain
|
* Return total length of a memory buffer chain
|
||||||
|
@ -74,7 +74,7 @@ public:
|
||||||
* @param buf Memory buffer chain
|
* @param buf Memory buffer chain
|
||||||
* @return Total length in bytes
|
* @return Total length in bytes
|
||||||
*/
|
*/
|
||||||
virtual uint32_t get_total_len(const net_stack_mem_buf_t *buf) const;
|
uint32_t get_total_len(const net_stack_mem_buf_t *buf) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy a memory buffer chain
|
* Copy a memory buffer chain
|
||||||
|
@ -85,7 +85,7 @@ public:
|
||||||
* @param to_buf Memory buffer chain to copy to
|
* @param to_buf Memory buffer chain to copy to
|
||||||
* @param from_buf Memory buffer chain to copy from
|
* @param from_buf Memory buffer chain to copy from
|
||||||
*/
|
*/
|
||||||
virtual void copy(net_stack_mem_buf_t *to_buf, const net_stack_mem_buf_t *from_buf);
|
void copy(net_stack_mem_buf_t *to_buf, const net_stack_mem_buf_t *from_buf) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy to a memory buffer chain
|
* Copy to a memory buffer chain
|
||||||
|
@ -98,7 +98,7 @@ public:
|
||||||
* @param ptr Pointer to data
|
* @param ptr Pointer to data
|
||||||
* @param len Data length
|
* @param len Data length
|
||||||
*/
|
*/
|
||||||
virtual void copy_to_buf(net_stack_mem_buf_t *to_buf, const void *ptr, uint32_t len);
|
void copy_to_buf(net_stack_mem_buf_t *to_buf, const void *ptr, uint32_t len) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy from a memory buffer chain
|
* Copy from a memory buffer chain
|
||||||
|
@ -110,7 +110,7 @@ public:
|
||||||
* @param from_buf Memory buffer chain to copy from
|
* @param from_buf Memory buffer chain to copy from
|
||||||
* @return Length of the data that was copied
|
* @return Length of the data that was copied
|
||||||
*/
|
*/
|
||||||
virtual uint32_t copy_from_buf(void *ptr, uint32_t len, const net_stack_mem_buf_t *from_buf) const;
|
uint32_t copy_from_buf(void *ptr, uint32_t len, const net_stack_mem_buf_t *from_buf) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Concatenate two memory buffer chains
|
* Concatenate two memory buffer chains
|
||||||
|
@ -122,7 +122,7 @@ public:
|
||||||
* @param to_buf Memory buffer chain to concatenate to
|
* @param to_buf Memory buffer chain to concatenate to
|
||||||
* @param cat_buf Memory buffer chain to concatenate
|
* @param cat_buf Memory buffer chain to concatenate
|
||||||
*/
|
*/
|
||||||
virtual void cat(net_stack_mem_buf_t *to_buf, net_stack_mem_buf_t *cat_buf);
|
void cat(net_stack_mem_buf_t *to_buf, net_stack_mem_buf_t *cat_buf) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the next buffer
|
* Returns the next buffer
|
||||||
|
@ -132,7 +132,7 @@ public:
|
||||||
* @param buf Memory buffer
|
* @param buf Memory buffer
|
||||||
* @return The next memory buffer, or NULL if last
|
* @return The next memory buffer, or NULL if last
|
||||||
*/
|
*/
|
||||||
virtual net_stack_mem_buf_t *get_next(const net_stack_mem_buf_t *buf) const;
|
net_stack_mem_buf_t *get_next(const net_stack_mem_buf_t *buf) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return pointer to the payload of the buffer
|
* Return pointer to the payload of the buffer
|
||||||
|
@ -140,7 +140,7 @@ public:
|
||||||
* @param buf Memory buffer
|
* @param buf Memory buffer
|
||||||
* @return Pointer to the payload
|
* @return Pointer to the payload
|
||||||
*/
|
*/
|
||||||
virtual void *get_ptr(const net_stack_mem_buf_t *buf) const;
|
void *get_ptr(const net_stack_mem_buf_t *buf) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return payload size of the buffer
|
* Return payload size of the buffer
|
||||||
|
@ -148,7 +148,7 @@ public:
|
||||||
* @param buf Memory buffer
|
* @param buf Memory buffer
|
||||||
* @return Size in bytes
|
* @return Size in bytes
|
||||||
*/
|
*/
|
||||||
virtual uint32_t get_len(const net_stack_mem_buf_t *buf) const;
|
uint32_t get_len(const net_stack_mem_buf_t *buf) const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the payload size of the buffer
|
* Sets the payload size of the buffer
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
* @param buf Memory buffer
|
* @param buf Memory buffer
|
||||||
* @param len Payload size, must be less or equal allocated size
|
* @param len Payload size, must be less or equal allocated size
|
||||||
*/
|
*/
|
||||||
virtual void set_len(net_stack_mem_buf_t *buf, uint32_t len);
|
void set_len(net_stack_mem_buf_t *buf, uint32_t len) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
using NetworkStack::get_ip_address;
|
using NetworkStack::get_ip_address;
|
||||||
static LWIP &get_instance();
|
static LWIP &get_instance();
|
||||||
|
|
||||||
class Interface : public OnboardNetworkStack::Interface {
|
class Interface final : public OnboardNetworkStack::Interface {
|
||||||
public:
|
public:
|
||||||
/** Connect the interface to the network
|
/** Connect the interface to the network
|
||||||
*
|
*
|
||||||
|
@ -51,11 +51,11 @@ public:
|
||||||
* @param blocking Specify whether bringup blocks for connection completion.
|
* @param blocking Specify whether bringup blocks for connection completion.
|
||||||
* @return NSAPI_ERROR_OK on success, or error code
|
* @return NSAPI_ERROR_OK on success, or error code
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t bringup(bool dhcp, const char *ip,
|
nsapi_error_t bringup(bool dhcp, const char *ip,
|
||||||
const char *netmask, const char *gw,
|
const char *netmask, const char *gw,
|
||||||
nsapi_ip_stack_t stack = DEFAULT_STACK,
|
nsapi_ip_stack_t stack = DEFAULT_STACK,
|
||||||
bool blocking = true
|
bool blocking = true
|
||||||
);
|
) override;
|
||||||
|
|
||||||
/** Disconnect interface from the network
|
/** Disconnect interface from the network
|
||||||
*
|
*
|
||||||
|
@ -63,7 +63,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return NSAPI_ERROR_OK on success, or error code
|
* @return NSAPI_ERROR_OK on success, or error code
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t bringdown();
|
nsapi_error_t bringdown() override;
|
||||||
|
|
||||||
/** Register callback for status reporting
|
/** Register callback for status reporting
|
||||||
*
|
*
|
||||||
|
@ -73,35 +73,35 @@ public:
|
||||||
*
|
*
|
||||||
* @param status_cb The callback for status changes
|
* @param status_cb The callback for status changes
|
||||||
*/
|
*/
|
||||||
virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
|
void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb) override;
|
||||||
|
|
||||||
/** Get the connection status
|
/** Get the connection status
|
||||||
*
|
*
|
||||||
* @return The connection status according to ConnectionStatusType
|
* @return The connection status according to ConnectionStatusType
|
||||||
*/
|
*/
|
||||||
virtual nsapi_connection_status_t get_connection_status() const;
|
nsapi_connection_status_t get_connection_status() const override;
|
||||||
|
|
||||||
/** Return netif interface name
|
/** Return netif interface name
|
||||||
*
|
*
|
||||||
* @return netif name eg "en0"
|
* @return netif name eg "en0"
|
||||||
*/
|
*/
|
||||||
virtual char *get_interface_name(char *buf);
|
char *get_interface_name(char *buf) override;
|
||||||
|
|
||||||
/** Return MAC address of the network interface
|
/** Return MAC address of the network interface
|
||||||
*
|
*
|
||||||
* @return MAC address as "V:W:X:Y:Z"
|
* @return MAC address as "V:W:X:Y:Z"
|
||||||
*/
|
*/
|
||||||
virtual char *get_mac_address(char *buf, nsapi_size_t buflen);
|
char *get_mac_address(char *buf, nsapi_size_t buflen) override;
|
||||||
|
|
||||||
/** @copydoc OnboardNetworkStack::Interface::get_ip_address */
|
/** @copydoc OnboardNetworkStack::Interface::get_ip_address */
|
||||||
virtual nsapi_error_t get_ip_address(SocketAddress *address);
|
nsapi_error_t get_ip_address(SocketAddress *address) override;
|
||||||
|
|
||||||
/** Get the IPv6 link local address in SocketAddress representation
|
/** Get the IPv6 link local address in SocketAddress representation
|
||||||
*
|
*
|
||||||
* @address SocketAddress representation of the link local IPv6 address
|
* @address SocketAddress representation of the link local IPv6 address
|
||||||
* @return NSAPI_ERROR_OK on success, or error code
|
* @return NSAPI_ERROR_OK on success, or error code
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t get_ipv6_link_local_address(SocketAddress *address);
|
nsapi_error_t get_ipv6_link_local_address(SocketAddress *address) override;
|
||||||
|
|
||||||
/** Copies netmask of the network interface to user supplied buffer
|
/** Copies netmask of the network interface to user supplied buffer
|
||||||
*
|
*
|
||||||
|
@ -109,7 +109,7 @@ public:
|
||||||
* @param buflen size of supplied buffer
|
* @param buflen size of supplied buffer
|
||||||
* @return Pointer to a buffer, or NULL if the buffer is too small
|
* @return Pointer to a buffer, or NULL if the buffer is too small
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t get_netmask(SocketAddress *address);
|
nsapi_error_t get_netmask(SocketAddress *address) override;
|
||||||
|
|
||||||
/** Copies gateway address of the network interface to user supplied buffer
|
/** Copies gateway address of the network interface to user supplied buffer
|
||||||
*
|
*
|
||||||
|
@ -117,7 +117,7 @@ public:
|
||||||
* @param buflen size of supplied buffer
|
* @param buflen size of supplied buffer
|
||||||
* @return Pointer to a buffer, or NULL if the buffer is too small
|
* @return Pointer to a buffer, or NULL if the buffer is too small
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t get_gateway(SocketAddress *address);
|
nsapi_error_t get_gateway(SocketAddress *address) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class LWIP;
|
friend class LWIP;
|
||||||
|
@ -228,7 +228,7 @@ public:
|
||||||
* @param[out] interface_out pointer to stack interface object controlling the EMAC
|
* @param[out] interface_out pointer to stack interface object controlling the EMAC
|
||||||
* @return NSAPI_ERROR_OK on success, or error code
|
* @return NSAPI_ERROR_OK on success, or error code
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t add_ethernet_interface(EMAC &emac, bool default_if, OnboardNetworkStack::Interface **interface_out);
|
nsapi_error_t add_ethernet_interface(EMAC &emac, bool default_if, OnboardNetworkStack::Interface **interface_out) override;
|
||||||
|
|
||||||
/** Register a network interface with the IP stack
|
/** Register a network interface with the IP stack
|
||||||
*
|
*
|
||||||
|
@ -240,7 +240,7 @@ public:
|
||||||
* @param[out] interface_out pointer to stack interface object controlling the L3IP
|
* @param[out] interface_out pointer to stack interface object controlling the L3IP
|
||||||
* @return NSAPI_ERROR_OK on success, or error code
|
* @return NSAPI_ERROR_OK on success, or error code
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t add_l3ip_interface(L3IP &l3ip, bool default_if, OnboardNetworkStack::Interface **interface_out);
|
nsapi_error_t add_l3ip_interface(L3IP &l3ip, bool default_if, OnboardNetworkStack::Interface **interface_out) override;
|
||||||
|
|
||||||
/** Register a PPP interface with the IP stack
|
/** Register a PPP interface with the IP stack
|
||||||
*
|
*
|
||||||
|
@ -259,7 +259,7 @@ public:
|
||||||
* @param[out] interface_out set to interface handle that must be passed to subsequent mbed_stack calls
|
* @param[out] interface_out set to interface handle that must be passed to subsequent mbed_stack calls
|
||||||
* @return NSAPI_ERROR_OK on success, or error code
|
* @return NSAPI_ERROR_OK on success, or error code
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t add_ppp_interface(PPP &ppp, bool default_if, OnboardNetworkStack::Interface **interface_out);
|
nsapi_error_t add_ppp_interface(PPP &ppp, bool default_if, OnboardNetworkStack::Interface **interface_out) override;
|
||||||
|
|
||||||
/** Remove a network interface from IP stack
|
/** Remove a network interface from IP stack
|
||||||
*
|
*
|
||||||
|
@ -267,7 +267,7 @@ public:
|
||||||
* @param[out] interface_out pointer to stack interface object controlling the L3IP
|
* @param[out] interface_out pointer to stack interface object controlling the L3IP
|
||||||
* @return NSAPI_ERROR_OK on success, or error code
|
* @return NSAPI_ERROR_OK on success, or error code
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t remove_ethernet_interface(OnboardNetworkStack::Interface **interface_out);
|
nsapi_error_t remove_ethernet_interface(OnboardNetworkStack::Interface **interface_out) override;
|
||||||
|
|
||||||
/** Remove a network interface from IP stack
|
/** Remove a network interface from IP stack
|
||||||
*
|
*
|
||||||
|
@ -275,7 +275,7 @@ public:
|
||||||
* @param[out] interface_out pointer to stack interface object controlling the PPP
|
* @param[out] interface_out pointer to stack interface object controlling the PPP
|
||||||
* @return NSAPI_ERROR_OK on success, or error code
|
* @return NSAPI_ERROR_OK on success, or error code
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t remove_l3ip_interface(OnboardNetworkStack::Interface **interface_out);
|
nsapi_error_t remove_l3ip_interface(OnboardNetworkStack::Interface **interface_out) override;
|
||||||
|
|
||||||
/** Remove a network interface from IP stack
|
/** Remove a network interface from IP stack
|
||||||
*
|
*
|
||||||
|
@ -283,7 +283,7 @@ public:
|
||||||
* @param[out] interface_out pointer to stack interface object controlling the PPP
|
* @param[out] interface_out pointer to stack interface object controlling the PPP
|
||||||
* @return NSAPI_ERROR_OK on success, or error code
|
* @return NSAPI_ERROR_OK on success, or error code
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t remove_ppp_interface(OnboardNetworkStack::Interface **interface_out);
|
nsapi_error_t remove_ppp_interface(OnboardNetworkStack::Interface **interface_out) override;
|
||||||
|
|
||||||
/** Get a domain name server from a list of servers to query
|
/** Get a domain name server from a list of servers to query
|
||||||
*
|
*
|
||||||
|
@ -294,7 +294,7 @@ public:
|
||||||
* @param address Destination for the host address
|
* @param address Destination for the host address
|
||||||
* @return 0 on success, negative error code on failure
|
* @return 0 on success, negative error code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t get_dns_server(int index, SocketAddress *address, const char *interface_name);
|
nsapi_error_t get_dns_server(int index, SocketAddress *address, const char *interface_name) override;
|
||||||
|
|
||||||
/** Add a domain name server to list of servers to query
|
/** Add a domain name server to list of servers to query
|
||||||
*
|
*
|
||||||
|
@ -302,21 +302,20 @@ public:
|
||||||
* @param interface_name Network interface name
|
* @param interface_name Network interface name
|
||||||
* @return NSAPI_ERROR_OK on success, negative error code on failure
|
* @return NSAPI_ERROR_OK on success, negative error code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t add_dns_server(const SocketAddress &address, const char *interface_name);
|
nsapi_error_t add_dns_server(const SocketAddress &address, const char *interface_name) override;
|
||||||
|
|
||||||
/** @copydoc NetworkStack::get_ip_address */
|
/** @copydoc NetworkStack::get_ip_address */
|
||||||
virtual nsapi_error_t get_ip_address(SocketAddress *address);
|
virtual nsapi_error_t get_ip_address(SocketAddress *address);
|
||||||
|
|
||||||
/** @copydoc NetworkStack::get_ip_address_if */
|
/** @copydoc NetworkStack::get_ip_address_if */
|
||||||
virtual nsapi_error_t get_ip_address_if(SocketAddress *address, const char *interface_name);
|
nsapi_error_t get_ip_address_if(SocketAddress *address, const char *interface_name) override;
|
||||||
|
|
||||||
/** Set the network interface as default one
|
/** Set the network interface as default one
|
||||||
*/
|
*/
|
||||||
virtual void set_default_interface(OnboardNetworkStack::Interface *interface);
|
void set_default_interface(OnboardNetworkStack::Interface *interface) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LWIP();
|
LWIP();
|
||||||
virtual ~LWIP() {}
|
|
||||||
|
|
||||||
/** Opens a socket
|
/** Opens a socket
|
||||||
*
|
*
|
||||||
|
@ -330,7 +329,7 @@ protected:
|
||||||
* @param proto Protocol of socket to open, NSAPI_TCP or NSAPI_UDP
|
* @param proto Protocol of socket to open, NSAPI_TCP or NSAPI_UDP
|
||||||
* @return 0 on success, negative error code on failure
|
* @return 0 on success, negative error code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t socket_open(nsapi_socket_t *handle, nsapi_protocol_t proto);
|
nsapi_error_t socket_open(nsapi_socket_t *handle, nsapi_protocol_t proto) override;
|
||||||
|
|
||||||
/** Close the socket
|
/** Close the socket
|
||||||
*
|
*
|
||||||
|
@ -340,7 +339,7 @@ protected:
|
||||||
* @param handle Socket handle
|
* @param handle Socket handle
|
||||||
* @return 0 on success, negative error code on failure
|
* @return 0 on success, negative error code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t socket_close(nsapi_socket_t handle);
|
nsapi_error_t socket_close(nsapi_socket_t handle) override;
|
||||||
|
|
||||||
/** Bind a specific address to a socket
|
/** Bind a specific address to a socket
|
||||||
*
|
*
|
||||||
|
@ -351,7 +350,7 @@ protected:
|
||||||
* @param address Local address to bind
|
* @param address Local address to bind
|
||||||
* @return 0 on success, negative error code on failure.
|
* @return 0 on success, negative error code on failure.
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t socket_bind(nsapi_socket_t handle, const SocketAddress &address);
|
nsapi_error_t socket_bind(nsapi_socket_t handle, const SocketAddress &address) override;
|
||||||
|
|
||||||
/** Listen for connections on a TCP socket
|
/** Listen for connections on a TCP socket
|
||||||
*
|
*
|
||||||
|
@ -363,7 +362,7 @@ protected:
|
||||||
* simultaneously
|
* simultaneously
|
||||||
* @return 0 on success, negative error code on failure
|
* @return 0 on success, negative error code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog);
|
nsapi_error_t socket_listen(nsapi_socket_t handle, int backlog) override;
|
||||||
|
|
||||||
/** Connects TCP socket to a remote host
|
/** Connects TCP socket to a remote host
|
||||||
*
|
*
|
||||||
|
@ -374,7 +373,7 @@ protected:
|
||||||
* @param address The SocketAddress of the remote host
|
* @param address The SocketAddress of the remote host
|
||||||
* @return 0 on success, negative error code on failure
|
* @return 0 on success, negative error code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address);
|
nsapi_error_t socket_connect(nsapi_socket_t handle, const SocketAddress &address) override;
|
||||||
|
|
||||||
/** Accepts a connection on a TCP socket
|
/** Accepts a connection on a TCP socket
|
||||||
*
|
*
|
||||||
|
@ -394,8 +393,8 @@ protected:
|
||||||
* @param address Destination for the remote address or NULL
|
* @param address Destination for the remote address or NULL
|
||||||
* @return 0 on success, negative error code on failure
|
* @return 0 on success, negative error code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t socket_accept(nsapi_socket_t server,
|
nsapi_error_t socket_accept(nsapi_socket_t server,
|
||||||
nsapi_socket_t *handle, SocketAddress *address = 0);
|
nsapi_socket_t *handle, SocketAddress *address = 0) override;
|
||||||
|
|
||||||
/** Send data over a TCP socket
|
/** Send data over a TCP socket
|
||||||
*
|
*
|
||||||
|
@ -411,8 +410,8 @@ protected:
|
||||||
* @return Number of sent bytes on success, negative error
|
* @return Number of sent bytes on success, negative error
|
||||||
* code on failure
|
* code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_size_or_error_t socket_send(nsapi_socket_t handle,
|
nsapi_size_or_error_t socket_send(nsapi_socket_t handle,
|
||||||
const void *data, nsapi_size_t size);
|
const void *data, nsapi_size_t size) override;
|
||||||
|
|
||||||
/** Receive data over a TCP socket
|
/** Receive data over a TCP socket
|
||||||
*
|
*
|
||||||
|
@ -428,8 +427,8 @@ protected:
|
||||||
* @return Number of received bytes on success, negative error
|
* @return Number of received bytes on success, negative error
|
||||||
* code on failure
|
* code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_size_or_error_t socket_recv(nsapi_socket_t handle,
|
nsapi_size_or_error_t socket_recv(nsapi_socket_t handle,
|
||||||
void *data, nsapi_size_t size);
|
void *data, nsapi_size_t size) override;
|
||||||
|
|
||||||
/** Send a packet over a UDP socket
|
/** Send a packet over a UDP socket
|
||||||
*
|
*
|
||||||
|
@ -446,8 +445,8 @@ protected:
|
||||||
* @return Number of sent bytes on success, negative error
|
* @return Number of sent bytes on success, negative error
|
||||||
* code on failure
|
* code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_size_or_error_t socket_sendto(nsapi_socket_t handle, const SocketAddress &address,
|
nsapi_size_or_error_t socket_sendto(nsapi_socket_t handle, const SocketAddress &address,
|
||||||
const void *data, nsapi_size_t size);
|
const void *data, nsapi_size_t size) override;
|
||||||
|
|
||||||
/** Receive a packet over a UDP socket
|
/** Receive a packet over a UDP socket
|
||||||
*
|
*
|
||||||
|
@ -464,8 +463,8 @@ protected:
|
||||||
* @return Number of received bytes on success, negative error
|
* @return Number of received bytes on success, negative error
|
||||||
* code on failure
|
* code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_size_or_error_t socket_recvfrom(nsapi_socket_t handle, SocketAddress *address,
|
nsapi_size_or_error_t socket_recvfrom(nsapi_socket_t handle, SocketAddress *address,
|
||||||
void *buffer, nsapi_size_t size);
|
void *buffer, nsapi_size_t size) override;
|
||||||
|
|
||||||
/** Register a callback on state change of the socket
|
/** Register a callback on state change of the socket
|
||||||
*
|
*
|
||||||
|
@ -480,7 +479,7 @@ protected:
|
||||||
* @param callback Function to call on state change
|
* @param callback Function to call on state change
|
||||||
* @param data Argument to pass to callback
|
* @param data Argument to pass to callback
|
||||||
*/
|
*/
|
||||||
virtual void socket_attach(nsapi_socket_t handle, void (*callback)(void *), void *data);
|
void socket_attach(nsapi_socket_t handle, void (*callback)(void *), void *data) override;
|
||||||
|
|
||||||
/* Set stack-specific socket options
|
/* Set stack-specific socket options
|
||||||
*
|
*
|
||||||
|
@ -495,8 +494,8 @@ protected:
|
||||||
* @param optlen Length of the option value
|
* @param optlen Length of the option value
|
||||||
* @return 0 on success, negative error code on failure
|
* @return 0 on success, negative error code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t setsockopt(nsapi_socket_t handle, int level,
|
nsapi_error_t setsockopt(nsapi_socket_t handle, int level,
|
||||||
int optname, const void *optval, unsigned optlen);
|
int optname, const void *optval, unsigned optlen) override;
|
||||||
|
|
||||||
/* Get stack-specific socket options
|
/* Get stack-specific socket options
|
||||||
*
|
*
|
||||||
|
@ -511,8 +510,8 @@ protected:
|
||||||
* @param optlen Length of the option value
|
* @param optlen Length of the option value
|
||||||
* @return 0 on success, negative error code on failure
|
* @return 0 on success, negative error code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t getsockopt(nsapi_socket_t handle, int level,
|
nsapi_error_t getsockopt(nsapi_socket_t handle, int level,
|
||||||
int optname, void *optval, unsigned *optlen);
|
int optname, void *optval, unsigned *optlen) override;
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/** Call in callback
|
/** Call in callback
|
||||||
|
@ -533,7 +532,7 @@ private:
|
||||||
*
|
*
|
||||||
* @return Call in callback
|
* @return Call in callback
|
||||||
*/
|
*/
|
||||||
virtual call_in_callback_cb_t get_call_in_callback();
|
call_in_callback_cb_t get_call_in_callback() override;
|
||||||
|
|
||||||
/** Call a callback after a delay
|
/** Call a callback after a delay
|
||||||
*
|
*
|
||||||
|
@ -544,7 +543,7 @@ private:
|
||||||
* @param func Callback to be called
|
* @param func Callback to be called
|
||||||
* @return 0 on success, negative error code on failure
|
* @return 0 on success, negative error code on failure
|
||||||
*/
|
*/
|
||||||
virtual nsapi_error_t call_in(int delay, mbed::Callback<void()> func);
|
nsapi_error_t call_in(int delay, mbed::Callback<void()> func) override;
|
||||||
|
|
||||||
struct mbed_lwip_socket {
|
struct mbed_lwip_socket {
|
||||||
bool in_use;
|
bool in_use;
|
||||||
|
|
Loading…
Reference in New Issue