pap.h File Reference

PAP (Password Authentication Protocol) More...

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

Go to the source code of this file.

Data Structures

struct  PapFsm
 PAP finite state machine. More...
 

Macros

#define PAP_SUPPORT   ENABLED
 
#define PAP_RESTART_TIMER   3000
 
#define PAP_MAX_REQUESTS   5
 

Enumerations

enum  PapState {
  PAP_STATE_0_INITIAL = 0, PAP_STATE_1_STARTED = 1, PAP_STATE_2_REQ_SENT = 2, PAP_STATE_3_REQ_RCVD = 3,
  PAP_STATE_4_ACK_SENT = 4, PAP_STATE_5_ACK_RCVD = 5, PAP_STATE_6_NAK_SENT = 6, PAP_STATE_7_NAK_RCVD = 7
}
 PAP states. More...
 
enum  PapCode { PAP_CODE_AUTH_REQ = 1, PAP_CODE_AUTH_ACK = 2, PAP_CODE_AUTH_NAK = 3 }
 Code field values. More...
 

Functions

error_t papStartAuth (PppContext *context)
 Start PAP authentication. More...
 
error_t papAbortAuth (PppContext *context)
 Abort PAP authentication. More...
 
void papTick (PppContext *context)
 PAP timer handler. More...
 
void papProcessPacket (PppContext *context, const PppPacket *packet, size_t length)
 Process an incoming PAP packet. More...
 
error_t papProcessAuthReq (PppContext *context, const PapAuthReqPacket *authReqPacket, size_t length)
 Process Authenticate-Request packet. More...
 
error_t papProcessAuthAck (PppContext *context, const PapAuthAckPacket *authAckPacket, size_t length)
 Process Authenticate-Ack packet. More...
 
error_t papProcessAuthNak (PppContext *context, const PapAuthNakPacket *authNakPacket, size_t length)
 Process Authenticate-Nak packet. More...
 
error_t papSendAuthReq (PppContext *context)
 Send Authenticate-Request packet. More...
 
error_t papSendAuthAck (PppContext *context, uint8_t identifier)
 Send Authenticate-Ack packet. More...
 
error_t papSendAuthNak (PppContext *context, uint8_t identifier)
 Send Authenticate-Nak packet. More...
 
bool_t papCheckPassword (PppContext *context, const char_t *password)
 Password verification. More...
 

Variables

typedef __packed_struct
 Authenticate-Request packet. More...
 
uint8_t identifier
 
uint16_t length
 
uint8_t peerIdLength
 
uint8_t peerId []
 
 PapAuthReqPacket
 
uint8_t msgLength
 
uint8_t message []
 
 PapAuthAckPacket
 
 PapAuthNakPacket
 

Detailed Description

PAP (Password Authentication 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 pap.h.

Macro Definition Documentation

◆ PAP_MAX_REQUESTS

#define PAP_MAX_REQUESTS   5

Definition at line 54 of file pap.h.

◆ PAP_RESTART_TIMER

#define PAP_RESTART_TIMER   3000

Definition at line 47 of file pap.h.

◆ PAP_SUPPORT

#define PAP_SUPPORT   ENABLED

Definition at line 40 of file pap.h.

Enumeration Type Documentation

◆ PapCode

enum PapCode

Code field values.

Enumerator
PAP_CODE_AUTH_REQ 

Authenticate-Request.

PAP_CODE_AUTH_ACK 

Authenticate-Ack.

PAP_CODE_AUTH_NAK 

Authenticate-Nak.

Definition at line 86 of file pap.h.

◆ PapState

enum PapState

PAP states.

Enumerator
PAP_STATE_0_INITIAL 
PAP_STATE_1_STARTED 
PAP_STATE_2_REQ_SENT 
PAP_STATE_3_REQ_RCVD 
PAP_STATE_4_ACK_SENT 
PAP_STATE_5_ACK_RCVD 
PAP_STATE_6_NAK_SENT 
PAP_STATE_7_NAK_RCVD 

Definition at line 69 of file pap.h.

Function Documentation

◆ papAbortAuth()

error_t papAbortAuth ( PppContext context)

Abort PAP authentication.

Parameters
[in]contextPPP context
Returns
Error code

Definition at line 87 of file pap.c.

◆ papCheckPassword()

bool_t papCheckPassword ( PppContext context,
const char_t password 
)

Password verification.

Parameters
[in]contextPPP context
[in]passwordNULL-terminated string containing the password to be checked
Returns
TRUE if the password is valid, else FALSE

Definition at line 605 of file pap.c.

◆ papProcessAuthAck()

error_t papProcessAuthAck ( PppContext context,
const PapAuthAckPacket authAckPacket,
size_t  length 
)

Process Authenticate-Ack packet.

Parameters
[in]contextPPP context
[in]authAckPacketPacket received from the peer
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 330 of file pap.c.

◆ papProcessAuthNak()

error_t papProcessAuthNak ( PppContext context,
const PapAuthNakPacket authNakPacket,
size_t  length 
)

Process Authenticate-Nak packet.

Parameters
[in]contextPPP context
[in]authNakPacketPacket received from the peer
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 387 of file pap.c.

◆ papProcessAuthReq()

error_t papProcessAuthReq ( PppContext context,
const PapAuthReqPacket authReqPacket,
size_t  length 
)

Process Authenticate-Request packet.

Parameters
[in]contextPPP context
[in]authReqPacketPacket received from the peer
[in]lengthLength of the packet, in bytes
Returns
Error code

Definition at line 214 of file pap.c.

◆ papProcessPacket()

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

Process an incoming PAP packet.

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

Definition at line 149 of file pap.c.

◆ papSendAuthAck()

error_t papSendAuthAck ( PppContext context,
uint8_t  identifier 
)

Send Authenticate-Ack packet.

Parameters
[in]contextPPP context
[in]identifierIdentifier field
Returns
Error code

Definition at line 501 of file pap.c.

◆ papSendAuthNak()

error_t papSendAuthNak ( PppContext context,
uint8_t  identifier 
)

Send Authenticate-Nak packet.

Parameters
[in]contextPPP context
[in]identifierIdentifier field
Returns
Error code

Definition at line 553 of file pap.c.

◆ papSendAuthReq()

error_t papSendAuthReq ( PppContext context)

Send Authenticate-Request packet.

Parameters
[in]contextPPP context
Returns
Error code

Definition at line 422 of file pap.c.

◆ papStartAuth()

error_t papStartAuth ( PppContext context)

Start PAP authentication.

Parameters
[in]contextPPP context
Returns
Error code

Definition at line 53 of file pap.c.

◆ papTick()

void papTick ( PppContext context)

PAP timer handler.

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

Parameters
[in]contextPPP context

Definition at line 110 of file pap.c.

Variable Documentation

◆ __packed_struct

typedef __packed_struct
Initial value:
{
uint8_t code

Authenticate-Request packet.

Authenticate-Nak packet.

Authenticate-Ack packet.

Definition at line 106 of file pap.h.

◆ identifier

uint8_t identifier

Definition at line 109 of file pap.h.

◆ length

uint16_t length

Definition at line 110 of file pap.h.

◆ message

uint8_t message[]

Definition at line 126 of file pap.h.

◆ msgLength

uint8_t msgLength

Definition at line 125 of file pap.h.

◆ PapAuthAckPacket

PapAuthAckPacket

Definition at line 127 of file pap.h.

◆ PapAuthNakPacket

PapAuthNakPacket

Definition at line 141 of file pap.h.

◆ PapAuthReqPacket

PapAuthReqPacket

Definition at line 113 of file pap.h.

◆ peerId

uint8_t peerId[]

Definition at line 112 of file pap.h.

◆ peerIdLength

uint8_t peerIdLength

Definition at line 111 of file pap.h.

uint8_t code
Definition: coap_common.h:179