2022-06-21 04:49:36 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: IOPipeRequest.hpp
|
|
|
|
Date: 2022-6-20
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Aurora::IO
|
|
|
|
{
|
|
|
|
struct IIOPipeEventListener;
|
|
|
|
|
|
|
|
struct IOPipeRequest
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @brief Amount of bytes to transfer or zero if run until EoS/EoF
|
|
|
|
*/
|
2022-08-29 15:46:46 +00:00
|
|
|
AuUInt32 uLengthOrZero {};
|
2022-06-21 04:49:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief true if the underlying stream uses relative stream positions
|
|
|
|
* (IE: a network or pipe stream that cannot seek backwards and fowards)
|
|
|
|
* (Inversely, file devices and similar IO subsystems use IO packets with absolute offsets)
|
|
|
|
*/
|
2022-08-29 15:46:46 +00:00
|
|
|
bool bIsStream {false};
|
2022-06-21 04:49:36 +00:00
|
|
|
|
|
|
|
/**
|
2022-07-20 14:10:07 +00:00
|
|
|
* @brief internal frame size, that is one iteration of file or stream read, in bytes or zero if fallback
|
|
|
|
* Windows is inclined to read every single requested byte of a file stream asynchronously
|
|
|
|
* Streams, on all platforms, yield as soon as there is data available to copy over (usually)
|
2022-06-21 04:49:36 +00:00
|
|
|
*/
|
2022-08-29 15:46:46 +00:00
|
|
|
AuUInt32 uPageLengthOrZero {};
|
2022-06-21 04:49:36 +00:00
|
|
|
|
2022-07-20 14:10:07 +00:00
|
|
|
/**
|
|
|
|
* @brief internal buffer size or zero if fallback
|
|
|
|
*/
|
2022-08-29 15:46:46 +00:00
|
|
|
AuUInt32 uBufferLengthOrZero {};
|
2022-07-20 14:10:07 +00:00
|
|
|
|
2022-06-21 04:49:36 +00:00
|
|
|
/**
|
|
|
|
* @brief event listener
|
|
|
|
*/
|
2022-08-29 15:46:46 +00:00
|
|
|
AuSPtr<IIOPipeEventListener> pListener;
|
2022-06-21 04:49:36 +00:00
|
|
|
|
2022-11-20 10:31:13 +00:00
|
|
|
/**
|
|
|
|
* @brief Minimum amount of bytes to read from the stream *if not identical to uLengthOrZero*
|
|
|
|
*
|
|
|
|
* Consider padded streams where only the content itself is read from a given interceptor;
|
|
|
|
* adjusting this variable permits for under-reads without failing the pipe transaction.
|
|
|
|
*
|
|
|
|
* Recommended: 0 -> use uLengthOrZero
|
|
|
|
*/
|
|
|
|
AuUInt32 uMinBytesToRead {};
|
|
|
|
|
2022-06-21 04:49:36 +00:00
|
|
|
/**
|
|
|
|
* @brief Used as the buffer size for streams of page length 0
|
|
|
|
*/
|
2022-07-20 14:10:07 +00:00
|
|
|
static const AuUInt32 kFallbackPageSize {1024 * 1024 * 5};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Used as the buffer size for streams of buffer length 0
|
|
|
|
*/
|
|
|
|
static const AuUInt32 kFallbackBufferSize {1024 * 1024 * 50};
|
2022-06-21 04:49:36 +00:00
|
|
|
};
|
|
|
|
}
|