Mac Developer Library

Developer

IONetworkMedium Class Reference

Options
Deployment Target:

On This Page
Language:

IONetworkMedium

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Not Applicable

Objective-C

@import Kernel;

Availability


Available in OS X v10.6 and later.

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.

  • Adds an IONetworkMedium object to a dictionary.

    Declaration

    C++

    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.

  • Frees the IONetworkMedium object.

    Declaration

    C++

    virtual void free();

  • Declaration

    C++

    virtual UInt32 getFlags() const;

    Return Value

    Returns the medium flags.

  • Declaration

    C++

    virtual UInt32 getIndex() const;

    Return Value

    Returns the assigned medium index.

  • Declaration

    C++

    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().

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

    Declaration

    C++

    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.

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

    Declaration

    C++

    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.

  • Declaration

    C++

    virtual const OSSymbol * getName() const;

    Return Value

    Returns the name assigned to this medium object.

  • Declaration

    C++

    virtual UInt64 getSpeed() const;

    Return Value

    Returns the maximum link speed supported by this medium.

  • Declaration

    C++

    virtual IOMediumType getType() const;

    Return Value

    Returns the medium type assigned to this medium object.

  • Initializes an IONetworkMedium object.

    Declaration

    C++

    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.

  • Tests for equality between two IONetworkMedium objects.

    Declaration

    C++

    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.

  • Tests for equality between a IONetworkMedium object and an OSObject.

    Declaration

    C++

    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.

  • Factory method that allocates and initializes an IONetworkMedium object.

    Declaration

    C++

    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.

  • Creates a name that describes a medium type.

    Declaration

    C++

    static const OSSymbol * nameForType( IOMediumTypetype);

    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.

  • Removes an IONetworkMedium object from a dictionary.

    Declaration

    C++

    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.

  • Serializes the IONetworkMedium object.

    Declaration

    C++

    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 for future use. (Internal use only)

    Declaration

    C++

    ExpansionData *_reserved;

  • Reserved for future use. (Internal use only)

    Declaration

    C++

    ExpansionData *_reserved;