diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/gpxe/linebuf.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/include/gpxe/linebuf.h b/src/include/gpxe/linebuf.h new file mode 100644 index 000000000..72b477526 --- /dev/null +++ b/src/include/gpxe/linebuf.h @@ -0,0 +1,37 @@ +#ifndef _GPXE_LINEBUF_H +#define _GPXE_LINEBUF_H + +/** @file + * + * Line buffering + * + */ + +#include <stdint.h> +#include <stddef.h> + +/** A line buffer */ +struct line_buffer { + /** Current data in the buffer */ + char *data; + /** Length of current data */ + size_t len; + /** Bitmask of terminating characters to skip over */ + unsigned int skip_terminators; +}; + +/** + * Retrieve buffered-up line + * + * @v linebuf Line buffer + * @ret line Buffered line, or NULL if no line present + */ +static inline char * buffered_line ( struct line_buffer *linebuf ) { + return linebuf->data; +} + +extern int line_buffer ( struct line_buffer *linebuf, const char *data, + size_t len ); +extern void empty_line_buffer ( struct line_buffer *linebuf ); + +#endif /* _GPXE_LINEBUF_H */ |
