PPP
[PPP]

Collaboration diagram for PPP:

Detailed Description

PPP Driver.

Copyright (C) 2002 by Call Direct Cellular Solutions Pty. Ltd. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY CALL DIRECT CELLULAR SOLUTIONS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALL DIRECT CELLULAR SOLUTIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

For additional information see http://www.calldirect.com.au/

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

For additional information see http://www.ethernut.de/

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY CALL DIRECT CELLULAR SOLUTIONS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CALL DIRECT CELLULAR SOLUTIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

For additional information see http://www.calldirect.com.au/

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

For additional information see http://www.ethernut.de/


Data Structures

struct  _PPPDCB
 PPP interface structure. More...
struct  _PPPDCB
 PPP interface structure. More...

Defines

#define PPP_PFC   0x01
#define PPP_ACFC   0x02
#define LCP_DEFOPT_ASYNCMAP   0x000A0000UL
#define LCP_OPEN   1
#define LCP_CLOSE   2
#define LCP_LOWERUP   3
#define LCP_LOWERDOWN   4

Typedefs

typedef struct _PPPDCB PPPDCB
 PPP interface type.

Functions

void NutPppInput (NUTDEVICE *dev, NETBUF *nb)
 Handle incoming PPP frames.
int NutPppOutput (NUTDEVICE *dev, u_short type, u_char *ha, NETBUF *nb)
 Send PPP frame.
void NutPppSm (void *arg)
 PPP state machine timeout thread.
int NutPppInitStateMachine (NUTDEVICE *dev)
 Initialize the PPP state machine.
void LcpOpen (NUTDEVICE *dev)
 Trigger LCP open event.
void LcpClose (NUTDEVICE *dev)
 Trigger LCP close event.
void LcpLowerUp (NUTDEVICE *dev)
 Trigger LCP lower up event.
void LcpLowerDown (NUTDEVICE *dev)
 Trigger LCP lower down event.
void IpcpOpen (NUTDEVICE *dev)
 Trigger IPCP open event.
void IpcpClose (NUTDEVICE *dev)
 Trigger IPCP close event.
void IpcpLowerUp (NUTDEVICE *dev)
void IpcpLowerDown (NUTDEVICE *dev)

Variables

NUTDEVICE devPpp
 Device information structure.
u_long new_magic = 0x12345678
IFNET ifn_ppp
 Network interface information structure.
NUTDEVICE devPpp
 Device information structure.


Define Documentation

#define PPP_PFC   0x01

Definition at line 115 of file ppp.h.

#define PPP_ACFC   0x02

Definition at line 116 of file ppp.h.

#define LCP_DEFOPT_ASYNCMAP   0x000A0000UL

Definition at line 118 of file ppp.h.

Referenced by LcpResetOptions(), and LcpTxConfReq().

#define LCP_OPEN   1

Definition at line 256 of file ppp.h.

#define LCP_CLOSE   2

Definition at line 257 of file ppp.h.

#define LCP_LOWERUP   3

Definition at line 258 of file ppp.h.

Referenced by AhdlcRx().

#define LCP_LOWERDOWN   4

Definition at line 259 of file ppp.h.

Referenced by AhdlcRx().


Typedef Documentation

typedef struct _PPPDCB PPPDCB

PPP interface type.

Definition at line 123 of file ppp.h.


Function Documentation

void NutPppInput ( NUTDEVICE dev,
NETBUF nb 
)

Handle incoming PPP frames.

Splits the PPP frame into the data link and the network part. Then the frame is routed to the proper handler, based on the type field in the header.

Note:
This routine is called by the device driver on incoming PPP frames. Applications typically do not call this function.
Parameters:
dev Identifies the device that received the frame.
nb Pointer to a network buffer structure containing the PPP frame.

Definition at line 137 of file pppin.c.

References __ppp_trf, __ppp_trs, PPPHDR::address, AHDLC_ALLSTATIONS, _NUTDEVICE::dev_dcb, fputs(), LcpTxProtRej(), _NETBUF::nb_dl, _NETBUF::nb_nw, ntohs, NutDumpPpp(), NutIpcpInput(), NutIpInput(), NutLcpInput(), NutNetBufFree(), NutPapInput(), NutSleep(), PAPCS_OPEN, PPP_CHAP, PPP_IP, PPP_IPCP, PPP_LCP, PPP_LQR, PPP_PAP, PPPS_OPENED, PPPHDR::prot_type, _NBDATA::sz, and _NBDATA::vp.

int NutPppOutput ( NUTDEVICE dev,
u_short  type,
u_char ha,
NETBUF nb 
)

Send PPP frame.

Send a PPP frame of a given type using the specified device.

Parameters:
dev Identifies the network device to use.
type Type of this frame.
ha Hardware address of the destination, ignored with PPP.
nb Network buffer structure containing the packet to be sent. The structure must have been allocated by a previous call NutNetBufAlloc() and will be freed if this function returns with an error.
Returns:
0 on success, -1 in case of any errors.

Definition at line 135 of file pppout.c.

References __ppp_trf, __ppp_trs, PPPHDR::address, AHDLC_ALLSTATIONS, AHDLC_UI, PPPHDR::control, _PPPDCB::dcb_fd, _NUTDEVICE::dev_dcb, _NUTDEVICE::dev_icb, fputs(), htons, ifnet::if_send, _NETBUF::nb_dl, NBAF_DATALINK, NutDumpPpp(), NutNetBufAlloc(), NutNetBufFree(), NutSleep(), PPPHDR::prot_type, and _NBDATA::vp.

NutPppSm ( void *  arg  ) 

PPP state machine timeout thread.

Handles timeouts for LCP and IPCP.

Definition at line 109 of file pppsm.c.

References _PPPDCB::dcb_auth_state, _PPPDCB::dcb_ipcp_state, _PPPDCB::dcb_lcp_state, _PPPDCB::dcb_reqid, _PPPDCB::dcb_retries, _NUTDEVICE::dev_dcb, IpcpTxConfReq(), LcpTxConfReq(), new_magic, NutIpcpOutput(), NutLcpOutput(), NutSleep(), PAPCS_AUTHREQ, PapTxAuthReq(), PPPS_ACKSENT, PPPS_CLOSED, PPPS_CLOSING, PPPS_REQSENT, PPPS_STOPPED, PPPS_STOPPING, and XCP_TERMREQ.

Referenced by NutPppInitStateMachine().

int NutPppInitStateMachine ( NUTDEVICE dev  ) 

Initialize the PPP state machine.

Start the PPP timer thread, if not already running.

Parameters:
dev Pointer to the NUTDEVICE structure of the PPP device.
Returns:
0 on success, -1 otherwise.

Definition at line 195 of file pppsm.c.

References NUT_THREAD_PPPSMSTACK, NutPppSm(), and NutThreadCreate().

void LcpOpen ( NUTDEVICE dev  ) 

Trigger LCP open event.

Enable the link to come up. Typically triggered by the upper layer, when it is enabled.

Parameters:
dev Pointer to the NUTDEVICE structure of the PPP device.

Definition at line 212 of file pppsm.c.

References __ppp_trf, __ppp_trs, _PPPDCB::dcb_lcp_state, _PPPDCB::dcb_reqid, _NUTDEVICE::dev_dcb, fputs(), LcpTxConfReq(), PPPS_CLOSED, PPPS_CLOSING, PPPS_INITIAL, PPPS_REQSENT, PPPS_STARTING, and PPPS_STOPPING.

void LcpClose ( NUTDEVICE dev  ) 

Trigger LCP close event.

Disable the link.

Parameters:
dev Pointer to the NUTDEVICE structure of the PPP device.

Definition at line 257 of file pppsm.c.

References __ppp_trf, __ppp_trs, _PPPDCB::dcb_lcp_state, _PPPDCB::dcb_reqid, _NUTDEVICE::dev_dcb, fputs(), IpcpLowerDown(), NutLcpOutput(), PPPS_ACKRCVD, PPPS_ACKSENT, PPPS_CLOSED, PPPS_CLOSING, PPPS_INITIAL, PPPS_OPENED, PPPS_REQSENT, PPPS_STARTING, PPPS_STOPPED, PPPS_STOPPING, and XCP_TERMREQ.

void LcpLowerUp ( NUTDEVICE dev  ) 

Trigger LCP lower up event.

Parameters:
dev Pointer to the NUTDEVICE structure of the PPP device.

Definition at line 306 of file pppsm.c.

References __ppp_trf, __ppp_trs, _PPPDCB::dcb_lcp_state, _PPPDCB::dcb_reqid, _NUTDEVICE::dev_dcb, fputs(), LcpTxConfReq(), PPPS_CLOSED, PPPS_INITIAL, PPPS_REQSENT, and PPPS_STARTING.

void LcpLowerDown ( NUTDEVICE dev  ) 

Trigger LCP lower down event.

Parameters:
dev Pointer to the NUTDEVICE structure of the PPP device.

Definition at line 340 of file pppsm.c.

References __ppp_trf, __ppp_trs, _PPPDCB::dcb_lcp_state, _NUTDEVICE::dev_dcb, fputs(), IpcpLowerDown(), PPPS_ACKRCVD, PPPS_ACKSENT, PPPS_CLOSED, PPPS_CLOSING, PPPS_INITIAL, PPPS_OPENED, PPPS_REQSENT, PPPS_STARTING, PPPS_STOPPED, and PPPS_STOPPING.

void IpcpOpen ( NUTDEVICE dev  ) 

Trigger IPCP open event.

Link is allowed to come up.

Parameters:
dev Pointer to the NUTDEVICE structure of the PPP device.

Definition at line 384 of file pppsm.c.

References __ppp_trf, __ppp_trs, _PPPDCB::dcb_ipcp_state, _PPPDCB::dcb_reqid, _NUTDEVICE::dev_dcb, fputs(), IpcpTxConfReq(), LcpOpen(), PPPS_CLOSED, PPPS_CLOSING, PPPS_INITIAL, PPPS_REQSENT, PPPS_STARTING, and PPPS_STOPPING.

void IpcpClose ( NUTDEVICE dev  ) 

Trigger IPCP close event.

Disable the link.

Cancel timeouts and either initiate close or possibly go directly to the PPPS_CLOSED state.

Parameters:
dev Pointer to the NUTDEVICE structure of the PPP device.

Definition at line 425 of file pppsm.c.

References __ppp_trf, __ppp_trs, _PPPDCB::dcb_ipcp_state, _PPPDCB::dcb_reqid, _PPPDCB::dcb_state_chg, _NUTDEVICE::dev_dcb, fputs(), NutEventPost(), NutIpcpOutput(), PPPS_ACKRCVD, PPPS_ACKSENT, PPPS_CLOSED, PPPS_CLOSING, PPPS_INITIAL, PPPS_OPENED, PPPS_REQSENT, PPPS_STARTING, PPPS_STOPPED, PPPS_STOPPING, and XCP_TERMREQ.

void IpcpLowerUp ( NUTDEVICE dev  ) 

Definition at line 473 of file pppsm.c.

References __ppp_trf, __ppp_trs, _PPPDCB::dcb_ipcp_state, _PPPDCB::dcb_reqid, _NUTDEVICE::dev_dcb, fputs(), IpcpTxConfReq(), PPPS_CLOSED, PPPS_INITIAL, PPPS_REQSENT, and PPPS_STARTING.

void IpcpLowerDown ( NUTDEVICE dev  ) 

Definition at line 502 of file pppsm.c.

References __ppp_trf, __ppp_trs, _ioctl(), _PPPDCB::dcb_fd, _PPPDCB::dcb_ipcp_state, _PPPDCB::dcb_state_chg, _NUTDEVICE::dev_dcb, fputs(), HDLC_SETIFNET, NutEventPost(), PPPS_ACKRCVD, PPPS_ACKSENT, PPPS_CLOSED, PPPS_CLOSING, PPPS_INITIAL, PPPS_OPENED, PPPS_REQSENT, PPPS_STARTING, PPPS_STOPPED, and PPPS_STOPPING.


Variable Documentation

NUTDEVICE devPpp

Device information structure.

This is a virtual device driver has no underlying hardware and must not be registered. It will be initialized when the application calls NutNetIfConfig().

Examples:
pppc/pppc.c.

Definition at line 342 of file ppp.c.

Referenced by main().

u_long new_magic = 0x12345678

Definition at line 100 of file pppsm.c.

IFNET ifn_ppp

Initial value:

 {
    IFT_PPP,                    
    {0, 0, 0, 0, 0, 0}
    ,                           
    0,                          
    0,                          
    0,                          
    PPP_MRU,                    
    0,                          
    0,                          
    0,                          
    NutPppInput,                
    0,                          
    NutPppOutput                
}
Network interface information structure.

Definition at line 319 of file ppp.c.

NUTDEVICE devPpp

Initial value:

 {
    0,                          
    {'p', 'p', 'p', 0, 0, 0, 0, 0, 0}
    ,                           
    IFTYP_NET,                  
    0,                          
    0,                          
    &ifn_ppp,                   
    &dcb_ppp,                   
    NutPppInit,                 
    NutPppIOCtl,                
    NutPppRead,                 
    NutPppWrite,                

    NutPppWrite_P,              

    NutPppOpen,                 
    NutPppClose,                
    0                           
}
Device information structure.

This is a virtual device driver has no underlying hardware and must not be registered. It will be initialized when the application calls NutNetIfConfig().

Definition at line 342 of file ppp.c.


© 2000-2007 by egnite Software GmbH - visit http://www.ethernut.de/