IONetworkMedium

Inherits from
OSObject
Availability
Available in OS X v10.6 and later.
Declared in
IONetworkMedium.h

Overview

An object that encapsulates information about a network medium (i.e. 10Base-T, or 100Base-T Full Duplex).

The main purpose of this object is for a network driver to advertise its media capability, through a collection of IONetworkMedium objects stored in a dictionary in its property table. IONetworkMedium supports serialization, and will encode its properties in the form of a dictionary to the serialization stream when instructed. This will allow a user-space application to browse the set of media types supported by the controller.

Tasks

Miscellaneous

Instance Methods

addMedium

Adds an IONetworkMedium object to a dictionary.

static bool addMedium( OSDictionary *dict, const IONetworkMedium *medium);
Parameters
dict

An OSDictionary object where the medium object should be added as a new entry.

medium

The IONetworkMedium object to add to the dictionary.

Return Value

Returns true on success, false otherwise.

Discussion

A helper function to add an IONetworkMedium object to a given dictionary. The name of the medium is used as the key for the new dictionary entry.

free

Frees the IONetworkMedium object.

virtual void free();

getFlags

virtual UInt32 getFlags() const;
Return Value

Returns the medium flags.

getIndex

virtual UInt32 getIndex() const;
Return Value

Returns the assigned medium index.

getKey

virtual const OSSymbol * getKey() const;
Return Value

Returns the key to use for this medium object. This key should be used when this object is added to a dictionary. Same as getName().

getMediumWithIndex

Finds a medium object from a dictionary with a given index.

static IONetworkMedium * getMediumWithIndex( const OSDictionary *dict, UInt32 index, UInt32 mask = 0);
Parameters
dict

The dictionary to look for a matching entry.

index

Search for an entry with the given index.

mask

The don't care bits in index. Defaults to 0, which implies that a perfect match is desired.

Return Value

Returns the first matching IONetworkMedium entry found, or 0 if no match was found.

Discussion

This method iterates through a dictionary and returns an IONetworkMedium entry with the given index. An optional mask supplies the don't care bits.

getMediumWithType

Finds a medium object from a dictionary with a given type.

static IONetworkMedium * getMediumWithType( const OSDictionary *dict, IOMediumType type, IOMediumType mask = 0);
Parameters
dict

The dictionary to look for a matching entry.

type

Search for an entry with this type.

mask

The don't care bits in IOMediumType. Defaults to 0, which implies that a perfect match is desired.

Return Value

Returns the first matching IONetworkMedium entry found, or 0 if no match was found.

Discussion

This method iterates through a dictionary and returns an IONetworkMedium entry with the given type. An optional mask supplies the don't care bits.

getName

virtual const OSSymbol * getName() const;
Return Value

Returns the name assigned to this medium object.

getSpeed

virtual UInt64 getSpeed() const;
Return Value

Returns the maximum link speed supported by this medium.

getType

virtual IOMediumType getType() const;
Return Value

Returns the medium type assigned to this medium object.

init

Initializes an IONetworkMedium object.

virtual bool init( IOMediumType type, UInt64 speed, UInt32 flags = 0, UInt32 index = 0, const char *name = 0);
Parameters
type

The medium type, this value is encoded with bits defined in IONetworkMedium.h.

speed

The maximum (or the only) link speed supported over this medium in units of bits per second.

flags

An optional flag for the medium object. See IONetworkMedium.h for defined flags.

index

An optional index number assigned by the owner. Drivers can use this to store an index to a media table in the driver, or it may map to a driver-defined media type.

name

An optional name assigned to this medium object. If 0, then a name will be created based on the medium type by calling IONetworkMedium::nameForType(). Since the name of the medium is used as a key when inserted into a dictionary, the name chosen must be unique within the scope of the owner.

Return Value

Returns true on success, false otherwise.

isEqualTo(const IONetworkMedium *)

Tests for equality between two IONetworkMedium objects.

virtual bool isEqualTo( const IONetworkMedium *medium) const;
Parameters
medium

An IONetworkMedium to test against the IONetworkMedium object being called.

Return Value

Returns true if equal, false otherwise.

Discussion

Two IONetworkMedium objects are considered equal if they have similar properties assigned to them during initialization.

isEqualTo(const OSMetaClassBase *)

Tests for equality between a IONetworkMedium object and an OSObject.

virtual bool isEqualTo( const OSMetaClassBase *obj) const;
Parameters
obj

An OSObject to test against an IONetworkMedium object.

Return Value

Returns true if equal, false otherwise.

Discussion

The OSObject is considered equal to the IONetworkMedium object if the OSObject is an IONetworkMedium, and they have similar properties assigned to them during initialization.

medium

Factory method that allocates and initializes an IONetworkMedium object.

static IONetworkMedium * medium( IOMediumType type, UInt64 speed, UInt32 flags = 0, UInt32 index = 0, const char *name = 0);
Parameters
type

The medium type, this value is encoded with bits defined in IONetworkMedium.h.

speed

The maximum (or the only) link speed supported over this medium in units of bits per second.

flags

An optional flag for the medium object. See IONetworkMedium.h for defined flags.

index

An optional index number assigned by the owner. Drivers can use this to store an index to a media table in the driver, or it may map to a driver-defined media type.

name

An optional name assigned to this medium object. If 0, then a name will be created based on the medium type by calling IONetworkMedium::nameForType(). Since the name of the medium is used as a key when inserted into a dictionary, the name chosen must be unique within the scope of the owner.

Return Value

Returns an IONetworkMedium instance on success, or 0 otherwise.

nameForType

Creates a name that describes a medium type.

static const OSSymbol * nameForType( IOMediumType type);
Parameters
type

A medium type. See IONetworkMedium.h for type encoding.

Return Value

Returns an OSSymbol object is created based on the type provided.

Discussion

Given a medium type, creates an OSymbol object that describes the medium type. There is a 1-to-1 mapping between the medium type, and the medium name created by this method. The caller is responsible for releasing the OSSymbol object returned.

removeMedium

Removes an IONetworkMedium object from a dictionary.

static void removeMedium( OSDictionary *dict, const IONetworkMedium *medium);
Parameters
dict

The OSDictionary object where the medium object should be removed from.

medium

The name of this medium object is used as the key.

Discussion

A helper function to remove an entry in a dictionary.

serialize

Serializes the IONetworkMedium object.

virtual bool serialize( OSSerialize *s) const;
Parameters
s

An OSSerialize object.

Return Value

Returns true on success, false otherwise.

Discussion

A dictionary is created containing the properties assigned to this medium object, and this dictionary is then serialized using the OSSerialize object provided.

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