Mbed OS Reference
Loading...
Searching...
No Matches
ppp_service Class Referencefinal

This interface should be used to abstract low level access to networking hardware All operations receive a void * hardware pointer which an ppp device provides when it is registered with a stack. More...

#include <ppp_service.h>

Inheritance diagram for ppp_service:
PPP

Public Types

typedef 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. More...
 
typedef 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. More...
 

Public Member Functions

uint32_t get_mtu_size () override
 Return maximum transmission unit. More...
 
uint32_t get_align_preference () const override
 Gets memory buffer alignment preference. More...
 
void get_ifname (char *name, uint8_t size) const override
 Return interface name. More...
 
bool link_out (net_stack_mem_buf_t *buf, nsapi_ip_stack_t ip_stack) override
 Sends the packet over the link. More...
 
bool power_up () override
 Initializes the hardware. More...
 
void power_down () override
 Deinitializes the hardware. More...
 
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. More...
 
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. More...
 
void set_memory_manager (NetStackMemoryManager &mem_mngr) override
 Sets memory manager that is used to handle memory buffers. More...
 
void set_stream (mbed::FileHandle *stream) override
 Sets file stream used to communicate with modem. More...
 
void set_ip_stack (nsapi_ip_stack_t ip_stack) override
 Sets IP protocol versions of IP stack. More...
 
void set_credentials (const char *uname, const char *password) override
 Sets user name and password for PPP protocol. More...
 
const nsapi_addr_tget_ip_address (nsapi_version_t version) override
 Gets local IP address. More...
 
const nsapi_addr_tget_netmask () override
 Get the local network mask. More...
 
const nsapi_addr_tget_gateway () override
 Get the local gateway. More...
 
const nsapi_addr_tget_dns_server (uint8_t index) override
 Gets DNS server address. More...
 
void link_state (bool up)
 Link state indication from PPP. More...
 
void link_input (net_stack_mem_buf_t *buf)
 Received IP packet from PPP to stack. More...
 
events::EventQueueevent_queue_get ()
 Handle to PPP event queue. More...
 
void resource_lock ()
 Lock PPP resource. More...
 
void resource_unlock ()
 Unlock PPP resource. More...
 

Static Public Member Functions

static PPPget_default_instance ()
 Return the default on-board PPP. More...
 

Detailed Description

This interface should be used to abstract low level access to networking hardware All operations receive a void * hardware pointer which an ppp device provides when it is registered with a stack.

Definition at line 37 of file ppp_service.h.

Member Typedef Documentation

◆ ppp_link_input_cb_t

typedef mbed::Callback<void (net_stack_mem_buf_t *buf)> ppp_link_input_cb_t
inherited

Callback to be registered with PPP interface and to be called for received packets.


buf : Received data

Definition at line 43 of file netsocket/include/netsocket/ppp.h.

◆ ppp_link_state_change_cb_t

typedef mbed::Callback<void (bool up)> ppp_link_state_change_cb_t
inherited

Callback to be registered with PPP interface and to be called for link status changes.


up : Link status

Definition at line 50 of file netsocket/include/netsocket/ppp.h.

Member Function Documentation

◆ get_mtu_size()

uint32_t get_mtu_size ( )
overridevirtual

Return maximum transmission unit.

Returns
MTU in bytes

Implements PPP.

◆ get_align_preference()

uint32_t get_align_preference ( ) const
overridevirtual

Gets memory buffer alignment preference.

Gets preferred memory buffer alignment of the ppp device.

Returns
Memory alignment requirement in bytes

Implements PPP.

◆ get_ifname()

void get_ifname ( char *  name,
uint8_t  size 
) const
overridevirtual

Return interface name.

Parameters
namePointer to where the name should be written
sizeMaximum number of characters to copy

Implements PPP.

◆ link_out()

bool link_out ( net_stack_mem_buf_t *  buf,
nsapi_ip_stack_t  ip_stack 
)
overridevirtual

Sends the packet over the link.

That cannot be called from an interrupt context.

Parameters
bufPacket to be sent
ip_stackIP version to use (4 or 6) to send the packet.
Returns
True if the packet was sent, false otherwise

Implements PPP.

◆ power_up()

bool power_up ( )
overridevirtual

Initializes the hardware.

Returns
True on success, False in case of an error.

Implements PPP.

◆ power_down()

void power_down ( )
overridevirtual

Deinitializes the hardware.

Implements PPP.

◆ set_link_input_cb()

void set_link_input_cb ( ppp_link_input_cb_t  input_cb)
overridevirtual

Sets a callback that needs to be called for packets received for that interface.

Parameters
input_cbFunction to be register as a callback

Implements PPP.

◆ set_link_state_cb()

void set_link_state_cb ( ppp_link_state_change_cb_t  state_cb)
overridevirtual

Sets a callback that needs to be called on link status changes for given interface.

Parameters
state_cbFunction to be register as a callback

Implements PPP.

◆ set_memory_manager()

void set_memory_manager ( NetStackMemoryManager mem_mngr)
overridevirtual

Sets memory manager that is used to handle memory buffers.

Parameters
mem_mngrPointer to memory manager

Implements PPP.

◆ set_stream()

void set_stream ( mbed::FileHandle stream)
overridevirtual

Sets file stream used to communicate with modem.

Parameters
streamPointer to file handle

Implements PPP.

◆ set_ip_stack()

void set_ip_stack ( nsapi_ip_stack_t  ip_stack)
overridevirtual

Sets IP protocol versions of IP stack.

Parameters
ip_stackIP protocol version

Implements PPP.

◆ set_credentials()

void set_credentials ( const char *  uname,
const char *  password 
)
overridevirtual

Sets user name and password for PPP protocol.

Parameters
unameUser name
passwordPassword

Implements PPP.

◆ get_ip_address()

const nsapi_addr_t * get_ip_address ( nsapi_version_t  version)
overridevirtual

Gets local IP address.

Parameters
versionIP address version
Returns
IP address

Implements PPP.

◆ get_netmask()

const nsapi_addr_t * get_netmask ( )
overridevirtual

Get the local network mask.

Returns
Local network mask or null if no network mask has been received.

Implements PPP.

◆ get_gateway()

const nsapi_addr_t * get_gateway ( )
overridevirtual

Get the local gateway.

Returns
Local gateway or null if no network mask has been received.

Implements PPP.

◆ get_dns_server()

const nsapi_addr_t * get_dns_server ( uint8_t  index)
overridevirtual

Gets DNS server address.

Parameters
indexServer index

Implements PPP.

◆ link_state()

void link_state ( bool  up)

Link state indication from PPP.

Parameters
upLink status

◆ link_input()

void link_input ( net_stack_mem_buf_t *  buf)

Received IP packet from PPP to stack.

Parameters
bufReceived packet

◆ event_queue_get()

events::EventQueue * event_queue_get ( )

Handle to PPP event queue.

Returns
Event queue

◆ resource_lock()

void resource_lock ( )

Lock PPP resource.

◆ resource_unlock()

void resource_unlock ( )

Unlock PPP resource.

◆ get_default_instance()

static PPP & get_default_instance ( )
staticinherited

Return the default on-board PPP.

Returns the default on-board PPP - this will be target-specific, and may not be available on all targets.