Low-Level PPP Support
C-6
and which do not. The default value of the peer CMAP should be 0xffffffff, and
updated only when this message is received. Whether or not PPP will attempt
to exchange CMAP information with its peer, is determined by passing flags
to pppNew() when the connection instance is created.
C.1.5.5 Example Callback Function Implementation
The following is an example of a SI module callback function from the PPPoE
code inside the TCP/IP stack. Some of the code specific to PPPoE has been
removed for clarity. The code that remains illustrates the basic processing that
must be done for the various SI callback messages. The function calls made
in this example are described in Appendix A.
//––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
// SI Control Callback Function for PPPoE
//––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
void pppoeSI( HANDLE hSI, uint Msg, UINT32 Aux, HANDLE hPkt )
{
// hSI is really a pointer to our private data structure
PPPOE_INST *ppi = (PPPOE_INST *)hSI;
HANDLE hFrag;
uint Offset,ValidSize,Payload;
UINT8 *pb;
ETHHDR *pEth;
switch( Msg )
{
case SI_MSG_CALLSTATUS:
// Record status so client can call ”GetStatus” function
ppi–>Status = (uint)Aux;
if( Aux >= SI_CSTATUS_DISCONNECT )
{
// Close PPP
if( ppi–>hPPP )
{
hTmp = ppi–>hPPP;
ppi–>hPPP = 0;
pppFree( hTmp );
}
// Terminate the PPPOE session
<PPPoE specific code removed for clarity>
}
break;
case SI_MSG_PEERCMAP:
// PPPoE does not use async translation maps. The peer map in Aux
DbgPrintf( DBG_WARN, ”PPPOE: Unexpected Peer CMAP %08lx”,Aux );