KallistiOS  ##version##
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Public Member Functions | Data Fields
ppp_proto Struct Reference

PPP Protocol structure. More...

#include <ppp/ppp.h>

Public Member Functions

 TAILQ_ENTRY (ppp_proto) entry
 Protocol list entry (not a function!). More...
 

Data Fields

const char * name
 Protocol name ("lcp", "pap", etc). More...
 
uint16_t code
 Protocol code. More...
 
void * privdata
 Private data (if any). More...
 
int(* init )(struct ppp_proto *self)
 Initialization function. More...
 
int(* shutdown )(struct ppp_proto *self)
 Shutdown function. More...
 
int(* input )(struct ppp_proto *self, const uint8_t *buf, size_t len)
 Protocol packet input function. More...
 
void(* enter_phase )(struct ppp_proto *self, int oldp, int newp)
 Notify the protocol of a PPP phase change. More...
 
void(* check_timeouts )(struct ppp_proto *self, uint64_t tm)
 Check timeouts for resending packets. More...
 

Detailed Description

PPP Protocol structure.

Each protocol that the PPP library can handle must have one of these registered. All protocols should be registered BEFORE attempting to actually establish a PPP session to ensure that each protocol can be used in the setup of the connection as needed.

Member Function Documentation

ppp_proto::TAILQ_ENTRY ( ppp_proto  )

Protocol list entry (not a function!).

Field Documentation

void(* ppp_proto::check_timeouts)(struct ppp_proto *self, uint64_t tm)

Check timeouts for resending packets.

This function will be called periodically to allow the protocol to check any resend timers that it might have responsibility for.

Parameters
selfThe protocol structure for this protocol.
tmThe current system time for checking timeouts against (in milliseconds since system startup).
uint16_t ppp_proto::code

Protocol code.

void(* ppp_proto::enter_phase)(struct ppp_proto *self, int oldp, int newp)

Notify the protocol of a PPP phase change.

This function will be called by the PPP automaton any time that a phase change is initiated. This is often used for starting up a protocol when appropriate to do so (for instance, LCP uses this to begin negotiating configuration options with the peer when the establish phase is entered by the automaton).

Parameters
selfThe protocol structure for this protocol.
oldpThe old phase (the one the automaton is leaving).
newpThe new phase.
See also
PPP automaton phases
int(* ppp_proto::init)(struct ppp_proto *self)

Initialization function.

Parameters
selfThe protocol structure for this protocol.
Returns
0 on success, <0 on failure.
Note
Set to NULL if this is not needed in the protocol.
int(* ppp_proto::input)(struct ppp_proto *self, const uint8_t *buf, size_t len)

Protocol packet input function.

This function will be called for each packet delivered to the specified protocol.

Parameters
selfThe protocol structure for this protocol.
pktThe packet being delivered.
lenThe length of the packet in bytes.
Returns
0 on success, <0 on failure.
const char* ppp_proto::name

Protocol name ("lcp", "pap", etc).

void* ppp_proto::privdata

Private data (if any).

int(* ppp_proto::shutdown)(struct ppp_proto *self)

Shutdown function.

This function should perform any protocol-specific shutdown actions and unregister the protocol from the PPP protocol list.

Parameters
selfThe protocol structure for this protocol.
Returns
0 on success, <0 on failure.

The documentation for this struct was generated from the following file: