IOEthernetInterface

Inherits from
IONetworkInterface
Availability
Available in OS X v10.6 and later.
Declared in
IOEthernetInterface.h

Overview

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.

Tasks

Miscellaneous

Instance Methods

controllerDidChangePowerState

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

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.

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.

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.

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.

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.

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.

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.

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

Instance Variables

reserved

ExpansionData * _reserved;

Reserved for future use. (Internal use only)

See Also

_reserved

ExpansionData * _reserved;

Reserved for future use. (Internal use only)

See Also