Low-Level PPP Support
C-7
Point to Point Protocol
break;
case SI_MSG_SENDPACKET:
// Make sure packet is valid
if( !hPkt || !(hFrag = PktGetFrag( hPkt )) )
{
DbgPrintf(DBG_ERROR,”pppoeSI: Bad packet”);
goto TxDone;
}
// Silently discard packet if we’re not connected
if( !ppi–>SessionId )
goto TxDone;
// Get the buffer parameters
pb = FragGetBufParams( hFrag, 0, &ValidSize, &Offset );
// We can’t have an LLC since SI framing is undefined
if( PktGetFlags( hPkt ) & FLG_PKT_LLC_VALID )
{
DbgPrintf(DBG_ERROR,”pppoeSI: LLC on PPP packet”);
PktFree( hPkt );
return;
}
// NOTE: Unlike a serial port, PPPoE will use Ethernet to send
// the packet data. Thus, we would like to reuse the supplied
// packet handle and pass that handle directly to the low–level
// packet driver. To do this, we go through a little extra work
// on the packet. A serial device could simple start encoding data
// at this point.
//
// Aux = 16 bit PPP Protocol Value
// ValidSize = Size of Payload field
// (pb+Offset) = Pointer to start of Payload data
<PPPoE specific code removed for clarity>
// If we consume the packet here (a serial version of the callback
// always will), we must free the packet handle AFTER we have copied
// out the payload data.
TxDone:
PktFree( hPkt );
break;
}
}