ADC Home > Reference Library > Reference > Hardware & Drivers > I/O Kit Framework Reference
|
IOStreamLib.h |
Includes: |
<sys/cdefs.h> <IOKit/IOKitLib.h> <IOKit/IOCFPlugIn.h> <CoreFoundation/CoreFoundation.h> <IOKit/stream/IOStreamShared.h> |
IOCFPlugin library for using IOStream objects.
The IOStream plugin provides a convenient set of functions for accessing and manipulating IOStream objects from user programs.
- SendInputNotification
Send a notification to the kernel side of the IOStream that data is available in the input queue.
- SendInputSyncNotification
Notify the kernel side of the stream that input is ready by using a fast trap to call directly into the stream user client driver. This will transfer control to the kernel and continue executing on your same thread, rather than sending the notification to a separate thread.
convenience functions
- DequeueOutputEntry
Get the next IOStreamBufferQueueEntry available from the output queue.
- EnqueueInputBuffer
Send a buffer to the kernel side of the IOStream on the input queue.
- EnqueueInputEntry
- GetBufferCount
Gets the number of buffers in the stream.
- GetBufferInfo
Gets information about a buffer in an IOStream.
- GetControlBuffer
Get a pointer to the control area of an IOStreamBuffer.
- GetControlBufferLength
Get the length of the control area of an IOStreamBuffer.
- GetDataBuffer
Get a pointer to the data area of an IOStreamBuffer.
- GetDataBufferLength
Get the length of the data area of an IOStreamBuffer.
- GetMode
- GetMode()
- SetMode
- SetMode()
- StartStream
- StartStream()
- StopStream
- StopStream()
- SuspendStream
- SuspendStream()
and closing streams
loop operations
- AddToRunLoop
Add the CFRunLoopSource for the notification port to a run loop.
- GetRunLoopSource
Gets a CFRunLoopSource for the CFMachPort used for notifications from the kernel that data is ready.
- RemoveFromRunLoop
Remove the CFRunLoopSource for the notification port from a run loop.
and output
- GetInputPort
Get the notification port for buffers moving in from user to kernel space.
- GetInputQueue
Get the shared memory queue for buffers moving in from user to kernel space.
- GetOutputPort
Get the notification port for buffers moving out from kernel to user space.
- GetOutputQueue
Get the shared memory queue for buffers moving out from kernel to user space.
- SetOutputCallback
Set the callback function to be called when a new buffer is available from the kernel.
Add the CFRunLoopSource for the notification port to a run loop.
Closes an IOStream.
Get the next IOStreamBufferQueueEntry available from the output queue.
Send a buffer to the kernel side of the IOStream on the input queue.
Gets the number of buffers in the stream.
Gets information about a buffer in an IOStream.
Get a pointer to the control area of an IOStreamBuffer.
Get the length of the control area of an IOStreamBuffer.
Get a pointer to the data area of an IOStreamBuffer.
Get the length of the data area of an IOStreamBuffer.
Get the notification port for buffers moving in from user to kernel space.
Get the shared memory queue for buffers moving in from user to kernel space.
Get the notification port for buffers moving out from kernel to user space.
Get the shared memory queue for buffers moving out from kernel to user space.
Gets a CFRunLoopSource for the CFMachPort used for notifications from the kernel that data is ready.
Open an IOStream from user space.
Remove the CFRunLoopSource for the notification port from a run loop.
Send a notification to the kernel side of the IOStream that data is available in the input queue.
Notify the kernel side of the stream that input is ready by using a fast trap to call directly into the stream user client driver. This will transfer control to the kernel and continue executing on your same thread, rather than sending the notification to a separate thread.
Set the callback function to be called when a new buffer is available from the kernel.
AddToRunLoop |
Add the CFRunLoopSource for the notification port to a run loop.
IOReturn ( *AddToRunLoop)( IOStreamRef stream, CFRunLoopRef runLoop );
stream
The IOStreamRef of the stream to operate on.
runLoop
The run loop to which to add the notification source.
Returns kIOReturnSuccess if the source was successfully added to the run loop.
Close |
Closes an IOStream.
IOReturn ( *Close)( IOStreamRef stream );
stream
The IOStreamRef of the stream to close.
Returns kIOReturnSuccess if the stream was successfully closed and the buffers unmapped.
Calling Close umaps all shared memory for the stream and frees all user resources used by the stream.
DequeueOutputEntry |
Get the next IOStreamBufferQueueEntry available from the output queue.
IOReturn ( *DequeueOutputEntry)( IOStreamRef stream, IOStreamBufferQueueEntry *entry );
stream
The IOStreamRef of the stream to operate on.
entry
A pointer to an IOStreamBufferQueueEntry structure. The next available entry from the output queue will be copied into it.
The IOStreamBufferID of the next available buffer, or kInvalidIOStreamBufferID if no buffer is in the queue.
EnqueueInputBuffer |
Send a buffer to the kernel side of the IOStream on the input queue.
IOReturn ( *EnqueueInputBuffer)( IOStreamRef stream, IOStreamBufferID bufferID, IOByteCount dataOffset, IOByteCount dataLength, IOByteCount controlOffset, IOByteCount controlLength );
stream
The IOStreamRef of the stream to operate on.
bufferID
The IOStreamBufferID of the buffer to place on the queue.
dataLength
The length of the valid data in the buffer.
Returns kIOReturnSuccess if the buffer was successfully placed on the input queue.
EnqueueInputEntry |
IOReturn ( *EnqueueInputEntry)( IOStreamRef stream, IOStreamBufferQueueEntry *entry);
GetBufferCount |
Gets the number of buffers in the stream.
IOItemCount ( *GetBufferCount)( IOStreamRef stream );
stream
The IOStreamRef of the stream to operate on.
Returns then number of buffers in the stream.
GetBufferInfo |
Gets information about a buffer in an IOStream.
IOReturn ( *GetBufferInfo)( IOStreamRef stream, IOStreamBufferID bufferID, void **dataBufferAddressOut, IOByteCount *dataBufferSizeOut, void **controlBufferAddressOut, IOByteCount *controlBufferSizeOut );
stream
The IOStreamRef of the stream to operate on.
bufferID
dataBufferAddressOut
dataBufferSizeOut
controlBufferAddressOut
controlBufferSizeOut
Returns kIOReturnSuccess if the buffer ID was valid.
GetControlBuffer |
Get a pointer to the control area of an IOStreamBuffer.
void *( *GetControlBuffer)( IOStreamRef stream, IOStreamBufferID bufferID );
stream
The IOStreamRef of the stream owning the buffer.
buffer
The IOStreamBufferID of the buffer to operate on.
A pointer to the control buffer area of the IOStreamBuffer, or NULL if it does not have a control buffer.
GetControlBufferLength |
Get the length of the control area of an IOStreamBuffer.
IOByteCount ( *GetControlBufferLength)( IOStreamRef stream, IOStreamBufferID bufferID );
stream
The IOStreamRef of the stream owning the buffer.
bufferID
The IOStreamBufferID of the buffer to operate on.
The length in bytes of the control buffer, or 0 if there is no control buffer.
GetDataBuffer |
Get a pointer to the data area of an IOStreamBuffer.
void *( *GetDataBuffer)( IOStreamRef stream, IOStreamBufferID bufferID );
stream
The IOStreamRef of the stream owning the buffer.
bufferID
The IOStreamBufferID of the buffer to operate on.
A pointer to the data buffer area of the IOStreamBuffer, or NULL if it does not have a data buffer.
GetDataBufferLength |
Get the length of the data area of an IOStreamBuffer.
IOByteCount ( *GetDataBufferLength)( IOStreamRef stream, IOStreamBufferID bufferID );
stream
The IOStreamRef of the stream owning the buffer.
bufferID
The IOStreamBufferID of the buffer to operate on.
The length in bytes of the data buffer, or 0 if there is no data buffer.
GetInputPort |
Get the notification port for buffers moving in from user to kernel space.
CFMachPortRef ( *GetInputPort)( IOStreamRef stream );
stream
The IOStreamRef of the stream to operate on.
A CFMachPortRef for the input notification port.
GetInputQueue |
Get the shared memory queue for buffers moving in from user to kernel space.
IOStreamBufferQueue *( *GetInputQueue)( IOStreamRef stream );
stream
The IOStreamRef of the stream to operate on.
A pointer to the shared memory IOStreamBufferQueue structure for the input queue.
If you use the notification functions, you should never need to access the queues directly.
GetMode |
IOStreamMode ( *GetMode)( IOStreamRef stream );
GetMode() |
IOStreamMode ( *GetMode)( IOStreamRef stream );
GetOutputPort |
Get the notification port for buffers moving out from kernel to user space.
CFMachPortRef ( *GetOutputPort)( IOStreamRef stream );
stream
The IOStreamRef of the stream to operate on.
A CFMachPortRef of the output notification port.
GetOutputQueue |
Get the shared memory queue for buffers moving out from kernel to user space.
IOStreamBufferQueue *( *GetOutputQueue)( IOStreamRef stream );
stream
The IOStreamRef of the stream to operate on.
A pointer to the shared memory IOStreamBufferQueue structure for the output queue.
If you use the notification functions, you should never need to access the queues directly.
GetRunLoopSource |
Gets a CFRunLoopSource for the CFMachPort used for notifications from the kernel that data is ready.
CFRunLoopSourceRef ( *GetRunLoopSource)( IOStreamRef stream );
stream
The IOStreamRef of the stream to operate on.
The CFRunLoopSourceRef for the run loop source, or NULL if there was an error creating the source.
Open |
Open an IOStream from user space.
IOReturn ( *Open)( IOStreamRef stream, IOOptionBits options );
stream
The reference to the stream returned by QueryInterface.
options
Open options. Currently unused.
If the stream could not be opened or the buffers could not be mapped, an error will be returned.
The Open function opens the stream and maps the memory for the shared input and output queues into the current task, as well as the memory for all the buffers in the queue. It also creates the notification ports for input and output.
RemoveFromRunLoop |
Remove the CFRunLoopSource for the notification port from a run loop.
IOReturn ( *RemoveFromRunLoop)( IOStreamRef stream, CFRunLoopRef runLoop );
stream
The IOStreamRef of the stream to operate on.
runLoop
The run loop from which to remove the notification source.
Returns kIOReturnSuccess if the source was successfully removed from the run loop.
SendInputNotification |
Send a notification to the kernel side of the IOStream that data is available in the input queue.
IOReturn ( *SendInputNotification)( IOStreamRef stream, UInt32 token );
stream
The IOStreamRef of the stream to operate on.
token
A value to pass to the stream's notification function. This is unused by IOStream but may be used by subclasses.
Returns kIOReturnSuccess if the notification was successfully sent.
SendInputSyncNotification |
Notify the kernel side of the stream that input is ready by using a fast trap to call directly into the stream user client driver. This will transfer control to the kernel and continue executing on your same thread, rather than sending the notification to a separate thread.
IOReturn ( *SendInputSyncNotification)( IOStreamRef stream, UInt32 token );
stream
The IOStreamRef of the stream to operate on.
token
A value to pass to the stream's notification function. This is unused by IOStream but may be used by subclasses.
Returns kIOReturnSuccess if the notification was successfully sent.
SetMode |
IOReturn ( *SetMode)( IOStreamRef stream, IOStreamMode mode );
SetMode() |
IOReturn ( *SetMode)( IOStreamRef stream, IOStreamMode mode );
SetOutputCallback |
Set the callback function to be called when a new buffer is available from the kernel.
IOReturn ( *SetOutputCallback)( IOStreamRef stream, IOStreamOutputCallback callback, void *context );
stream
The IOStreamRef of the stream to operate on. Pass NULL to remove the callback.
Returns kIOReturnSuccess if the callback was successfully set or removed.
StartStream |
IOReturn ( *StartStream)( IOStreamRef stream );
StartStream() |
IOReturn ( *StartStream)( IOStreamRef stream );
StopStream |
IOReturn ( *StopStream)( IOStreamRef stream );
StopStream() |
IOReturn ( *StopStream)( IOStreamRef stream );
SuspendStream |
IOReturn ( *SuspendStream)( IOStreamRef stream );
SuspendStream() |
IOReturn ( *SuspendStream)( IOStreamRef stream );
IOStreamCallback |
typedef void ( *IOStreamOutputCallback) ( IOStreamRef stream, void *context );
IOStreamOutputCallback |
typedef void ( *IOStreamOutputCallback) ( IOStreamRef stream, void *context );
IOStreamRef |
typedef struct IOStreamInterface_v1_t ** IOStreamRef;
|
Last Updated: 2009-02-23