next up previous contents index
Next: 26.3.3 oskit_freebsd_net_open_first_ether_if: find and Up: 26.3 Interfaces Previous: 26.3.1 oskit_freebsd_net_init: initialize the

26.3.2 oskit_freebsd_net_open_ether_if: find and open an ethernet interface

 

SYNOPSIS

#include <oskit/net/freebsd.h>

oskit_error_t oskit_freebsd_net_open_ether_if( struct oskit_etherdev *dev, [out] struct oskit_freebsd_net_ether_if ** out_eif);

DIRECTION

OS tex2html_wrap_inline32841 Network stack

DESCRIPTION

This function is a convenience function to open an ethernet device and create the necessary oskit_netio_t instances to ``connect'' the netio device drivers to the protocol stack.

Note: The code uses the following internal structure to keep track of an ethernet interface, defined in oskit/net/freebsd.h

struct oskit_freebsd_net_ether_if  {

    oskit_etherdev_t *dev;	/* ethernet device */
    oskit_netio_t   *send_nio;  /* netio for sending packets */
    oskit_netio_t   *recv_nio;  /* netio for receiving packets */
    oskit_devinfo_t     info;	/* device info */
    unsigned char   haddr[OSKIT_ETHERDEV_ADDR_SIZE]; /* MAC address */
    struct ifnet    *ifp;	/* actual interface seen by BSD code */
 
};

ifp is the actual interface as seen by the BSD code. recv_nio points to the netio COM interface receiving packets from the ethernet device dev and passing them to the BSD networking code. send_nio is the netio used by the code to send packets. haddr contains the MAC address, and info the device info associated with dev.

PARAMETERS

dev
The ethernet device to be used with the interface. Note that the FreeBSD net library will take this reference over.
out_eif
*out_eif points to an oskit_freebsd_net_ether_if structure on success.

RETURNS

Returns 0 on success, or an error code specified in <oskit/error.h>, on error.



University of Utah Flux Research Group