Using Ethernet or PPP

Jump to: navigation, search
<< Testing the Library
Adding a Device Driver >>



Now that you are comfortable that the stack and interfaces to it are working correctly, you are ready to include the link layer that you wish to use. For this operation, you will need to define a handle to store the desired link layer into. We call this a link layer handle and it is defined as a ttUserLinkLayer type. Adding (or using) a link layer is a simple process. You simply call link layer USE function to pull in the appropriate link layer from the library. These functions are called tfUseEthernet(), tfUseAsyncPpp(), tfUseAsyncServerPpp(), and tfUseNullLinkLayer(). The null link layer is used to pass raw IP datagrams directly to/from the device driver interface. This way you can use the device driver interface to hookup a new link layer. In the base TCP/IP package, you will receive both the Ethernet and Null link layers.

Examples of this follow:

{
    ttUserLinkLayer ethernetHandle;
    ttUserLinkLayer pppServerHandle;
    ttUserLinkLayer pppClientHandle;
    ttUserLinkLayer nullLinkHandle; 
 
/* Select the Ethernet DIX protocol */
    ethernetHandle = tfUseEthernet();
 
/* Select the PPP server Link Layer Protocol */
    pppServerHandle = tfUseAsyncServerPpp(notifyServerFuncPtr);
 
/* Select the PPP Client Link Layer Protocol */
    pppClientHandle = tfUseAsyncPpp(notifyClientFuncPtr);
 
/* Select the NULL Link Layer */
    nullLinkHandle = tfUseNullLinkLayer();
}


Note Note: PPP is an optional protocol, and if you did not purchase PPP and attempt to call tfUseAsyncPpp() or tfUseAsyncServerPpp() functions, you will get an error.


<< Testing the Library
Adding a Device Driver >>