tfUseAsyncPpp
Table of Contents >> Optional Protocols >> PPP Interface
| #include <trsocket.h> |
| ttUserLinkLayer tfUseAsyncPpp | (ttUserLnkNotifyFuncPtr notifyFuncPtr); |
Function Description
This function is used to initialize the asynchronous PPP client link layer. When link-up or link-down events occur, the stack will call the function passed in. If you do not need notification of events then the parameter should be set to TM_LNK_NOTIFY_FUNC_NULL_PTR.
The prototype of the notification function is:
void myPppNotifyFunction(ttUserInterface interfaceHandle, int flags);
Possible 'flags' values
- TM_LL_OPEN_COMPLETE
- PPP Device is ready to accept data from the user.
- TM_LL_CLOSE_STARTED
- PPP Device has started to close this link.
- TM_LL_CLOSE_COMPLETE
- PPP Device has closed.
- TM_LL_LCP_UP
- LCP negotiation has completed.
- TM_LL_PAP_UP
- PAP authentication has completed.
- TM_LL_CHAP_UP
- CHAP authentication has completed.
- TM_LL_IPCP_START
- IPCP negotiation has started.
- TM_LL_LQM_UP
- LQM is enabled on the link.
- TM_LL_LQM_DISABLED
- LQM is disabled on the link.
- TM_LL_LQM_LINK_BAD
- Link quality is bad, user recovery should be attempted.
These events may be used to monitor the status of the PPP connection. The PPP connection should not be used before a TM_LL_OPEN_COMPLETE event is received, and the device should not be restarted (after a tfCloseInterface()) before a TM_LL_CLOSE_COMPLETE event is received.
From these events, it is also possible to determine why PPP negotiation failed. For instance, if authentication fails, a TM_LL_LCP_UP event is first received indicating that the physical link has been negotiated.
However, if authentication fails, the next event will be TM_LL_CLOSE_STARTED and then TM_LL_CLOSE_COMPLETE since the link must be closed if negotiation fails. If authentication is successful the events that are received are TM_LL_LCP_UP, TM_LL_PAP_UP or TM_LL_CHAP_UP and then TM_LL_OPEN_COMPLETE.
Parameters
- notifyFuncPtr
- The function to call to notify the user of PPP events.
Returns
- (ttUserLinkLayer)0
- Error.
- (Other)
- Success.