Add text here - Digi International

Download Report

Transcript Add text here - Digi International

PPP API
1-1
PPP Overview
Three types of Protocols
1. Link Connect Protocols
2. Authentication Protocols
3. Network Protocols
1-2
Link Protocols
• To be portable to a wide variety of environments, PPP provides a
Link Control Protocol (LCP).
• The LCP is used to
• automatically agree upon the encapsulation format options,
• handle varying limits on sizes of packets,
• detect a looped-back link and other common misconfiguration
errors, and
• terminate the link.
1-3
Link Phase Diagram
Dead
Up
Establish
Opened
Success/
Authenticate None
Fail
Fail
Down
1-4
Terminate
Closing
Network
Authentication Protocols
• CHAP - Challenge Handshake Authentication Protocol
– Used to periodically verify the identity of the peer using a 3-way handshake
– Done upon initial link establishment, and MAY be repeated anytime
afterward
– Process:
• After the Link Establishment phase is complete, the authenticator sends a "challenge"
message to the peer.
• The peer responds with a value calculated using a "one-way hash" function.
• The authenticator checks the response against its own calculation of the expected
hash value. If the values match, the authentication is acknowledged; otherwise the
connection SHOULD be terminated.
• At random intervals, the authenticator sends a new challenge to the peer, and
repeats steps 1 to 3.
• PAP - Password Authentication Protocol
– Allows for a username and password to be included
– Device attached to has to check and ok password
1-5
Network Control Protocols
• Can handle more than one network type
• First configure the network type
• Include information about network in each
communication
1-6
Types of PPP Control
• Two Types of control
• Serial Link Control
• Modem Link Control
1-7
Material Needed for PPP Examples
• A PPP Host that can be accessed over a serial port
• Two Modems
• A remote access server
1-8
Supported Functions
• Can handle PPP over direct serial
• Can handle modem setup and PPP
• Requires fixed IP addresses
1-9
Example Applications
• Echo Client to Remote Echo Server through Remote
Access Server over Modem on Com2
• FTP Server Available through Direct Serial Connection on
Com1
• HTTP Server Available through Remote Access Over
Modem on COM2
• IP Routing Between a Direct Serial Connection to a
Modem Connection
1-10
Echo Client to Remote Echo Server through Remote
Access Server over Modem on Com2
• Modem connection with modem control
• Sets modem to either send or receive
• Sends and receives data
• Have to adjust numbers and IP addresses
1-11
FTP Server Available through Direct Serial
Connection on Com1
• Serial connection only
• Has authentication built in
• IP addresses need to be set
1-12
HTTP Server Available through Remote Access Over
Modem on COM2
• Uses modem connection
• Sets up modem configuration and makes or allows calls
• Waits for call
• Acts as webserver
1-13
IP Routing Between a Direct Serial
Connection to a Modem Connection
• Combination version
• Uses serial for one connection
• Modem for other connection
• Sends data to modem to setup for operation
• Board waits for connection on modem
• Already has connection over serial
1-14
State Diagrams
1-15
Modem State Diagram
NASetSysAccess
Unitialized
PPPCreateDevice
Stopped
PPPModemClose
PPPModemInit
Started
1-16
PPPSetModemAutoAnswerRings
PPPSetModemDialString
PPPSetVJ
PPPSetPeerAddr
PPPSetAuth
PPPCheckLink
PPPAddRoute
PPPDelRoute
PPPGetPeerAssignedAddress
Direct Serial State Diagram
NASetSysAccess
Unitialized
PPPCreateDevice
Stopped
PPPSerialClose
PPPSerialInit
Started
1-17
PPPSetVJ
PPPSetPeerAddr
PPPSetAuth
PPPCheckLink
PPPAddRoute
PPPDelRoute
PPPGetPeerAssignedAddress
State Diagrams
1-18
PPP Enhancements - API Changes
• PPPAddUser() superseded by NAsetSysAccess()
• PPPSetAuthentication() superseded by PPPSetAuth()
• PPPDelRoute() was added for cases where addresses
provided by remote site such as an ISP
• PPPGetPeerAssignedAddress() was added to get
address from a remote site such as an ISP
1-19
PPP Enhancements - Modem
Driver Changes
• AT&FE1 modem command from NET+OS 3 removed
• Modem hardware hang up / reset (toggle DTR) replaces
software hang up / reset (+++ATH command)
• Dial-up client mode no longer sends ATS0=x command,
only dial-up server mode sends ATS0=x command
1-20
PPP Enhancements - Application
Changes
• NAsetSysAccess() replaces PPPAddUser() in all
examples
• PPPSetAuth() replaces PPPSetAuthentication() in all
examples
• Dial-up client example (echomod2) modified to better
handle common modem communications errors. The
code outlines how to close the modem on a disconnect
so that the connection can be reestablished.
1-21