ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference

 


IOEthernetInterface

Inherits from:
Declared In:

Overview

The Ethernet interface object.

Discussion

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.



Functions

controllerDidChangePowerState

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

controllerDidOpen

A notification that the interface has opened the network controller.

controllerWillChangePowerState

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

controllerWillClose

A notification that the interface will close the network controller.

free

Frees the IOEthernetInterface instance.

getNamePrefix

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

init

Initializes an IOEthernetInterface instance.

performCommand

Handles an ioctl command sent to the Ethernet interface.

setProperties

Handles a request to set Ethernet interface properties from kernel or non-kernel clients.


controllerDidChangePowerState


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

protected

virtual IOReturn controllerDidChangePowerState( IONetworkController *controller, IOPMPowerFlags flags, UInt32 stateNumber, 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.


controllerDidOpen


A notification that the interface has opened the network controller.

protected

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.


controllerWillChangePowerState


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

protected

virtual IOReturn controllerWillChangePowerState( IONetworkController *controller, IOPMPowerFlags flags, UInt32 stateNumber, 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.


controllerWillClose


A notification that the interface will close the network controller.

protected

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.


free


Frees the IOEthernetInterface instance.

protected

virtual void free();
Discussion

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


getNamePrefix


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

public

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.


init


Initializes an IOEthernetInterface instance.

public

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.


performCommand


Handles an ioctl command sent to the Ethernet interface.

protected

virtual SInt32 performCommand( IONetworkController *controller, UInt32 cmd, 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.


setProperties


Handles a request to set Ethernet interface properties from kernel or non-kernel clients.

public

virtual IOReturn setProperties( OSObject *properties );
Parameters
properties

An OSDictionary containing a collection of properties.

Return Value

Returns kIOReturnUnsupported if the interface did not recognize any of the properties provided. Otherwise, the return code will be kIOReturnSuccess to indicate no errors, or an IOReturn error code to indicate that an error occurred while handling one of the properties.

Discussion

For non-kernel clients, the preferred access mechanism is through a user client connection.

Member Data


_reserved


See Also:

reserved

private

ExpansionData * _reserved;
Discussion

Reserved for future use. (Internal use only)


reserved


See Also:

_reserved

private

ExpansionData * _reserved;
Discussion

Reserved for future use. (Internal use only)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.

 

Last Updated: 2009-02-23