Typedefs | |
typedef void(* | peak_stream_error_callback )(peak_stream s, int error_type, void *context) |
Error callback for write-buffered streams. | |
Enumerations | |
enum | { PEAK_STREAM_ERR_MAX_MSGBUF_EXCEEDED = -10001 } |
Possible error codes passed to your stream error callback function. More... | |
Functions | |
void | peak_stream_set_buffered (peak_stream s, int enable, size_t msg_size, size_t max_size, peak_stream_error_callback cb) |
Enable or disable buffered write mode for a specified stream. | |
void | peak_stream_msgbuf_get_info (peak_stream s, size_t *msg_size, size_t *max_msgs, size_t *alloc_msgs, size_t *queue_msgs, size_t *queue_size) |
Get info on current buffered write mode settings. | |
void | peak_stream_write_buffered (peak_stream s, const void *buffer, size_t bufsize) |
Copy and commit a buffer to the stream for writing. | |
void * | peak_stream_msgbuf_new (peak_stream s) |
Get a new message buffer. | |
void | peak_stream_msgbuf_commit (peak_stream s, void *buffer, int length) |
Commit a message buffer. | |
void | peak_stream_msgbuf_make (peak_stream s, const char *format,...) |
Make a formatted message buffer and commit it for writing. | |
void | peak_stream_msgbuf_vmake (peak_stream s, const char *format, va_list vl) |
Make a formatted message buffer and commit it for writing. |
|
Error callback for write-buffered streams.
Defines a pointer to your error handling callback function that will be triggered when a stream error happens. |
|
Possible error codes passed to your stream error callback function. These are currently only used with write-buffered configured streams. |
|
Commit a message buffer. After a message buffer (obtained with the help of peak_stream_msgbuf_new()) has been filled partially or completely, you MUST call this function to commit the message for sending. This function is O(1).
|
|
Get info on current buffered write mode settings. You may only call this function if the stream s is configured in write-buffered mode. msg_size and max_msgs can be configured using the peak_stream_set_buffered() function.
|
|
Make a formatted message buffer and commit it for writing. This convenience function allows you to write a formatted string to the stream in write-buffered mode.
|
|
Get a new message buffer. Low-level function to get a pointer to a new msgbuf, of msg_size bytes (previously configured with peak_stream_set_buffered()). This function is usually O(1), except for the few first calls or it needs to do real allocations. You can fill it partially or completely and then you MUST call peak_stream_msgbuf_commit() to commit the message for sending.
|
|
Make a formatted message buffer and commit it for writing. This convenience function allows you to write a formatted string to the stream in write-buffered mode.
|
|
Enable or disable buffered write mode for a specified stream.
|
|
Copy and commit a buffer to the stream for writing.
This is the write-buffered version of peak_stream_write(). If max_msgs (previously configured with peak_stream_set_buffered()) is not reached, this function will send the whole buffer without error.
|