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
 

Typedefs

struct {
   uint8_t   code
 
   uint8_t   identifier
 
   uint16_t   length
 
   uint8_t   peerIdLength
 
   uint8_t   peerId []
 
PapAuthReqPacket
 Authenticate-Request packet. More...
 
struct {
   uint8_t   code
 
   uint8_t   identifier
 
   uint16_t   length
 
   uint8_t   msgLength
 
   uint8_t   message []
 
PapAuthAckPacket
 Authenticate-Ack packet. More...
 
struct {
   uint8_t   code
 
   uint8_t   identifier
 
   uint16_t   length
 
   uint8_t   msgLength
 
   uint8_t   message []
 
PapAuthNakPacket
 Authenticate-Nak packet. More...
 

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

Detailed Description

PAP (Password Authentication Protocol)

License

Copyright (C) 2010-2018 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
1.9.0

Definition in file pap.h.

Macro Definition Documentation

◆ PAP_MAX_REQUESTS

#define PAP_MAX_REQUESTS   5

Definition at line 52 of file pap.h.

◆ PAP_RESTART_TIMER

#define PAP_RESTART_TIMER   3000

Definition at line 45 of file pap.h.

◆ PAP_SUPPORT

#define PAP_SUPPORT   ENABLED

Definition at line 38 of file pap.h.

Typedef Documentation

◆ PapAuthAckPacket

typedef { ... } PapAuthAckPacket

Authenticate-Ack packet.

◆ PapAuthNakPacket

typedef { ... } PapAuthNakPacket

Authenticate-Nak packet.

◆ PapAuthReqPacket

typedef { ... } PapAuthReqPacket

Authenticate-Request packet.

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 84 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 67 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 85 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 600 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 328 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 385 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 212 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 147 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 498 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 549 of file pap.c.

◆ papSendAuthReq()

error_t papSendAuthReq ( PppContext context)

Send Authenticate-Request packet.

Parameters
[in]contextPPP context
Returns
Error code

Definition at line 420 of file pap.c.

◆ papStartAuth()

error_t papStartAuth ( PppContext context)

Start PAP authentication.

Parameters
[in]contextPPP context
Returns
Error code

Definition at line 51 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 108 of file pap.c.

Variable Documentation

◆ code

uint8_t code

Definition at line 104 of file pap.h.

◆ identifier

uint8_t identifier

Definition at line 105 of file pap.h.

◆ length

uint16_t length

Definition at line 106 of file pap.h.

◆ message

uint8_t message[]

Definition at line 122 of file pap.h.

◆ msgLength

uint8_t msgLength

Definition at line 121 of file pap.h.

◆ peerId

uint8_t peerId[]

Definition at line 108 of file pap.h.

◆ peerIdLength

uint8_t peerIdLength

Definition at line 107 of file pap.h.