8#ifndef ZEPHYR_INCLUDE_NET_PPP_H_
9#define ZEPHYR_INCLUDE_NET_PPP_H_
28#define PPP_MRU CONFIG_NET_PPP_MTU_MRU
31#define PPP_MTU PPP_MRU
34#define PPP_MAX_TERMINATE_REASON_LEN 32
37#define PPP_INTERFACE_IDENTIFIER_LEN 8
56#if defined(CONFIG_NET_STATISTICS_PPP)
68BUILD_ASSERT(offsetof(
struct ppp_api, iface_api) == 0);
216 size_t user_data_len);
219struct ppp_my_option_info;
289 const struct ppp_my_option_info *
info;
332#define PPP_MY_OPTION_ACKED BIT(0)
333#define PPP_MY_OPTION_REJECTED BIT(1)
353#if defined(CONFIG_NET_L2_PPP_OPTION_MRU)
354#define LCP_NUM_MY_OPTIONS 1
364#define IPCP_NUM_MY_OPTIONS 3
371#define IPV6CP_NUM_MY_OPTIONS 1
407#if defined(CONFIG_NET_L2_PPP_OPTION_MRU)
412#if defined(CONFIG_NET_IPV4)
428#if defined(CONFIG_NET_IPV6)
444#if defined(CONFIG_NET_L2_PPP_PAP)
451#if defined(CONFIG_NET_SHELL)
462 size_t user_data_len;
466 struct k_sem wait_echo_reply;
552#define PPP_L2_CTX_TYPE struct ppp_context
554#define _NET_PPP_LAYER NET_MGMT_LAYER_L2
555#define _NET_PPP_CODE 0x209
556#define _NET_PPP_BASE (NET_MGMT_IFACE_BIT | \
557 NET_MGMT_LAYER(_NET_PPP_LAYER) | \
558 NET_MGMT_LAYER_CODE(_NET_PPP_CODE))
559#define _NET_PPP_EVENT (_NET_PPP_BASE | NET_MGMT_EVENT_BIT)
561enum net_event_ppp_cmd {
562 NET_EVENT_PPP_CMD_CARRIER_ON = 1,
563 NET_EVENT_PPP_CMD_CARRIER_OFF,
564 NET_EVENT_PPP_CMD_PHASE_RUNNING,
565 NET_EVENT_PPP_CMD_PHASE_DEAD,
568#define NET_EVENT_PPP_CARRIER_ON \
569 (_NET_PPP_EVENT | NET_EVENT_PPP_CMD_CARRIER_ON)
571#define NET_EVENT_PPP_CARRIER_OFF \
572 (_NET_PPP_EVENT | NET_EVENT_PPP_CMD_CARRIER_OFF)
574#define NET_EVENT_PPP_PHASE_RUNNING \
575 (_NET_PPP_EVENT | NET_EVENT_PPP_CMD_PHASE_RUNNING)
577#define NET_EVENT_PPP_PHASE_DEAD \
578 (_NET_PPP_EVENT | NET_EVENT_PPP_CMD_PHASE_DEAD)
589#if defined(CONFIG_NET_L2_PPP_MGMT)
603#if defined(CONFIG_NET_L2_PPP_MGMT)
617#if defined(CONFIG_NET_L2_PPP_MGMT)
631#if defined(CONFIG_NET_L2_PPP_MGMT)
650#if defined(CONFIG_NET_L2_PPP)
670#if defined(CONFIG_NET_L2_PPP) && defined(CONFIG_NET_SHELL)
int atomic_t
Definition: atomic.h:21
ZTEST_BMEM int timeout
Definition: main.c:31
void
Definition: eswifi_shell.c:15
net_verdict
Net Verdict.
Definition: net_core.h:97
net_l2_flags
Definition: net_l2.h:33
ipcp_option_type
Definition: ppp.h:170
static void ppp_mgmt_raise_carrier_on_event(struct net_if *iface)
Raise CARRIER_ON event when PPP is connected.
Definition: ppp.h:592
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.
Definition: ppp.h:215
ppp_phase
Definition: ppp.h:91
void net_ppp_carrier_on(struct net_if *iface)
Inform PPP L2 driver that carrier is detected. This happens when cable is connected etc.
#define PPP_MAX_TERMINATE_REASON_LEN
Definition: ppp.h:34
ppp_packet_type
Definition: ppp.h:125
ppp_flags
Definition: ppp.h:373
static struct ppp_context * net_ppp_context_get(int idx)
Get PPP context information. This is only used by net-shell to print information about PPP.
Definition: ppp.h:673
#define IPV6CP_NUM_MY_OPTIONS
Definition: ppp.h:371
ppp_state
Definition: ppp.h:109
static void ppp_mgmt_raise_phase_running_event(struct net_if *iface)
Raise PHASE_RUNNING event when PPP reaching RUNNING phase.
Definition: ppp.h:620
void net_ppp_carrier_off(struct net_if *iface)
Inform PPP L2 driver that carrier was lost. This happens when cable is disconnected etc.
ppp_protocol_type
Definition: ppp.h:75
static int net_ppp_ping(int idx, int32_t timeout)
Send PPP Echo-Request to peer. We expect to receive Echo-Reply back.
Definition: ppp.h:653
void net_ppp_init(struct net_if *iface)
Initialize PPP L2 stack for a given interface.
#define PPP_INTERFACE_IDENTIFIER_LEN
Definition: ppp.h:37
lcp_option_type
Definition: ppp.h:142
static void ppp_mgmt_raise_phase_dead_event(struct net_if *iface)
Raise PHASE_DEAD event when PPP reaching DEAD phase.
Definition: ppp.h:634
static void ppp_mgmt_raise_carrier_off_event(struct net_if *iface)
Raise CARRIER_OFF event when PPP is disconnected.
Definition: ppp.h:606
#define IPCP_NUM_MY_OPTIONS
Definition: ppp.h:364
ipv6cp_option_type
Definition: ppp.h:200
@ IPCP_OPTION_IP_ADDRESS
Definition: ppp.h:180
@ IPCP_OPTION_DNS2
Definition: ppp.h:191
@ IPCP_OPTION_IP_COMP_PROTO
Definition: ppp.h:177
@ IPCP_OPTION_NBNS2
Definition: ppp.h:194
@ IPCP_OPTION_RESERVED
Definition: ppp.h:171
@ IPCP_OPTION_NBNS1
Definition: ppp.h:188
@ IPCP_OPTION_IP_ADDRESSES
Definition: ppp.h:174
@ IPCP_OPTION_DNS1
Definition: ppp.h:185
@ PPP_AUTH
Definition: ppp.h:97
@ PPP_RUNNING
Definition: ppp.h:101
@ PPP_NETWORK
Definition: ppp.h:99
@ PPP_ESTABLISH
Definition: ppp.h:95
@ PPP_DEAD
Definition: ppp.h:93
@ PPP_TERMINATE
Definition: ppp.h:103
@ PPP_CONFIGURE_NACK
Definition: ppp.h:128
@ PPP_TERMINATE_REQ
Definition: ppp.h:130
@ PPP_CODE_REJ
Definition: ppp.h:132
@ PPP_ECHO_REPLY
Definition: ppp.h:135
@ PPP_TERMINATE_ACK
Definition: ppp.h:131
@ PPP_CONFIGURE_ACK
Definition: ppp.h:127
@ PPP_DISCARD_REQ
Definition: ppp.h:136
@ PPP_CONFIGURE_REQ
Definition: ppp.h:126
@ PPP_CONFIGURE_REJ
Definition: ppp.h:129
@ PPP_PROTOCOL_REJ
Definition: ppp.h:133
@ PPP_ECHO_REQ
Definition: ppp.h:134
@ PPP_CARRIER_UP
Definition: ppp.h:374
@ PPP_CLOSED
Definition: ppp.h:112
@ PPP_CLOSING
Definition: ppp.h:114
@ PPP_OPENED
Definition: ppp.h:119
@ PPP_REQUEST_SENT
Definition: ppp.h:116
@ PPP_STARTING
Definition: ppp.h:111
@ PPP_STOPPED
Definition: ppp.h:113
@ PPP_INITIAL
Definition: ppp.h:110
@ PPP_STOPPING
Definition: ppp.h:115
@ PPP_ACK_RECEIVED
Definition: ppp.h:117
@ PPP_ACK_SENT
Definition: ppp.h:118
@ PPP_IPV6
Definition: ppp.h:77
@ PPP_IP
Definition: ppp.h:76
@ PPP_CHAP
Definition: ppp.h:84
@ PPP_LCP
Definition: ppp.h:82
@ PPP_IPCP
Definition: ppp.h:78
@ PPP_ECP
Definition: ppp.h:79
@ PPP_CCP
Definition: ppp.h:81
@ PPP_EAP
Definition: ppp.h:85
@ PPP_IPV6CP
Definition: ppp.h:80
@ PPP_PAP
Definition: ppp.h:83
@ LCP_OPTION_ASYNC_CTRL_CHAR_MAP
Definition: ppp.h:149
@ LCP_OPTION_ADDR_CTRL_COMPRESS
Definition: ppp.h:164
@ LCP_OPTION_QUALITY_PROTO
Definition: ppp.h:155
@ LCP_OPTION_MAGIC_NUMBER
Definition: ppp.h:158
@ LCP_OPTION_RESERVED
Definition: ppp.h:143
@ LCP_OPTION_PROTO_COMPRESS
Definition: ppp.h:161
@ LCP_OPTION_MRU
Definition: ppp.h:146
@ LCP_OPTION_AUTH_PROTO
Definition: ppp.h:152
@ IPV6CP_OPTION_INTERFACE_IDENTIFIER
Definition: ppp.h:204
@ IPV6CP_OPTION_RESERVED
Definition: ppp.h:201
#define ENOTSUP
Definition: errno.h:115
Public API for network interface.
Network Management API public header.
Network packet buffer descriptor API.
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__INT32_TYPE__ int32_t
Definition: stdint.h:44
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
Runtime device structure (in ROM) per driver instance.
Definition: device.h:367
struct in_addr address
Definition: ppp.h:359
struct in_addr dns2_address
Definition: ppp.h:361
struct in_addr dns1_address
Definition: ppp.h:360
uint8_t iid[8]
Definition: ppp.h:368
A structure used to submit work after a delay.
Definition: kernel.h:3651
A structure used to submit work.
Definition: kernel.h:3623
uint16_t mru
Definition: ppp.h:347
uint32_t async_map
Definition: ppp.h:344
uint16_t auth_proto
Definition: ppp.h:350
uint32_t magic
Definition: ppp.h:341
Network Interface structure.
Definition: net_if.h:468
Network packet.
Definition: net_pkt.h:62
All PPP specific statistics.
Definition: net_stats.h:464
int(* stop)(const struct device *dev)
Definition: ppp.h:51
int(* send)(const struct device *dev, struct net_pkt *pkt)
Definition: ppp.h:54
int(* start)(const struct device *dev)
Definition: ppp.h:48
struct net_if_api iface_api
Definition: ppp.h:45
enum net_l2_flags ppp_l2_flags
Definition: ppp.h:483
int network_protos_open
Definition: ppp.h:486
struct ppp_context::@178 lcp
struct lcp_options my_options
Definition: ppp.h:400
struct net_if * iface
Definition: ppp.h:477
uint16_t is_ready_to_serve
Definition: ppp.h:495
uint32_t magic
Definition: ppp.h:406
uint16_t is_pap_up
Definition: ppp.h:519
struct k_work_delayable startup
Definition: ppp.h:385
uint16_t is_net_carrier_up
Definition: ppp.h:492
struct k_work carrier_work
Definition: ppp.h:393
enum ppp_phase phase
Definition: ppp.h:480
atomic_t flags
Definition: ppp.h:382
uint16_t is_ipv6cp_up
Definition: ppp.h:513
uint16_t is_ipcp_open
Definition: ppp.h:510
uint16_t is_enabled
Definition: ppp.h:498
uint16_t is_pap_open
Definition: ppp.h:522
struct lcp_options peer_options
Definition: ppp.h:403
uint16_t is_ipcp_up
Definition: ppp.h:507
uint16_t is_startup_pending
Definition: ppp.h:501
int network_protos_up
Definition: ppp.h:489
uint16_t is_ipv6cp_open
Definition: ppp.h:516
struct ppp_fsm fsm
Definition: ppp.h:397
uint16_t is_enable_done
Definition: ppp.h:504
char terminate_reason[32]
Definition: ppp.h:311
int(* config_info_len)(struct ppp_fsm *fsm)
Definition: ppp.h:238
uint32_t nack_loops
Definition: ppp.h:305
const struct ppp_my_option_info * info
Definition: ppp.h:289
uint16_t protocol
Definition: ppp.h:314
void(* down)(struct ppp_fsm *fsm)
Definition: ppp.h:264
uint32_t retransmits
Definition: ppp.h:302
uint8_t ack_received
Definition: ppp.h:329
int(* config_info_ack)(struct ppp_fsm *fsm, struct net_pkt *pkt, uint16_t length)
Definition: ppp.h:230
uint32_t flags
Definition: ppp.h:299
uint32_t recv_nack_loops
Definition: ppp.h:308
struct ppp_fsm::@177 my_options
struct ppp_my_option_data * data
Definition: ppp.h:292
size_t count
Definition: ppp.h:295
uint8_t id
Definition: ppp.h:323
uint8_t req_id
Definition: ppp.h:326
int(* config_info_rej)(struct ppp_fsm *fsm, struct net_pkt *pkt, uint16_t length)
Definition: ppp.h:253
const char * name
Definition: ppp.h:320
void(* up)(struct ppp_fsm *fsm)
Definition: ppp.h:261
enum net_verdict(* proto_extension)(struct ppp_fsm *fsm, enum ppp_packet_type code, uint8_t id, struct net_pkt *pkt)
Definition: ppp.h:281
int(* config_info_req)(struct ppp_fsm *fsm, struct net_pkt *pkt, uint16_t length, struct net_pkt *ret_pkt)
Definition: ppp.h:247
enum ppp_state state
Definition: ppp.h:317
int(* config_info_nack)(struct ppp_fsm *fsm, struct net_pkt *pkt, uint16_t length, bool rejected)
Definition: ppp.h:241
void(* starting)(struct ppp_fsm *fsm)
Definition: ppp.h:267
struct k_work_delayable timer
Definition: ppp.h:226
void(* retransmit)(struct ppp_fsm *fsm)
Definition: ppp.h:276
void(* proto_reject)(struct ppp_fsm *fsm)
Definition: ppp.h:273
void(* finished)(struct ppp_fsm *fsm)
Definition: ppp.h:270
void(* config_info_reset)(struct ppp_fsm *fsm)
Definition: ppp.h:258
uint32_t flags
Definition: ppp.h:336
Shell instance internals.
Definition: shell.h:720
static const intptr_t user_data[5]
Definition: main.c:590