Mac Developer Library

Developer

IOEthernetInterface Class Reference

Options
Deployment Target:

On This Page
Language:

IOEthernetInterface

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Not Applicable

Objective-C

@import Kernel;

Availability


Available in OS X v10.6 and later.

The Ethernet interface object.

An Ethernet controller driver, that is a subclass of IOEthernetController, will instantiate an object of this class when the driver calls the attachInterface() method. This interface object will then vend an Ethernet interface to DLIL, and manage the connection between the controller driver and the upper networking layers. Drivers will seldom need to subclass IOEthernetInterface.

  • Handles a notification that the network controller servicing this interface object has transitioned to a new power state.

    Declaration

    C++

    virtual IOReturn controllerDidChangePowerState( IONetworkController *controller, IOPMPowerFlagsflags, UInt32stateNumber, IOService *policyMaker);

    Parameters

    controller

    The network controller object.

    flags

    Flags that describe the capability of the controller in the new power state.

    stateNumber

    An index to a state in the network controller's power state array that the controller has switched to.

    policyMaker

    A reference to the network controller's policy-maker, and is also the originator of this notification.

    Return Value

    Always returns kIOReturnSuccess.

    Discussion

    If the controller did transition to a usable state, and it was previously disabled due to a previous power change, then it is re-enabled.

  • A notification that the interface has opened the network controller.

    Declaration

    C++

    virtual bool controllerDidOpen( IONetworkController *controller);

    Parameters

    controller

    The controller object that was opened.

    Return Value

    Returns true on success, false otherwise. Returning false will cause the controller to be closed, and any pending client opens to be rejected.

    Discussion

    This method will be called by IONetworkInterface after a network controller has accepted an open from this interface object. IOEthernetInterface will first call the implementation in its superclass, then inspect the controller through properties published in the registry. This method is called with the arbitration lock held.

  • Handles a notification that the network controller servicing this interface object is about to transition to a new power state.

    Declaration

    C++

    virtual IOReturn controllerWillChangePowerState( IONetworkController *controller, IOPMPowerFlagsflags, UInt32stateNumber, IOService *policyMaker);

    Parameters

    controller

    The network controller object.

    flags

    Flags that describe the capability of the controller in the new power state.

    stateNumber

    An index to a state in the network controller's power state array that the controller is switching to.

    policyMaker

    A reference to the network controller's policy-maker, and is also the originator of this notification.

    Return Value

    Always returns kIOReturnSuccess.

    Discussion

    If the controller is about to transition to an unusable state, and it is currently enabled, then the disable() method on the controller is called.

  • A notification that the interface will close the network controller.

    Declaration

    C++

    virtual void controllerWillClose( IONetworkController *controller);

    Parameters

    controller

    The controller that is about to be closed.

    Discussion

    This method will simply call super to propagate the method call. This method is called with the arbitration lock held.

  • Frees the IOEthernetInterface instance.

    Declaration

    C++

    virtual void free();

    Discussion

    The memory allocated for the arpcom structure is released, followed by a call to super::free().

  • Returns a string containing the prefix to use when creating a BSD name for this interface.

    Declaration

    C++

    virtual const char * getNamePrefix() const;

    Return Value

    Returns a pointer to a constant C string "en". Therefore, Ethernet interfaces will be registered with BSD as en0, en1, etc.

    Discussion

    The BSD name for each interface object is created by concatenating a string returned by this method, with an unique unit number assigned by IONetworkStack.

  • Initializes an IOEthernetInterface instance.

    Declaration

    C++

    virtual bool init( IONetworkController *controller );

    Parameters

    controller

    A network controller object that will service the interface object being initialized.

    Return Value

    Returns true on success, false otherwise.

    Discussion

    Instance variables are initialized, and an arpcom structure is allocated.

  • Handles an ioctl command sent to the Ethernet interface.

    Declaration

    C++

    virtual SInt32 performCommand( IONetworkController *controller, unsigned longcmd, void *arg0, void *arg1);

    Parameters

    controller

    The controller object.

    cmd

    The ioctl command code.

    arg0

    Command argument 0. Generally a pointer to an ifnet structure associated with the interface.

    arg1

    Command argument 1.

    Return Value

    Returns a BSD return value defined in bsd/sys/errno.h.

    Discussion

    This method handles socket ioctl commands sent to the Ethernet interface from DLIL. Commands recognized and processed by this method are SIOCSIFADDR, SIOCSIFFLAGS, SIOCADDMULTI, and SIOCDELMULTI. Other commands are passed to the superclass.

Instance Variables

  • Reserved for future use. (Internal use only)

    Declaration

    C++

    ExpansionData * _reserved;

  • Reserved for future use. (Internal use only)

    Declaration

    C++

    ExpansionData * _reserved;