iPXE
linebuf.h
Go to the documentation of this file.
1 #ifndef _IPXE_LINEBUF_H
2 #define _IPXE_LINEBUF_H
3 
4 /** @file
5  *
6  * Line buffering
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <stdint.h>
13 #include <stddef.h>
14 
15 /** A line buffer */
16 struct line_buffer {
17  /** Data buffer */
18  char *data;
19  /** Length of buffered data */
20  size_t len;
21  /** Most recently consumed length */
22  size_t consumed;
23 };
24 
25 extern char * buffered_line ( struct line_buffer *linebuf );
26 extern int line_buffer ( struct line_buffer *linebuf,
27  const char *data, size_t len );
28 extern void empty_line_buffer ( struct line_buffer *linebuf );
29 
30 #endif /* _IPXE_LINEBUF_H */
char * buffered_line(struct line_buffer *linebuf)
Retrieve buffered-up line.
Definition: linebuf.c:45
void empty_line_buffer(struct line_buffer *linebuf)
Discard line buffer contents.
Definition: linebuf.c:65
size_t consumed
Most recently consumed length.
Definition: linebuf.h:22
char * data
Data buffer.
Definition: linebuf.h:18
size_t len
Length of buffered data.
Definition: linebuf.h:20
int line_buffer(struct line_buffer *linebuf, const char *data, size_t len)
Buffer up received data by lines.
Definition: linebuf.c:91
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint32_t len
Length.
Definition: ena.h:14
A line buffer.
Definition: linebuf.h:16
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12