23 #include "Semaphore.h" 24 #include "NetStackMemoryManager.h" 25 #include "FileHandle.h" 26 #include "events/EventQueue.h" 27 #include "netsocket/PPP.h" 80 void get_ifname(
char *name, uint8_t size)
const override;
90 bool link_out(net_stack_mem_buf_t *buf, nsapi_ip_stack_t ip_stack)
override;
141 void set_credentials(
const char *uname,
const char *password)
override;
199 bool prepare_event_queue();
201 void ppp_stream_sigio_callback();
202 void ppp_handle_modem_hangup();
203 static void ppp_link_status(
struct ppp_pcb_s *pcb,
int err_code,
void *ctx);
204 void power_up_call();
205 void link_state_call(
bool up);
218 ppp_link_input_cb_t ppp_link_input_cb;
219 ppp_link_state_change_cb_t ppp_link_state_cb;
221 netif *ppp_service_netif;
222 ppp_pcb_s *ppp_service_pcb =
nullptr;
223 nsapi_ip_stack_t ppp_service_stack = IPV4_STACK;
224 const char *ppp_service_uname =
nullptr;
225 const char *ppp_service_password =
nullptr;
227 bool ppp_service_active : 1;
228 bool ppp_service_event_queued : 1;
229 bool ppp_service_terminating : 1;
230 bool ppp_link_state_up : 1;
mbed::Callback< void(net_stack_mem_buf_t *buf)> ppp_link_input_cb_t
Callback to be registered with PPP interface and to be called for received packets.
void set_link_input_cb(ppp_link_input_cb_t input_cb) override
Sets a callback that needs to be called for packets received for that interface.
mbed::Callback< void(bool up)> ppp_link_state_change_cb_t
Callback to be registered with PPP interface and to be called for link status changes.
void resource_lock()
Lock PPP resource.
The Semaphore class is used to manage and protect access to a set of shared resources.
void set_memory_manager(NetStackMemoryManager &mem_mngr) override
Sets memory manager that is used to handle memory buffers.
const nsapi_addr_t * get_netmask() override
Get the local network mask.
void get_ifname(char *name, uint8_t size) const override
Return interface name.
signed int nsapi_error_t
Type used to represent error codes.
void set_credentials(const char *uname, const char *password) override
Sets user name and password for PPP protocol.
const nsapi_addr_t * get_dns_server(uint8_t index) override
Gets DNS server address.
void resource_unlock()
Unlock PPP resource.
bool power_up() override
Initializes the hardware.
Generic data structure used for all lwIP network interfaces.
The Mutex class is used to synchronize the execution of threads.
events::EventQueue * event_queue_get()
Handle to PPP event queue.
const nsapi_addr_t * get_gateway() override
Get the local gateway.
void link_state(bool up)
Link state indication from PPP.
void set_stream(mbed::FileHandle *stream) override
Sets file stream used to communicate with modem.
const nsapi_addr_t * get_ip_address(nsapi_version_t version) override
Gets local IP address.
void set_link_state_cb(ppp_link_state_change_cb_t state_cb) override
Sets a callback that needs to be called on link status changes for given interface.
bool link_out(net_stack_mem_buf_t *buf, nsapi_ip_stack_t ip_stack) override
Sends the packet over the link.
uint32_t get_mtu_size() override
Return maximum transmission unit.
IP address structure for passing IP addresses by value.
void link_input(net_stack_mem_buf_t *buf)
Received IP packet from PPP to stack.
This interface should be used to abstract low level access to networking hardware All operations rece...
void power_down() override
Deinitializes the hardware.
void set_ip_stack(nsapi_ip_stack_t ip_stack) override
Sets IP protocol versions of IP stack.
uint32_t get_align_preference() const override
Gets memory buffer alignment preference.