#include <glib.h>
Go to the source code of this file.
Data Structures | |
struct | getline |
A getline "object". More... | |
Defines | |
#define | MAX_LINE_SIZE 1024 /**< Maximum length for regular line */ |
Maximum length for regular line. | |
#define | READ_MORE 0 /**< OK, expecting more */ |
OK, expecting more. | |
#define | READ_DONE 1 /**< OK, got whole line */ |
OK, got whole line. | |
#define | READ_OVERFLOW 2 /**< Reached max line size */ |
Reached max line size. | |
#define | getline_maxlen(o) ((o)->maxlen) |
Typedefs | |
typedef getline | getline_t |
A getline "object". | |
Functions | |
getline_t * | getline_make (gint maxsize) |
Create a new line reading object, capable of holding a line of at most `maxlen' bytes. | |
void | getline_free (getline_t *o) |
Destroy getline object. | |
void | getline_reset (getline_t *o) |
Prepare getline object for a new read cycle by forgetting whatever it currently holds. | |
gint | getline_read (getline_t *o, gchar *data, gint len, gint *used) |
Read line of a header from supplied buffer. | |
gchar * | getline_str (getline_t *o) |
gint | getline_length (getline_t *o) |
void | getline_copy (getline_t *source, getline_t *dest) |
Copy source into dest. |
|
|
|
Maximum length for regular line.
|
|
OK, got whole line.
|
|
OK, expecting more.
|
|
Reached max line size.
|
|
A getline "object".
|
|
Copy source into dest.
|
|
Destroy getline object.
|
|
|
|
Create a new line reading object, capable of holding a line of at most `maxlen' bytes.
|
|
Read line of a header from supplied buffer. We define a line as being something that ends with either "\r\n" or "\n". Although in the Gnutella world, everything is specified to use "\r\n", we must acknowledge the fact that we have to be liberal. In the UNIX world, lines end by "\n", and most Internet protocols (SMTP, NNTP, HTTP) allow for both endings. We read from `data', at most `len' bytes. If `used' is non-null, it is filled with the amount of bytes we effectively used, unless an error occurs. When READ_MORE is returned, it is guaranteed that used will be `len'. The trailing "\r\n" or "\n" is stripped from the accumulated line. |
|
Prepare getline object for a new read cycle by forgetting whatever it currently holds.
|
|
|