#ifndef LINE_PROTO_H
#define LINE_PROTO_H
/*
* Support for protocols that send/receive lines
*/
#include "sock.h"
#include "error.h"
/*
* The state handle
*/
struct line_proto;
/*
* Create a new line_proto off the the given sock_stream. The newly allocated line_proto will be returned via *lp_ptr.
*/
err_t line_proto_create (struct line_proto **lp_ptr, struct sock_stream *sock, struct error_info *err);
/*
* Receive one line into the given buffer. The line will be terminated with '\r\n', and said terminator will be
* NUL'd out, so the buffer is safe for use as a C-string after succesfull return.
*
* Note: currently this uses the buffer to store intermediate state, so always pass the same buffer (for now).
*/
err_t line_proto_read (struct line_proto *lp, char *buf, size_t len);
/*
* Get current error_info*
*/
const struct error_info* line_proto_error (struct line_proto *lp);
#endif /* LINE_PROTO_H */