Mbed OS Reference
Loading...
Searching...
No Matches
PPP Class Referenceabstract
Inheritance diagram for PPP:
ppp_service

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

virtual uint32_t get_mtu_size ()=0
 Return maximum transmission unit. More...
 
virtual uint32_t get_align_preference () const =0
 Gets memory buffer alignment preference. More...
 
virtual void get_ifname (char *name, uint8_t size) const =0
 Return interface name. More...
 
virtual bool link_out (net_stack_mem_buf_t *buf, nsapi_ip_stack_t ip_stack)=0
 Sends the packet over the link. More...
 
virtual bool power_up ()=0
 Initializes the PPP. More...
 
virtual void power_down ()=0
 Deinitializes the PPP. More...
 
virtual void set_link_input_cb (ppp_link_input_cb_t input_cb)=0
 Sets a callback that needs to be called for packets received for that interface. More...
 
virtual void set_link_state_cb (ppp_link_state_change_cb_t state_cb)=0
 Sets a callback that needs to be called on link status changes for given interface. More...
 
virtual void set_memory_manager (NetStackMemoryManager &mem_mngr)=0
 Sets memory manager that is used to handle memory buffers. More...
 
virtual void set_stream (mbed::FileHandle *stream)=0
 Sets file stream used to communicate with modem. More...
 
virtual void set_ip_stack (nsapi_ip_stack_t ip_stack)=0
 Sets IP protocol versions of IP stack. More...
 
virtual void set_credentials (const char *uname, const char *password)=0
 Sets user name and password for PPP protocol. More...
 
virtual const nsapi_addr_tget_ip_address (nsapi_version_t version)=0
 Gets local IP address. More...
 
virtual const nsapi_addr_tget_netmask ()=0
 Get the local network mask. More...
 
virtual const nsapi_addr_tget_gateway ()=0
 Get the local gateway. More...
 
virtual const nsapi_addr_tget_dns_server (uint8_t index)=0
 Gets DNS server address. More...
 

Static Public Member Functions

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

Detailed Description

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

Member Typedef Documentation

◆ ppp_link_input_cb_t

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.


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

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_default_instance()

static PPP & get_default_instance ( )
static

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.

◆ get_mtu_size()

virtual uint32_t get_mtu_size ( )
pure virtual

Return maximum transmission unit.

Returns
MTU in bytes

Implemented in ppp_service.

◆ get_align_preference()

virtual uint32_t get_align_preference ( ) const
pure virtual

Gets memory buffer alignment preference.

Gets preferred memory buffer alignment of the cellular device.

Returns
Memory alignment requirement in bytes

Implemented in ppp_service.

◆ get_ifname()

virtual void get_ifname ( char *  name,
uint8_t  size 
) const
pure virtual

Return interface name.

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

Implemented in ppp_service.

◆ link_out()

virtual bool link_out ( net_stack_mem_buf_t *  buf,
nsapi_ip_stack_t  ip_stack 
)
pure virtual

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

Implemented in ppp_service.

◆ power_up()

virtual bool power_up ( )
pure virtual

Initializes the PPP.

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

Implemented in ppp_service.

◆ power_down()

virtual void power_down ( )
pure virtual

Deinitializes the PPP.

Implemented in ppp_service.

◆ set_link_input_cb()

virtual void set_link_input_cb ( ppp_link_input_cb_t  input_cb)
pure virtual

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

Parameters
input_cbFunction to be register as a callback

Implemented in ppp_service.

◆ set_link_state_cb()

virtual void set_link_state_cb ( ppp_link_state_change_cb_t  state_cb)
pure virtual

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

Parameters
state_cbFunction to be register as a callback

Implemented in ppp_service.

◆ set_memory_manager()

virtual void set_memory_manager ( NetStackMemoryManager mem_mngr)
pure virtual

Sets memory manager that is used to handle memory buffers.

Parameters
mem_mngrPointer to memory manager

Implemented in ppp_service.

◆ set_stream()

virtual void set_stream ( mbed::FileHandle stream)
pure virtual

Sets file stream used to communicate with modem.

Parameters
streamPointer to file handle

Implemented in ppp_service.

◆ set_ip_stack()

virtual void set_ip_stack ( nsapi_ip_stack_t  ip_stack)
pure virtual

Sets IP protocol versions of IP stack.

Parameters
ip_stackIP protocol version

Implemented in ppp_service.

◆ set_credentials()

virtual void set_credentials ( const char *  uname,
const char *  password 
)
pure virtual

Sets user name and password for PPP protocol.

Parameters
unameUser name
passwordPassword

Implemented in ppp_service.

◆ get_ip_address()

virtual const nsapi_addr_t * get_ip_address ( nsapi_version_t  version)
pure virtual

Gets local IP address.

Parameters
versionIP address version
Returns
IP address

Implemented in ppp_service.

◆ get_netmask()

virtual const nsapi_addr_t * get_netmask ( )
pure virtual

Get the local network mask.

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

Implemented in ppp_service.

◆ get_gateway()

virtual const nsapi_addr_t * get_gateway ( )
pure virtual

Get the local gateway.

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

Implemented in ppp_service.

◆ get_dns_server()

virtual const nsapi_addr_t * get_dns_server ( uint8_t  index)
pure virtual

Gets DNS server address.

Parameters
indexServer index

Implemented in ppp_service.