--- a/src/line_proto.h Tue Mar 10 03:29:53 2009 +0200
+++ b/src/line_proto.h Tue Mar 10 03:38:20 2009 +0200
@@ -1,38 +1,42 @@
#ifndef LINE_PROTO_H
#define LINE_PROTO_H
-/*
+/**
+ * @file
+ *
* Support for protocols that send/receive lines
*/
#include "sock.h"
#include "error.h"
-/*
- * The state handle
+/**
+ * The line_proto state handle
*/
struct line_proto;
-/*
- * The callback for receiving lines
+/**
+ * User callback list
*/
-typedef void (*line_proto_read_cb)(char *line, void *arg);
+struct line_proto_callbacks {
+ /** Handle received line */
+ void (*on_line) (char *line, void *arg);
+
+};
/**
* Create a new line_proto off the the given sock_stream. The newly allocated line_proto will be returned via *lp_ptr.
*
* The incoming lines are buffered in a buffer of \a buf_size bytes. This imposes a maximum limit on the line length.
*
- * The given callback function/argument will be used to provide event-based recv support.
- *
* @param lp_ptr a pointer to the new line_proto will be returned via this pointer
* @param sock the sock_stream to use
* @param buf_size the incoming/outgoing buffer size, should be enough to hold the biggest possible line
- * @param cb_func the read_cb callback
+ * @param callbacks the callback struct to use
* @param cb_arg the read_cb callback argument
* @param err error information is returned via this pointer
*/
err_t line_proto_create (struct line_proto **lp_ptr, struct sock_stream *sock, size_t buf_size,
- line_proto_read_cb cb_func, void *cb_arg, struct error_info *err);
+ const struct line_proto_callbacks *callbacks, void *cb_arg, struct error_info *err);
/**
* Runs the socket recv() into our internal buffer. If a full line was received, a pointer to our internal bufffer is