Annotation of XNU/iokit/IOKit/network/IOEthernetInterface.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * The contents of this file constitute Original Code as defined in and
        !             7:  * are subject to the Apple Public Source License Version 1.1 (the
        !             8:  * "License").  You may not use this file except in compliance with the
        !             9:  * License.  Please obtain a copy of the License at
        !            10:  * http://www.apple.com/publicsource and read it before using this file.
        !            11:  * 
        !            12:  * This Original Code and all software distributed under the License are
        !            13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            17:  * License for the specific language governing rights and limitations
        !            18:  * under the License.
        !            19:  * 
        !            20:  * @APPLE_LICENSE_HEADER_END@
        !            21:  */
        !            22: /*
        !            23:  * Copyright (c) 1999 Apple Computer, Inc.  All rights reserved. 
        !            24:  *
        !            25:  * IOEthernetInterface.h
        !            26:  *
        !            27:  * HISTORY
        !            28:  * 8-Jan-1999       Joe Liu (jliu) created.
        !            29:  */
        !            30: 
        !            31: #ifndef _IOETHERNETINTERFACE_H
        !            32: #define _IOETHERNETINTERFACE_H
        !            33: 
        !            34: #include <IOKit/network/IONetworkInterface.h>
        !            35: #include <IOKit/network/IOEthernetController.h>
        !            36: #include <IOKit/network/IOEthernetStats.h>
        !            37: 
        !            38: // IOEthernetInterface properties.
        !            39: //
        !            40: #define kIOPacketFilters       "IOPacketFilters"       // OSNumber:32
        !            41: #define kIOMulticastAddresses  "IOMulticastAddresses"  // OSData (6 bytes/addr)
        !            42: 
        !            43: /*! @class IOEthernetInterface
        !            44:     @abstract The Ethernet interface object. An Ethernet controller driver
        !            45:     will instantiate this object to manage its connection to the network
        !            46:     stack. */
        !            47: 
        !            48: class IOEthernetInterface : public IONetworkInterface
        !            49: {
        !            50:     OSDeclareDefaultStructors(IOEthernetInterface)
        !            51: 
        !            52: private:
        !            53:     struct arpcom *   _arpcom;            // arpcom struct allocated
        !            54:     UInt              _mcAddrCount;       // # of multicast addresses
        !            55:     UInt32            _features;          // cached controller features
        !            56:     UInt32            _availableFilters;  // what is available?
        !            57:     UInt32            _activeFilters;     // which should be active?
        !            58:     enet_addr_t       _macAddr;           // controller's MAC address
        !            59:     bool              _controllerEnabled; // Is controller enabled?
        !            60: 
        !            61:     IOReturn _enableController(IONetworkController * ctlr);
        !            62:     IOReturn _loadMulticastList(IOEthernetController * ctlr);
        !            63:     bool     _setActiveFilters(UInt32 newFilters);
        !            64: 
        !            65:     int syncSIOCSIFFLAGS(IOEthernetController * ctlr);
        !            66:     int syncSIOCSIFADDR(IOEthernetController * ctlr);
        !            67:     int syncSIOCADDMULTI(IOEthernetController * ctlr);
        !            68:     int syncSIOCDELMULTI(IOEthernetController * ctlr);
        !            69: 
        !            70: public:
        !            71: 
        !            72: /*! @function init
        !            73:     @abstract Initialize an IOEthernetInterface instance.
        !            74:     @discussion Instance variables are initialized, and an arpcom
        !            75:     structure is allocated.
        !            76:     @param properties A property dictionary.
        !            77:     @result true if initialized successfully, false otherwise. */
        !            78: 
        !            79:     virtual bool init(OSDictionary * properties = 0);
        !            80: 
        !            81: /*! @function getNamePrefix
        !            82:     @abstract Get a name prefix for the interface.
        !            83:     @discussion The name of the interface advertised to the network layer
        !            84:     is generated by concatenating the string returned by this method,
        !            85:     and an unit number.
        !            86:     @result A pointer to a constant string "en". Thus Ethernet interfaces
        !            87:     will be registered as en0, en1, etc. */
        !            88: 
        !            89:     virtual const char * getNamePrefix() const;
        !            90: 
        !            91: protected:
        !            92: 
        !            93: /*! @function free
        !            94:     @abstract Frees the IOEthernetInterface instance.
        !            95:     @discussion The memory allocated for the arpcom structure is released. */
        !            96: 
        !            97:     virtual void free();
        !            98: 
        !            99: /*! @function performCommand
        !           100:     @abstract Handle commands from the network layer.
        !           101:     @discussion The handler for ioctl commands sent from the network layer.
        !           102:     Commands not handled by this method are passed to our superclass.
        !           103:     The ioctl commands handled are SIOCSIFADDR, SIOCSIFFLAGS, SIOCADDMULTI, 
        !           104:     and SIOCDELMULTI.
        !           105:     @param controller The controller object that the interface is attached to.
        !           106:     @param cmd The command code.
        !           107:     @param arg0 Command argument. Generally a pointer to an ifnet structure.
        !           108:     @param arg1 Command argument.
        !           109:     @result An error code defined in errno.h (BSD). */
        !           110: 
        !           111:     virtual SInt performCommand(IONetworkController * controller,
        !           112:                                 UInt32                cmd,
        !           113:                                 void *                arg0,
        !           114:                                 void *                arg1);
        !           115: 
        !           116: /*! @function controllerDidOpen
        !           117:     @abstract Prepare the controller after it has been opened.
        !           118:     @discussion This method will be called by our superclass after a
        !           119:     network controller has accepted an open from this interface.
        !           120:     IOEthernetInterface uses this method to inspect the controller
        !           121:     and to cache certain controller properties, such as its hardware
        !           122:     address, and its set of supported packet filters.
        !           123:     @param controller The controller object that was opened.
        !           124:     @result true if the controller was accepted, false otherwise
        !           125:     (which will cause the controller to be closed). */
        !           126: 
        !           127:     virtual bool controllerDidOpen(IONetworkController * controller);
        !           128: 
        !           129: /*! @function controllerWillClose
        !           130:     @abstract Quiesce the controller before it is closed.
        !           131:     @discussion When the last close from our client is received, the
        !           132:     interface object will close its controller. But before the controller
        !           133:     is closed, this method will be called by our superclass to perform any 
        !           134:     final cleanup. IOEthernetInterface will ensure that the controller
        !           135:     is disabled before it is closed.
        !           136:     @param controller The currently opened controller object. */
        !           137: 
        !           138:     virtual void controllerWillClose(IONetworkController * controller);
        !           139: 
        !           140: /*! @function initIfnet
        !           141:     @abstract Initialize the ifnet structure.
        !           142:     @discussion The argument is
        !           143:     a pointer to an ifnet structure obtained through getIfnet().
        !           144:     IOEthernetInterface will initialize this structure in a manner that
        !           145:     is appropriate for Ethernet interfaces, then call super::initIfnet()
        !           146:     to allow the superclass to perform family independent initialization.
        !           147:     @param ifp Pointer to the ifnet structure to be initialized.
        !           148:     @result true if successful, false otherwise. */
        !           149: 
        !           150:     virtual bool initIfnet(struct ifnet * ifp);
        !           151: 
        !           152: /*! @function getIfnet
        !           153:     @abstract Get the ifnet structure allocated by the interface object.
        !           154:     @discussion This method returns a pointer to an ifnet structure
        !           155:     maintained by the family specific interface. IOEthernetInterface
        !           156:     allocates an arpcom structure during initialization, and returns
        !           157:     a pointer to this structure when this method is called.
        !           158:     @result Pointer to an ifnet structure. */
        !           159: 
        !           160:     virtual struct ifnet * getIfnet() const;
        !           161: };
        !           162: 
        !           163: #endif /* !_IOETHERNETINTERFACE_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.