Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

ppp_service Class Reference

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>

Inherits 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.
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.

Public Member Functions

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

Static Public Member Functions

static PPP & get_default_instance ()
 Return the default on-board PPP.

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 34 of file ppp_service.h.


Member Typedef Documentation

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.

Parameters:
bufReceived data

Definition at line 46 of file ppp_service.h.

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.

Parameters:
upLink status

Definition at line 54 of file ppp_service.h.


Member Function Documentation

events::EventQueue * event_queue_get (  ) [virtual]

Handle to PPP event queue.

Returns:
Event queue

Definition at line 645 of file ppp_service.cpp.

uint32_t get_align_preference (  ) const [virtual]

Gets memory buffer alignment preference.

Gets preferred memory buffer alignment of the ppp device.

Returns:
Memory alignment requirement in bytes

Definition at line 467 of file ppp_service.cpp.

MBED_WEAK PPP & get_default_instance (  ) [static, inherited]

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.

Definition at line 667 of file ppp_service.cpp.

const nsapi_addr_t * get_dns_server ( uint8_t  index ) [virtual]

Gets DNS server address.

Parameters:
indexServer index

Definition at line 573 of file ppp_service.cpp.

const nsapi_addr_t * get_gateway (  ) [virtual]

Get the local gateway.

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

Definition at line 562 of file ppp_service.cpp.

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

Return interface name.

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

Definition at line 472 of file ppp_service.cpp.

const nsapi_addr_t * get_ip_address ( nsapi_version_t  version ) [virtual]

Gets local IP address.

Parameters:
versionIP address version
Returns:
IP address

Definition at line 530 of file ppp_service.cpp.

uint32_t get_mtu_size (  ) [virtual]

Return maximum transmission unit.

Returns:
MTU in bytes

Definition at line 457 of file ppp_service.cpp.

const nsapi_addr_t * get_netmask (  ) [virtual]

Get the local network mask.

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

Definition at line 551 of file ppp_service.cpp.

void link_input ( net_stack_mem_buf_t *  buf ) [virtual]

Received IP packet from PPP to stack.

Parameters:
bufReceived packet

Definition at line 635 of file ppp_service.cpp.

bool link_out ( net_stack_mem_buf_t *  buf,
nsapi_ip_stack_t  ip_stack 
) [virtual]

Sends the packet over the link.

That cannot be called from an interrupt context.

Parameters:
bufPacket to be send
Returns:
True if the packet was send successfully, false otherwise

Definition at line 394 of file ppp_service.cpp.

void link_state ( bool  up ) [virtual]

Link state indication from PPP.

Parameters:
upLink status

Definition at line 587 of file ppp_service.cpp.

void power_down (  ) [virtual]

Deinitializes the hardware.

Definition at line 487 of file ppp_service.cpp.

bool power_up (  ) [virtual]

Initializes the hardware.

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

Definition at line 425 of file ppp_service.cpp.

void resource_lock (  ) [virtual]

Lock PPP resource.

Definition at line 650 of file ppp_service.cpp.

void resource_unlock (  ) [virtual]

Unlock PPP resource.

Definition at line 655 of file ppp_service.cpp.

void set_credentials ( const char *  uname,
const char *  password 
) [virtual]

Sets user name and password for PPP protocol.

Parameters:
unameUser name
passwordPassword

Definition at line 516 of file ppp_service.cpp.

void set_ip_stack ( nsapi_ip_stack_t  ip_stack ) [virtual]

Sets IP protocol versions of IP stack.

Parameters:
ip_stackIP protocol version

Definition at line 511 of file ppp_service.cpp.

void set_link_input_cb ( ppp_link_input_cb_t  input_cb ) [virtual]

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

Parameters:
input_cbFunction to be register as a callback

Definition at line 477 of file ppp_service.cpp.

void set_link_state_cb ( ppp_link_state_change_cb_t  state_cb ) [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

Definition at line 482 of file ppp_service.cpp.

virtual void set_link_state_cb ( ppp_link_state_change_cb_t  state_cb ) [pure virtual, inherited]

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

Parameters:
state_cbFunction to be register as a callback
void set_memory_manager ( NetStackMemoryManager &  mem_mngr ) [virtual]

Sets memory manager that is used to handle memory buffers.

Parameters:
mem_mngrPointer to memory manager

Definition at line 492 of file ppp_service.cpp.

void set_stream ( mbed::FileHandle stream ) [virtual]

Sets file stream used to communicate with modem.

Parameters:
streamPointer to file handle

Definition at line 502 of file ppp_service.cpp.