Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
PPP L2/driver Support Functions

Point-to-point (PPP) L2/driver support functions. More...

Data Structures

struct  ppp_api
 
struct  ppp_fsm
 
struct  ppp_my_option_data
 
struct  lcp_options
 
struct  ipcp_options
 
struct  ipv6cp_options
 
struct  ppp_context
 

Macros

#define PPP_MRU   CONFIG_NET_PPP_MTU_MRU
 
#define PPP_MTU   PPP_MRU
 
#define PPP_MAX_TERMINATE_REASON_LEN   32
 
#define PPP_INTERFACE_IDENTIFIER_LEN   8
 
#define PPP_MY_OPTION_ACKED   BIT(0)
 
#define PPP_MY_OPTION_REJECTED   BIT(1)
 
#define IPCP_NUM_MY_OPTIONS   3
 
#define IPV6CP_NUM_MY_OPTIONS   1
 

Typedefs

typedef void(* net_ppp_lcp_echo_reply_cb_t) (void *user_data, size_t user_data_len)
 A callback function that can be called if a Echo-Reply needs to be received. More...
 

Enumerations

enum  ppp_protocol_type {
  PPP_IP = 0x0021 , PPP_IPV6 = 0x0057 , PPP_IPCP = 0x8021 , PPP_ECP = 0x8053 ,
  PPP_IPV6CP = 0x8057 , PPP_CCP = 0x80FD , PPP_LCP = 0xc021 , PPP_PAP = 0xc023 ,
  PPP_CHAP = 0xc223 , PPP_EAP = 0xc227
}
 
enum  ppp_phase {
  PPP_DEAD , PPP_ESTABLISH , PPP_AUTH , PPP_NETWORK ,
  PPP_RUNNING , PPP_TERMINATE
}
 
enum  ppp_state {
  PPP_INITIAL , PPP_STARTING , PPP_CLOSED , PPP_STOPPED ,
  PPP_CLOSING , PPP_STOPPING , PPP_REQUEST_SENT , PPP_ACK_RECEIVED ,
  PPP_ACK_SENT , PPP_OPENED
}
 
enum  ppp_packet_type {
  PPP_CONFIGURE_REQ = 1 , PPP_CONFIGURE_ACK = 2 , PPP_CONFIGURE_NACK = 3 , PPP_CONFIGURE_REJ = 4 ,
  PPP_TERMINATE_REQ = 5 , PPP_TERMINATE_ACK = 6 , PPP_CODE_REJ = 7 , PPP_PROTOCOL_REJ = 8 ,
  PPP_ECHO_REQ = 9 , PPP_ECHO_REPLY = 10 , PPP_DISCARD_REQ = 11
}
 
enum  lcp_option_type {
  LCP_OPTION_RESERVED = 0 , LCP_OPTION_MRU = 1 , LCP_OPTION_ASYNC_CTRL_CHAR_MAP = 2 , LCP_OPTION_AUTH_PROTO = 3 ,
  LCP_OPTION_QUALITY_PROTO = 4 , LCP_OPTION_MAGIC_NUMBER = 5 , LCP_OPTION_PROTO_COMPRESS = 7 , LCP_OPTION_ADDR_CTRL_COMPRESS = 8
}
 
enum  ipcp_option_type {
  IPCP_OPTION_RESERVED = 0 , IPCP_OPTION_IP_ADDRESSES = 1 , IPCP_OPTION_IP_COMP_PROTO = 2 , IPCP_OPTION_IP_ADDRESS = 3 ,
  IPCP_OPTION_DNS1 = 129 , IPCP_OPTION_NBNS1 = 130 , IPCP_OPTION_DNS2 = 131 , IPCP_OPTION_NBNS2 = 132
}
 
enum  ipv6cp_option_type { IPV6CP_OPTION_RESERVED = 0 , IPV6CP_OPTION_INTERFACE_IDENTIFIER = 1 }
 
enum  ppp_flags { PPP_CARRIER_UP }
 

Functions

void net_ppp_carrier_on (struct net_if *iface)
 Inform PPP L2 driver that carrier is detected. This happens when cable is connected etc. More...
 
void net_ppp_carrier_off (struct net_if *iface)
 Inform PPP L2 driver that carrier was lost. This happens when cable is disconnected etc. More...
 
void net_ppp_init (struct net_if *iface)
 Initialize PPP L2 stack for a given interface. More...
 
static void ppp_mgmt_raise_carrier_on_event (struct net_if *iface)
 Raise CARRIER_ON event when PPP is connected. More...
 
static void ppp_mgmt_raise_carrier_off_event (struct net_if *iface)
 Raise CARRIER_OFF event when PPP is disconnected. More...
 
static void ppp_mgmt_raise_phase_running_event (struct net_if *iface)
 Raise PHASE_RUNNING event when PPP reaching RUNNING phase. More...
 
static void ppp_mgmt_raise_phase_dead_event (struct net_if *iface)
 Raise PHASE_DEAD event when PPP reaching DEAD phase. More...
 
static int net_ppp_ping (int idx, int32_t timeout)
 Send PPP Echo-Request to peer. We expect to receive Echo-Reply back. More...
 
static struct ppp_contextnet_ppp_context_get (int idx)
 Get PPP context information. This is only used by net-shell to print information about PPP. More...
 

Detailed Description

Point-to-point (PPP) L2/driver support functions.

Macro Definition Documentation

◆ IPCP_NUM_MY_OPTIONS

#define IPCP_NUM_MY_OPTIONS   3

#include <include/net/ppp.h>

◆ IPV6CP_NUM_MY_OPTIONS

#define IPV6CP_NUM_MY_OPTIONS   1

#include <include/net/ppp.h>

◆ PPP_INTERFACE_IDENTIFIER_LEN

#define PPP_INTERFACE_IDENTIFIER_LEN   8

#include <include/net/ppp.h>

Length of network interface identifier

◆ PPP_MAX_TERMINATE_REASON_LEN

#define PPP_MAX_TERMINATE_REASON_LEN   32

#include <include/net/ppp.h>

Max length of terminate description string

◆ PPP_MRU

#define PPP_MRU   CONFIG_NET_PPP_MTU_MRU

#include <include/net/ppp.h>

PPP maximum receive unit (MRU)

◆ PPP_MTU

#define PPP_MTU   PPP_MRU

#include <include/net/ppp.h>

PPP maximum transfer unit (MTU)

◆ PPP_MY_OPTION_ACKED

#define PPP_MY_OPTION_ACKED   BIT(0)

#include <include/net/ppp.h>

◆ PPP_MY_OPTION_REJECTED

#define PPP_MY_OPTION_REJECTED   BIT(1)

#include <include/net/ppp.h>

Typedef Documentation

◆ net_ppp_lcp_echo_reply_cb_t

net_ppp_lcp_echo_reply_cb_t

#include <include/net/ppp.h>

A callback function that can be called if a Echo-Reply needs to be received.

Parameters
user_dataUser settable data that is passed to the callback function.
user_data_lenLength of the user data.

Enumeration Type Documentation

◆ ipcp_option_type

#include <include/net/ppp.h>

IPCP option types from RFC 1332

Enumerator
IPCP_OPTION_RESERVED 
IPCP_OPTION_IP_ADDRESSES 

IP Addresses

IPCP_OPTION_IP_COMP_PROTO 

IP Compression Protocol

IPCP_OPTION_IP_ADDRESS 

IP Address

IPCP_OPTION_DNS1 

Primary DNS Server Address

IPCP_OPTION_NBNS1 

Primary NBNS Server Address

IPCP_OPTION_DNS2 

Secondary DNS Server Address

IPCP_OPTION_NBNS2 

Secondary NBNS Server Address

◆ ipv6cp_option_type

#include <include/net/ppp.h>

IPV6CP option types from RFC 5072

Enumerator
IPV6CP_OPTION_RESERVED 
IPV6CP_OPTION_INTERFACE_IDENTIFIER 

Interface identifier

◆ lcp_option_type

#include <include/net/ppp.h>

LCP option types from RFC 1661 ch. 6

Enumerator
LCP_OPTION_RESERVED 
LCP_OPTION_MRU 

Maximum-Receive-Unit

LCP_OPTION_ASYNC_CTRL_CHAR_MAP 

Async-Control-Character-Map

LCP_OPTION_AUTH_PROTO 

Authentication-Protocol

LCP_OPTION_QUALITY_PROTO 

Quality-Protocol

LCP_OPTION_MAGIC_NUMBER 

Magic-Number

LCP_OPTION_PROTO_COMPRESS 

Protocol-Field-Compression

LCP_OPTION_ADDR_CTRL_COMPRESS 

Address-and-Control-Field-Compression

◆ ppp_flags

enum ppp_flags

#include <include/net/ppp.h>

Enumerator
PPP_CARRIER_UP 

◆ ppp_packet_type

#include <include/net/ppp.h>

PPP protocol operations from RFC 1661

Enumerator
PPP_CONFIGURE_REQ 
PPP_CONFIGURE_ACK 
PPP_CONFIGURE_NACK 
PPP_CONFIGURE_REJ 
PPP_TERMINATE_REQ 
PPP_TERMINATE_ACK 
PPP_CODE_REJ 
PPP_PROTOCOL_REJ 
PPP_ECHO_REQ 
PPP_ECHO_REPLY 
PPP_DISCARD_REQ 

◆ ppp_phase

enum ppp_phase

#include <include/net/ppp.h>

PPP phases

Enumerator
PPP_DEAD 

Physical-layer not ready

PPP_ESTABLISH 

Link is being established

PPP_AUTH 

Link authentication with peer

PPP_NETWORK 

Network connection establishment

PPP_RUNNING 

Network running

PPP_TERMINATE 

Link termination

◆ ppp_protocol_type

#include <include/net/ppp.h>

PPP protocol types. See https://www.iana.org/assignments/ppp-numbers/ppp-numbers.xhtml for details.

Enumerator
PPP_IP 

RFC 1332

PPP_IPV6 

RFC 5072

PPP_IPCP 

RFC 1332

PPP_ECP 

RFC 1968

PPP_IPV6CP 

RFC 5072

PPP_CCP 

RFC 1962

PPP_LCP 

RFC 1661

PPP_PAP 

RFC 1334

PPP_CHAP 

RFC 1334

PPP_EAP 

RFC 2284

◆ ppp_state

enum ppp_state

#include <include/net/ppp.h>

PPP states, RFC 1661 ch. 4.2

Enumerator
PPP_INITIAL 
PPP_STARTING 
PPP_CLOSED 
PPP_STOPPED 
PPP_CLOSING 
PPP_STOPPING 
PPP_REQUEST_SENT 
PPP_ACK_RECEIVED 
PPP_ACK_SENT 
PPP_OPENED 

Function Documentation

◆ net_ppp_carrier_off()

void net_ppp_carrier_off ( struct net_if iface)

#include <include/net/ppp.h>

Inform PPP L2 driver that carrier was lost. This happens when cable is disconnected etc.

Parameters
ifaceNetwork interface

◆ net_ppp_carrier_on()

void net_ppp_carrier_on ( struct net_if iface)

#include <include/net/ppp.h>

Inform PPP L2 driver that carrier is detected. This happens when cable is connected etc.

Parameters
ifaceNetwork interface

◆ net_ppp_context_get()

static struct ppp_context * net_ppp_context_get ( int  idx)
inlinestatic

#include <include/net/ppp.h>

Get PPP context information. This is only used by net-shell to print information about PPP.

Parameters
idxPPP network interface index
Returns
PPP context or NULL if idx is invalid.

◆ net_ppp_init()

void net_ppp_init ( struct net_if iface)

#include <include/net/ppp.h>

Initialize PPP L2 stack for a given interface.

Parameters
ifaceA valid pointer to a network interface

◆ net_ppp_ping()

static int net_ppp_ping ( int  idx,
int32_t  timeout 
)
inlinestatic

#include <include/net/ppp.h>

Send PPP Echo-Request to peer. We expect to receive Echo-Reply back.

Parameters
idxPPP network interface index
timeoutAmount of time to wait Echo-Reply. The value is in milliseconds.
Returns
0 if Echo-Reply was received, < 0 if there is a timeout or network index is not a valid PPP network index.

◆ ppp_mgmt_raise_carrier_off_event()

static void ppp_mgmt_raise_carrier_off_event ( struct net_if iface)
inlinestatic

#include <include/net/ppp.h>

Raise CARRIER_OFF event when PPP is disconnected.

Parameters
ifacePPP network interface.

◆ ppp_mgmt_raise_carrier_on_event()

static void ppp_mgmt_raise_carrier_on_event ( struct net_if iface)
inlinestatic

#include <include/net/ppp.h>

Raise CARRIER_ON event when PPP is connected.

Parameters
ifacePPP network interface.

◆ ppp_mgmt_raise_phase_dead_event()

static void ppp_mgmt_raise_phase_dead_event ( struct net_if iface)
inlinestatic

#include <include/net/ppp.h>

Raise PHASE_DEAD event when PPP reaching DEAD phase.

Parameters
ifacePPP network interface.

◆ ppp_mgmt_raise_phase_running_event()

static void ppp_mgmt_raise_phase_running_event ( struct net_if iface)
inlinestatic

#include <include/net/ppp.h>

Raise PHASE_RUNNING event when PPP reaching RUNNING phase.

Parameters
ifacePPP network interface.