|
|
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: * HISTORY ! 26: * ! 27: */ ! 28: ! 29: #ifndef _IONETWORKUSERCLIENT_H ! 30: #define _IONETWORKUSERCLIENT_H ! 31: ! 32: // IONetworkUserClient type ID. ! 33: // ! 34: #define kIONUCType 0xff000001 ! 35: ! 36: // IONetworkUserClient call structure definitions. ! 37: // ! 38: enum { ! 39: kIONUCResetNetworkDataIndex = 0, ! 40: #define kIONUCResetNetworkDataInputs 1 ! 41: #define kIONUCResetNetworkDataOutputs 0 ! 42: #define kIONUCResetNetworkDataFlags kIOUCScalarIScalarO ! 43: ! 44: kIONUCWriteNetworkDataIndex = 1, ! 45: #define kIONUCWriteNetworkDataInput0 0xffffffff ! 46: #define kIONUCWriteNetworkDataInput1 0xffffffff ! 47: #define kIONUCWriteNetworkDataFlags kIOUCScalarIStructI ! 48: ! 49: kIONUCReadNetworkDataIndex = 2, ! 50: #define kIONUCReadNetworkDataInputs 1 ! 51: #define kIONUCReadNetworkDataOutputs 0xffffffff ! 52: #define kIONUCReadNetworkDataFlags kIOUCScalarIStructO ! 53: ! 54: kIONUCGetNetworkDataCapacityIndex = 3, ! 55: #define kIONUCGetNetworkDataCapacityInputs 1 ! 56: #define kIONUCGetNetworkDataCapacityOutputs 1 ! 57: #define kIONUCGetNetworkDataCapacityFlags kIOUCScalarIScalarO ! 58: ! 59: kIONUCGetNetworkDataHandleIndex = 4, ! 60: #define kIONUCGetNetworkDataHandleInputs 0xffffffff ! 61: #define kIONUCGetNetworkDataHandleOutputs 0xffffffff ! 62: #define kIONUCGetNetworkDataHandleFlags kIOUCStructIStructO ! 63: ! 64: kIONUCLastIndex ! 65: }; ! 66: ! 67: // Notification types. ! 68: // ! 69: enum { ! 70: kIONUCNotificationTypeLinkChange = 0xff000001, ! 71: }; ! 72: ! 73: typedef struct _IONetworkNotifyMsg { ! 74: mach_msg_header_t h; ! 75: // msg_type_t ref; ! 76: } IONetworkNotifyMsg; ! 77: ! 78: #ifdef KERNEL ! 79: ! 80: #include <IOKit/IOUserClient.h> ! 81: ! 82: class IONetworkInterface; ! 83: class IONetworkController; ! 84: ! 85: /*! @class IONetworkUserClient ! 86: @abstract An IOUserClient created by an IONetworkInterface to ! 87: manage user space requests. */ ! 88: ! 89: class IONetworkUserClient : public IOUserClient ! 90: { ! 91: OSDeclareDefaultStructors(IONetworkUserClient) ! 92: ! 93: protected: ! 94: IONetworkInterface * _owner; ! 95: IONetworkController * _ctlr; ! 96: mach_port_t _notifyPort; ! 97: task_t _task; ! 98: IOExternalMethod _methods[kIONUCLastIndex]; ! 99: ! 100: /*! @function ! 101: @abstract Free the IONetworkUserClient instance. */ ! 102: ! 103: virtual void free(); ! 104: ! 105: public: ! 106: ! 107: /*! @function withTask ! 108: @abstract Factory method that performs allocation and initialization ! 109: of an IONetworkUserClient instance. ! 110: @param owningTask See IOUserClient. ! 111: @result An IONetworkUserClient on success, 0 otherwise. */ ! 112: ! 113: static IONetworkUserClient * withTask(task_t owningTask); ! 114: ! 115: /*! @function start ! 116: @abstract Start the IONetworkUserClient. ! 117: @discussion Open the provider, must be an IONetworkInterface object, ! 118: and initialize the IOExternalMethod array. ! 119: @result true on success, false otherwise. */ ! 120: ! 121: virtual bool start(IOService * provider); ! 122: ! 123: /*! @function clientClose ! 124: @abstract Handle a client close. ! 125: @discussion Close and detach from our owner (provider). ! 126: @result kIOReturnSuccess */ ! 127: ! 128: virtual IOReturn clientClose(); ! 129: ! 130: /*! @function clientDied ! 131: @abstract Handle client death. ! 132: @discussion Close and detach from our owner (provider). ! 133: @result kIOReturnSuccess */ ! 134: ! 135: virtual IOReturn clientDied(); ! 136: ! 137: /*! @function registerNotificationPort ! 138: @abstract Called by a client to register its notification port. ! 139: @param port A mach port where the notification message should be sent. ! 140: @param type The type of notification that the client is interested in. ! 141: @param refCon An argument to deliver with the notification. ! 142: @result kIOReturnUnsupported if the notification type is unknown, ! 143: kIOReturnSuccess otherwise. */ ! 144: ! 145: virtual IOReturn registerNotificationPort(mach_port_t port, ! 146: UInt32 type, ! 147: UInt32 refCon); ! 148: ! 149: /*! @function deliverNotification ! 150: @abstract Deliver a notification to the registered notification port. ! 151: @param type The type of notification being delivered. ! 152: @result kIOReturnSuccess on success, kIOReturnUnsupported if the ! 153: notification type is unknown, or kIOReturnError for a mach messaging ! 154: error. */ ! 155: ! 156: virtual IOReturn deliverNotification(UInt32 type); ! 157: ! 158: /*! @function getExternalMethodForIndex ! 159: @abstract Look up an entry from the method array. ! 160: @discussion Called by IOUserClient to fetch the method entry, ! 161: encoded by an IOExternalMethod structure, that correspond to ! 162: the index given. ! 163: @param index The method index. ! 164: @result A pointer to a IOExternalMethod structure containing the ! 165: method definition. */ ! 166: ! 167: virtual IOExternalMethod * getExternalMethodForIndex(UInt32 index); ! 168: ! 169: protected: ! 170: ! 171: /*! @function resetNetworkData ! 172: @abstract Fill the data buffer in an IONetworkData object with zeroes. ! 173: @param key The OSSymbol key of an IONetworkData object. ! 174: @result kIOReturnSuccess on success, kIOReturnBadArgument if an ! 175: argument is invalid, or an error from IONetworkData::reset(). */ ! 176: ! 177: virtual IOReturn resetNetworkData(OSSymbol * key); ! 178: ! 179: /*! @function writeNetworkData ! 180: @abstract Write to the data buffer in an IONetworkData object from ! 181: a buffer provided by the caller. ! 182: @param key The OSSymbol key of an IONetworkData object. ! 183: @param srcBuf The data to write is taken from this buffer. ! 184: @param inSize The size of the source buffer. ! 185: @result kIOReturnSuccess on success, kIOReturnBadArgument if an ! 186: argument is invalid, or an error from IONetworkData::write(). */ ! 187: ! 188: virtual IOReturn writeNetworkData(OSSymbol * key, ! 189: void * srcBuf, ! 190: IOByteCount inSize); ! 191: ! 192: /*! @function readNetworkData ! 193: @abstract Read (copy) the data buffer in an IONetworkData object to ! 194: a buffer provided by the caller. ! 195: @param key The OSSymbol key of an IONetworkData object. ! 196: @param destBuf The buffer where the data shall be written to. ! 197: @param inOutSize Pointer to an integer that the caller must initialize ! 198: to contain the size of the buffer. This method will overwrite it with ! 199: the actual number of bytes written to the buffer. ! 200: @result kIOReturnSuccess on success, kIOReturnBadArgument if an ! 201: argument is invalid, or an error from IONetworkData::read(). */ ! 202: ! 203: virtual IOReturn readNetworkData(OSSymbol * key, ! 204: void * destBuf, ! 205: IOByteCount * inOutSizeP); ! 206: ! 207: /*! @function getNetworkDataCapacity ! 208: @abstract Get the capacity of an IONetworkData object. ! 209: @param key The OSSymbol key of an IONetworkData object. ! 210: @param capacityP On success, the capacity is written to the integer ! 211: at this address. ! 212: @result kIOReturnSuccess on success, kIOReturnBadArgument if an ! 213: argument is invalid. */ ! 214: ! 215: virtual IOReturn getNetworkDataCapacity(OSSymbol * key, ! 216: UInt32 * capacityP); ! 217: ! 218: /*! @function getNetworkDataHandle ! 219: @abstract Return an opaque handle to a provider's IONetworkData object. ! 220: @discussion Called to obtain a handle that maps to an IONetworkData ! 221: object. This handle can be later passed to other methods in this class ! 222: to refer to the same object. ! 223: @param name A C string with the name of the IONetworkData object. ! 224: @param handle If an IONetworkData object with the given name is found, ! 225: then its associated OSSymbol object is written to this address. ! 226: @param nameSize The size of the name string, including the final ! 227: null character. ! 228: @param handleSizeP The size of the buffer allocated by the caller ! 229: to store the handle. This should be 4 bytes. ! 230: @result kIOReturnSuccess on success, kIOReturnBadArgument if an ! 231: argument is invalid, or kIOReturnNoMemory if unable to allocate memory. */ ! 232: ! 233: virtual IOReturn getNetworkDataHandle(char * name, ! 234: OSObject ** handle, ! 235: IOByteCount nameSize, ! 236: IOByteCount * handleSizeP); ! 237: }; ! 238: ! 239: #endif /* KERNEL */ ! 240: ! 241: #endif /* !_IONETWORKUSERCLIENT_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.