|
ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference
|
IONetworkData |
| Inherits from: | |
| Declared In: |
An object that manages a fixed-size named buffer.
An IONetworkData object manages a fixed-size named buffer. This object provides external access methods that can be used to access the contents of the data buffer. In addition, serialization is supported, and therefore this object can be added to a property table to publish the data object. An unique name must be assigned to the object during initialization. An OSSymbol key will be created based on the assigned name, and this key can be used when the object is added to a dictionary.
The level of access granted to the access methods can be restricted, by specifying a set of supported access types when the object is initialized, or modified later by calling setAccessTypes(). By default, each IONetworkData object created will support serialization, and will also allow its data buffer to be read through the read() access method.
An access notification handler, in the form of a 'C' function, can be registered to receive a call each time the data buffer is accessed through an access method. Arguments provided to the handler will identify the data object and the type of access that triggered the notification. The handler can therefore perform lazy update of the data buffer until an interested party tries to read or serialize the data. The notification handler can also take over the default action performed by the access methods when the buffer type is set to kIONetworkDataBufferTypeNone. This will prevent the access methods from accessing the data buffer, and allow the handler to override the access protocol.
This object is primarily used by IONetworkInterface to export interface properties to user space.
serialize |
Serializes the IONetworkData object.
public
typedef IOReturn ( *Action)( void *target, void *param, IONetworkData *data, UInt32 accessType, void *buffer, UInt32 *bufferSize, UInt32 offset); protected: const OSSymbol * _key; // key associated with this object. UInt32 _access; // supported access types. void * _buffer; // Data buffer. UInt32 _bufType; // buffer type UInt32 _size; // data buffer size. void * _tapTarget; // target for access notification. Action _tapAction; // the function to call. void * _tapParam; // arbitrary notification param. struct ExpansionData { }; ExpansionData * _reserved; virtual void free(); virtual bool writeBytes( const void * srcBuffer, UInt32 srcBufferSize, UInt32 writeOffset = 0); virtual bool readBytes( void *dstBuffer, UInt32 *dstBufferSize, UInt32 readOffset = 0) const; virtual bool clearBuffer(); public: static IONetworkData * withInternalBuffer( const char * name, UInt32 bufferSize, UInt32 accessTypes = (kIONetworkDataAccessTypeRead | kIONetworkDataAccessTypeSerialize), void * target = 0, Action action = 0, void *param = 0); static IONetworkData * withExternalBuffer( const char * name, UInt32 bufferSize, void * externalBuffer, UInt32 accessTypes = (kIONetworkDataAccessTypeRead | kIONetworkDataAccessTypeSerialize), void * target = 0, Action action = 0, void *param = 0); static IONetworkData * withNoBuffer( const char * name, UInt32 bufferSize, UInt32 accessTypes, void * target, Action action, void * param = 0); virtual bool init( const char * name, UInt32 bufferType, UInt32 bufferSize, void * externalBuffer = 0, UInt32 accessTypes = ( kIONetworkDataAccessTypeRead | kIONetworkDataAccessTypeSerialize), void *target = 0, Action action = 0, void *param = 0); virtual void setAccessTypes( UInt32 types); virtual void setNotificationTarget( void *target, Action action, void *param = 0); virtual const void * getBuffer() const; virtual UInt32 getBufferType() const; virtual UInt32 getAccessTypes() const; virtual void * getNotificationTarget() const; virtual Action getNotificationAction() const; virtual void * getNotificationParameter() const; virtual const OSSymbol * getKey() const; virtual UInt32 getSize() const; virtual IOReturn reset(); virtual IOReturn read( void *dstBuffer, UInt32 *dstBufferSize, UInt32 readOffset = 0); virtual IOReturn write( void *srcBuffer, UInt32 srcBufferSize, UInt32 writeOffset = 0); virtual bool serialize( OSSerialize *s) const; // Virtual function padding OSMetaClassDeclareReservedUnused( IONetworkData, 0); OSMetaClassDeclareReservedUnused( IONetworkData, 1); OSMetaClassDeclareReservedUnused( IONetworkData, 2); OSMetaClassDeclareReservedUnused( IONetworkData, 3); }
targetThe target of the notification.
dataThe IONetworkData object being accessed, and the sender of the notification.
accessTypeA bit will be set indicating the type of access which triggered the notification.
bufferPointer to the accessor's buffer. Only valid for read() and write() accesses.
bufferSizePointer to the size of the accessor's buffer.
offsetAn offset from the start of the data buffer to begin reading or writing.
srcBufferPointer to a source buffer provided by the caller.
srcBufferSizeThe size of the source buffer.
writeOffsetA byte offset from the start of the data buffer to begin writting.
dstBufferPointer to the destination buffer.
dstBufferSizePointer to an integer containing the size of the destination buffer. And is overwritten by this method with the actual number of bytes copied to the destination buffer.
readOffsetA byte offset from the start of the data buffer to begin reading.
nameA name to assign to this object.
bufferSizeThe number of bytes to allocate for the internal data buffer.
accessTypesThe initial supported access types.
targetThe notification target.
actionThe notification action.
nameA name to assign to this object.
bufferSizeThe size of the external data buffer.
externalBufferPointer to the external data buffer.
accessTypesThe initial supported access types.
targetThe notification target.
actionThe notification action.
nameA name to assign to this object.
bufferSizeThe size of the phantom data buffer.
accessTypesThe initial supported access types.
targetThe notification target.
actionThe notification action.
nameA name to assign to this object.
bufferTypeThe type of buffer associated with this object.
bufferSizeThe size of the data buffer.
externalBufferPointer to an external data buffer.
accessTypesThe initial supported access types. Can be later modified by calling setAccessTypes().
targetThe notification target.
actionThe notification action.
typesA mask of access types indicating the supported access types.
targetThe first parameter passed to the notification handler.
actionA pointer to a C function that will handle the notification. If 0, then notification is disabled.
dstBufferPointer to the destination buffer.
dstBufferSizePointer to an integer containing the size of the destination buffer. And is overwritten by this method to the actual number of bytes copied to the destination buffer.
readOffsetAn offset from the start of the source data buffer to begin reading.
srcBufferPointer to the source buffer.
srcBufferSizeThe number of bytes to write to the data buffer.
writeOffsetAn offset from the start of the destination data buffer to begin writing.
sAn OSSerialize object.
paramA parameter that was provided when the notification handler was registered.
paramA parameter to pass to the notification action.
paramA parameter to pass to the notification action.
paramA parameter to pass to the notification action.
paramA parameter to pass to the notification action.
paramAn optional parameter passed to the notification handler.
Returns true on success, false otherwise.
If notification is enabled, then the notification handler is called just before the data buffer is serialized.
|
Last Updated: 2009-02-23