|
uBlink
0.0.1
TheBlinkProtocol
|
Configurable IO streams.
Functions | |
| bool | BLINK_Stream_write (blink_stream_t self, const void *buf, size_t nbyte) |
| Write to a stream. More... | |
| bool | BLINK_Stream_read (blink_stream_t self, void *buf, size_t nbyte) |
| Read from a stream. More... | |
| bool | BLINK_Stream_peek (blink_stream_t self, void *buf) |
| Read next byte in stream without removing it. More... | |
| blink_stream_t | BLINK_Stream_initBufferReadOnly (struct blink_stream *self, const void *buf, uint32_t max) |
| Init a read only buffer stream. More... | |
| blink_stream_t | BLINK_Stream_initBuffer (struct blink_stream *self, void *buf, uint32_t max) |
| Init a read/write buffer stream. More... | |
| blink_stream_t | BLINK_Stream_initUser (struct blink_stream *self, void *state, struct blink_stream_user fn) |
| Init a user defined stream. More... | |
| blink_stream_t | BLINK_Stream_initBounded (struct blink_stream *self, blink_stream_t stream, uint32_t max) |
| Init a bounded stream. More... | |
| uint32_t | BLINK_Stream_tell (blink_stream_t self) |
| Get current position. More... | |
| bool | BLINK_Stream_seekSet (blink_stream_t self, uint32_t offset) |
| Set position to offset. More... | |
| bool | BLINK_Stream_seekCur (blink_stream_t self, int32_t offset) |
| Add offset to current position. More... | |
| bool | BLINK_Stream_eof (blink_stream_t self) |
| Check if stream has reached EOF. More... | |
| size_t | BLINK_Stream_max (blink_stream_t self) |
| Return the maximum position of the stream. More... | |
Data Structures | |
| struct | blink_stream_user |
| struct | blink_stream |
Typedefs | |
| typedef struct blink_stream * | blink_stream_t |
| struct blink_stream |
| Data Fields | ||
|---|---|---|
| blink_stream_type | ||
| Data Fields | ||
|---|---|---|
| enum blink_stream_type | type | |
| union blink_stream_state | value | |
| bool BLINK_Stream_eof | ( | blink_stream_t | self | ) |
Check if stream has reached EOF.
| [in] | self |
| blink_stream_t BLINK_Stream_initBounded | ( | struct blink_stream * | self, |
| blink_stream_t | stream, | ||
| uint32_t | max | ||
| ) |
Init a bounded stream.
| [in] | self | |
| [in] | stream | stream to bound |
| [in] | max | stream is allowed to read/seek within range (cur .. cur + max) bytes |
| blink_stream_t BLINK_Stream_initBuffer | ( | struct blink_stream * | self, |
| void * | buf, | ||
| uint32_t | max | ||
| ) |
Init a read/write buffer stream.
| [in] | self | |
| [in] | buf | buffer |
| [in] | max | length of buffer |
| blink_stream_t BLINK_Stream_initBufferReadOnly | ( | struct blink_stream * | self, |
| const void * | buf, | ||
| uint32_t | max | ||
| ) |
Init a read only buffer stream.
| [in] | self | |
| [in] | buf | buffer |
| [in] | max | length of buffer |
| blink_stream_t BLINK_Stream_initUser | ( | struct blink_stream * | self, |
| void * | state, | ||
| struct blink_stream_user | fn | ||
| ) |
Init a user defined stream.
| [in] | self | |
| [in] | user | user state |
| [in] | fn | user defined functions |
| size_t BLINK_Stream_max | ( | blink_stream_t | self | ) |
Return the maximum position of the stream.
| [in] | self |
| 0 | stream doesn't have a maximum |
| bool BLINK_Stream_peek | ( | blink_stream_t | self, |
| void * | buf | ||
| ) |
Read next byte in stream without removing it.
| [in] | self | input stream |
| [out] | buf | single byte buffer |
| bool BLINK_Stream_read | ( | blink_stream_t | self, |
| void * | buf, | ||
| size_t | nbyte | ||
| ) |
Read from a stream.
| [in] | self | stream |
| [out] | buf | buffer of at least nbyte bytes |
| [in] | nbyte | number of bytes to read |
| bool BLINK_Stream_seekCur | ( | blink_stream_t | self, |
| int32_t | offset | ||
| ) |
Add offset to current position.
i.e. seek relative to current stream position
| [in] | self | |
| [in] | offset | byte offset to add to current position |
| bool BLINK_Stream_seekSet | ( | blink_stream_t | self, |
| uint32_t | offset | ||
| ) |
Set position to offset.
i.e. seek relative to start of stream
| [in] | self | |
| [in] | offset | byte offset from origin |
| uint32_t BLINK_Stream_tell | ( | blink_stream_t | self | ) |
Get current position.
| [in] | self |
| bool BLINK_Stream_write | ( | blink_stream_t | self, |
| const void * | buf, | ||
| size_t | nbyte | ||
| ) |
Write to a stream.
| [in] | self | stream |
| [in] | buf | buffer to write |
| [in] | nbyte | number of bytes to write |