ipcp.h File Reference

IPCP (PPP Internet Protocol Control Protocol) More...

#include "core/net.h"
#include "ppp/ppp.h"

Go to the source code of this file.

Macros

#define IPCP_DEFAULT_SUBNET_MASK   IPV4_ADDR(255, 255, 255, 255)
 

Enumerations

enum  IpcpOptionType {
  IPCP_OPTION_IP_ADDRESSES = 1, IPCP_OPTION_IP_COMP_PROTOCOL = 2, IPCP_OPTION_IP_ADDRESS = 3, IPCP_OPTION_PRIMARY_DNS = 129,
  IPCP_OPTION_PRIMARY_NBNS = 130, IPCP_OPTION_SECONDARY_DNS = 131, IPCP_OPTION_SECONDARY_NBNS = 132
}
 IPCP option types. More...
 

Functions

error_t ipcpOpen (PppContext *context)
 IPCP Open event. More...
 
error_t ipcpClose (PppContext *context)
 IPCP Close event. More...
 
void ipcpTick (PppContext *context)
 IPCP timer handler. More...
 
void ipcpProcessPacket (PppContext *context, const PppPacket *packet, size_t length)
 Process an incoming IPCP packet. More...
 
error_t ipcpProcessConfigureReq (PppContext *context, const PppConfigurePacket *configureReqPacket)
 Process Configure-Request packet. More...
 
error_t ipcpProcessConfigureAck (PppContext *context, const PppConfigurePacket *configureAckPacket)
 Process Configure-Ack packet. More...
 
error_t ipcpProcessConfigureNak (PppContext *context, const PppConfigurePacket *configureNakPacket)
 Process Configure-Nak packet. More...
 
error_t ipcpProcessConfigureReject (PppContext *context, const PppConfigurePacket *configureRejPacket)
 Process Configure-Reject packet. More...
 
error_t ipcpProcessTerminateReq (PppContext *context, const PppTerminatePacket *terminateReqPacket)
 Process Terminate-Request packet. More...
 
error_t ipcpProcessTerminateAck (PppContext *context, const PppTerminatePacket *terminateAckPacket)
 Process Terminate-Ack packet. More...
 
error_t ipcpProcessCodeRej (PppContext *context, const PppCodeRejPacket *codeRejPacket)
 Process Code-Reject packet. More...
 
error_t ipcpProcessUnknownCode (PppContext *context, const PppPacket *packet)
 Process packet with unknown code. More...
 
void ipcpThisLayerUp (PppContext *context)
 This-Layer-Up callback function. More...
 
void ipcpThisLayerDown (PppContext *context)
 This-Layer-Down callback function. More...
 
void ipcpThisLayerStarted (PppContext *context)
 This-Layer-Started callback function. More...
 
void ipcpThisLayerFinished (PppContext *context)
 This-Layer-Finished callback function. More...
 
void ipcpInitRestartCount (PppContext *context, uint_t value)
 Initialize-Restart-Count callback function. More...
 
void ipcpZeroRestartCount (PppContext *context)
 Zero-Restart-Count callback function. More...
 
error_t ipcpSendConfigureReq (PppContext *context)
 Send-Configure-Request callback function. More...
 
error_t ipcpSendConfigureAck (PppContext *context, const PppConfigurePacket *configureReqPacket)
 Send-Configure-Ack callback function. More...
 
error_t ipcpSendConfigureNak (PppContext *context, const PppConfigurePacket *configureReqPacket)
 Send-Configure-Nak callback function. More...
 
error_t ipcpSendConfigureRej (PppContext *context, const PppConfigurePacket *configureReqPacket)
 Send-Configure-Reject callback function. More...
 
error_t ipcpSendTerminateReq (PppContext *context)
 Send-Terminate-Request callback function. More...
 
error_t ipcpSendTerminateAck (PppContext *context, const PppTerminatePacket *terminateReqPacket)
 Send-Terminate-Ack callback function. More...
 
error_t ipcpSendCodeRej (PppContext *context, const PppPacket *packet)
 Send-Code-Reject callback function. More...
 
error_t ipcpParseOption (PppContext *context, PppOption *option, size_t inPacketLen, PppConfigurePacket *outPacket)
 Parse IPCP configuration option. More...
 
error_t ipcpParseIpAddressOption (PppContext *context, IpcpIpAddressOption *option, PppConfigurePacket *outPacket)
 Parse IP-Address option. More...
 

Variables

typedef __packed_struct
 IP-Addresses option. More...
 
uint8_t length
 
Ipv4Addr srcIpAddr
 
Ipv4Addr destIpAddr
 
 IpcpIpAddressesOption
 
uint16_t protocol
 
uint8_t data []
 
 IpcpIpCompProtocolOption
 
Ipv4Addr ipAddr
 
 IpcpIpAddressOption
 
 IpcpPrimaryDnsOption
 
 IpcpPrimaryNbnsOption
 
 IpcpSecondaryDnsOption
 
 IpcpSecondaryNbnsOption
 

Detailed Description

IPCP (PPP Internet Protocol Control Protocol)

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file ipcp.h.

Macro Definition Documentation

◆ IPCP_DEFAULT_SUBNET_MASK

#define IPCP_DEFAULT_SUBNET_MASK   IPV4_ADDR(255, 255, 255, 255)

Definition at line 39 of file ipcp.h.

Enumeration Type Documentation

◆ IpcpOptionType

IPCP option types.

Enumerator
IPCP_OPTION_IP_ADDRESSES 

IP-Addresses.

IPCP_OPTION_IP_COMP_PROTOCOL 

IP-Compression-Protocol.

IPCP_OPTION_IP_ADDRESS 

IP-Address.

IPCP_OPTION_PRIMARY_DNS 

Primary-DNS-Server-Address.

IPCP_OPTION_PRIMARY_NBNS 

Primary-NBNS-Server-Address.

IPCP_OPTION_SECONDARY_DNS 

Secondary-DNS-Server-Address.

IPCP_OPTION_SECONDARY_NBNS 

Secondary-NBNS-Server-Address.

Definition at line 51 of file ipcp.h.

Function Documentation

◆ ipcpClose()

error_t ipcpClose ( PppContext context)

IPCP Close event.

Parameters
[in]contextPPP context
Returns
Error code

Definition at line 97 of file ipcp.c.

◆ ipcpInitRestartCount()

void ipcpInitRestartCount ( PppContext context,
uint_t  value 
)

Initialize-Restart-Count callback function.

Parameters
[in]contextPPP context
[in]valueRestart counter value

Definition at line 715 of file ipcp.c.

◆ ipcpOpen()

error_t ipcpOpen ( PppContext context)

IPCP Open event.

Parameters
[in]contextPPP context
Returns
Error code

Definition at line 76 of file ipcp.c.

◆ ipcpParseIpAddressOption()

error_t ipcpParseIpAddressOption ( PppContext context,
IpcpIpAddressOption option,
PppConfigurePacket outPacket 
)

Parse IP-Address option.

Parameters
[in]contextPPP context
[in]optionOption to be checked
[out]outPacketPointer to the Configure-Nak or Configure-Reject packet
Returns
Error code

Definition at line 1036 of file ipcp.c.

◆ ipcpParseOption()

error_t ipcpParseOption ( PppContext context,
PppOption option,
size_t  inPacketLen,
PppConfigurePacket outPacket 
)

Parse IPCP configuration option.

Parameters
[in]contextPPP context
[in]optionOption to be checked
[in]inPacketLenRemaining bytes to process in the incoming packet
[out]outPacketPointer to the Configure-Ack, Nak or Reject packet
Returns
Error code

Definition at line 984 of file ipcp.c.

◆ ipcpProcessCodeRej()

error_t ipcpProcessCodeRej ( PppContext context,
const PppCodeRejPacket codeRejPacket 
)

Process Code-Reject packet.

Parameters
[in]contextPPP context
[in]codeRejPacketPacket received from the peer
Returns
Error code

Definition at line 549 of file ipcp.c.

◆ ipcpProcessConfigureAck()

error_t ipcpProcessConfigureAck ( PppContext context,
const PppConfigurePacket configureAckPacket 
)

Process Configure-Ack packet.

Parameters
[in]contextPPP context
[in]configureAckPacketPacket received from the peer
Returns
Error code

Definition at line 321 of file ipcp.c.

◆ ipcpProcessConfigureNak()

error_t ipcpProcessConfigureNak ( PppContext context,
const PppConfigurePacket configureNakPacket 
)

Process Configure-Nak packet.

Parameters
[in]contextPPP context
[in]configureNakPacketPacket received from the peer
Returns
Error code

Definition at line 347 of file ipcp.c.

◆ ipcpProcessConfigureReject()

error_t ipcpProcessConfigureReject ( PppContext context,
const PppConfigurePacket configureRejPacket 
)

Process Configure-Reject packet.

Parameters
[in]contextPPP context
[in]configureRejPacketPacket received from the peer
Returns
Error code

Definition at line 436 of file ipcp.c.

◆ ipcpProcessConfigureReq()

error_t ipcpProcessConfigureReq ( PppContext context,
const PppConfigurePacket configureReqPacket 
)

Process Configure-Request packet.

Parameters
[in]contextPPP context
[in]configureReqPacketPacket received from the peer
Returns
Error code

Definition at line 225 of file ipcp.c.

◆ ipcpProcessPacket()

void ipcpProcessPacket ( PppContext context,
const PppPacket packet,
size_t  length 
)

Process an incoming IPCP packet.

Parameters
[in]contextPPP context
[in]packetIPCP packet received from the peer
[in]lengthLength of the packet, in bytes

Definition at line 151 of file ipcp.c.

◆ ipcpProcessTerminateAck()

error_t ipcpProcessTerminateAck ( PppContext context,
const PppTerminatePacket terminateAckPacket 
)

Process Terminate-Ack packet.

Parameters
[in]contextPPP context
[in]terminateAckPacketPacket received from the peer
Returns
Error code

Definition at line 526 of file ipcp.c.

◆ ipcpProcessTerminateReq()

error_t ipcpProcessTerminateReq ( PppContext context,
const PppTerminatePacket terminateReqPacket 
)

Process Terminate-Request packet.

Parameters
[in]contextPPP context
[in]terminateReqPacketPacket received from the peer
Returns
Error code

Definition at line 504 of file ipcp.c.

◆ ipcpProcessUnknownCode()

error_t ipcpProcessUnknownCode ( PppContext context,
const PppPacket packet 
)

Process packet with unknown code.

Parameters
[in]contextPPP context
[in]packetUn-interpretable packet received from the peer
Returns
Error code

Definition at line 596 of file ipcp.c.

◆ ipcpSendCodeRej()

error_t ipcpSendCodeRej ( PppContext context,
const PppPacket packet 
)

Send-Code-Reject callback function.

Parameters
[in]contextPPP context
[in]packetUn-interpretable packet received from the peer
Returns
Error code

Definition at line 962 of file ipcp.c.

◆ ipcpSendConfigureAck()

error_t ipcpSendConfigureAck ( PppContext context,
const PppConfigurePacket configureReqPacket 
)

Send-Configure-Ack callback function.

Parameters
[in]contextPPP context
[in]configureReqPacketConfigure-Request packet received from the peer
Returns
Error code

Definition at line 840 of file ipcp.c.

◆ ipcpSendConfigureNak()

error_t ipcpSendConfigureNak ( PppContext context,
const PppConfigurePacket configureReqPacket 
)

Send-Configure-Nak callback function.

Parameters
[in]contextPPP context
[in]configureReqPacketConfigure-Request packet received from the peer
Returns
Error code

Definition at line 859 of file ipcp.c.

◆ ipcpSendConfigureRej()

error_t ipcpSendConfigureRej ( PppContext context,
const PppConfigurePacket configureReqPacket 
)

Send-Configure-Reject callback function.

Parameters
[in]contextPPP context
[in]configureReqPacketConfigure-Request packet received from the peer
Returns
Error code

Definition at line 878 of file ipcp.c.

◆ ipcpSendConfigureReq()

error_t ipcpSendConfigureReq ( PppContext context)

Send-Configure-Request callback function.

Parameters
[in]contextPPP context
Returns
Error code

Definition at line 751 of file ipcp.c.

◆ ipcpSendTerminateAck()

error_t ipcpSendTerminateAck ( PppContext context,
const PppTerminatePacket terminateReqPacket 
)

Send-Terminate-Ack callback function.

Parameters
[in]contextPPP context
[in]terminateReqPacketTerminate-Request packet received from the peer
Returns
Error code

Definition at line 928 of file ipcp.c.

◆ ipcpSendTerminateReq()

error_t ipcpSendTerminateReq ( PppContext context)

Send-Terminate-Request callback function.

Parameters
[in]contextPPP context
Returns
Error code

Definition at line 896 of file ipcp.c.

◆ ipcpThisLayerDown()

void ipcpThisLayerDown ( PppContext context)

This-Layer-Down callback function.

Parameters
[in]contextPPP context

Definition at line 663 of file ipcp.c.

◆ ipcpThisLayerFinished()

void ipcpThisLayerFinished ( PppContext context)

This-Layer-Finished callback function.

Parameters
[in]contextPPP context

Definition at line 702 of file ipcp.c.

◆ ipcpThisLayerStarted()

void ipcpThisLayerStarted ( PppContext context)

This-Layer-Started callback function.

Parameters
[in]contextPPP context

Definition at line 690 of file ipcp.c.

◆ ipcpThisLayerUp()

void ipcpThisLayerUp ( PppContext context)

This-Layer-Up callback function.

Parameters
[in]contextPPP context

Definition at line 616 of file ipcp.c.

◆ ipcpTick()

void ipcpTick ( PppContext context)

IPCP timer handler.

This routine must be periodically called by the TCP/IP stack to manage retransmissions

Parameters
[in]contextPPP context

Definition at line 121 of file ipcp.c.

◆ ipcpZeroRestartCount()

void ipcpZeroRestartCount ( PppContext context)

Zero-Restart-Count callback function.

Parameters
[in]contextPPP context

Definition at line 730 of file ipcp.c.

Variable Documentation

◆ __packed_struct

typedef __packed_struct
Initial value:
{
uint8_t type

IP-Addresses option.

Secondary-NBNS-Server-Address option.

Secondary-DNS-Server-Address option.

Primary-NBNS-Server-Address option.

Primary-DNS-Server-Address option.

IP-Address option.

IP-Compression-Protocol option.

Definition at line 75 of file ipcp.h.

◆ data

uint8_t data[]

Definition at line 93 of file ipcp.h.

◆ destIpAddr

Ipv4Addr destIpAddr

Definition at line 80 of file ipcp.h.

◆ ipAddr

Ipv4Addr ipAddr

Definition at line 105 of file ipcp.h.

◆ IpcpIpAddressesOption

IpcpIpAddressesOption

Definition at line 81 of file ipcp.h.

◆ IpcpIpAddressOption

IpcpIpAddressOption

Definition at line 106 of file ipcp.h.

◆ IpcpIpCompProtocolOption

IpcpIpCompProtocolOption

Definition at line 94 of file ipcp.h.

◆ IpcpPrimaryDnsOption

IpcpPrimaryDnsOption

Definition at line 118 of file ipcp.h.

◆ IpcpPrimaryNbnsOption

IpcpPrimaryNbnsOption

Definition at line 130 of file ipcp.h.

◆ IpcpSecondaryDnsOption

IpcpSecondaryDnsOption

Definition at line 142 of file ipcp.h.

◆ IpcpSecondaryNbnsOption

IpcpSecondaryNbnsOption

Definition at line 154 of file ipcp.h.

◆ length

uint8_t length

Definition at line 78 of file ipcp.h.

◆ protocol

uint16_t protocol

Definition at line 92 of file ipcp.h.

◆ srcIpAddr

Ipv4Addr srcIpAddr

Definition at line 79 of file ipcp.h.

uint8_t type
Definition: coap_common.h:176