src/msg_proto.h
branchnew-lib-errors
changeset 219 cefec18b8268
parent 218 5229a5d098b2
--- a/src/msg_proto.h	Thu May 28 00:35:02 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-#ifndef MSG_PROTO_H
-#define MSG_PROTO_H
-
-/**
- * @param
- *
- * Support for simple protocols that send/recieve length-prefixed messages over a transport stream.
- *
- * This implementation is mostly geared towards handling a reasonable number of reasonably sized messages in a
- * reasonable way. Hence, 
- */
-#include "transport.h"
-
-/** 
- * Protocol state struct
- */
-struct msg_proto;
-
-/**
- * User callbacks
- */
-struct msg_proto_callbacks {
-    /**
-     * Message recieved.
-     *
-     * XXX: currently you must not call msg_proto_destroy from within this callback
-     */
-    void (*on_msg) (struct msg_proto *proto, void *data, size_t len, void *arg);
-
-    /**
-     * Transport/protocol error occured in event handling.
-     */
-    void (*on_error) (struct msg_proto *proto, const error_t *err, void *arg);
-};
-
-/**
- * Create a msg_proto state using the given transport.
- *
- * This will install our callback handlers on the given transport.
- */
-err_t msg_proto_create (struct msg_proto **proto_ptr, transport_t *transport, const struct msg_proto_callbacks *cb_tbl, void *cb_arg, error_t *err);
-
-/**
- * Send a message to the other endpoint
- */
-err_t msg_proto_send (struct msg_proto *proto, const void *data, size_t len, error_t *err);
-
-/**
- * Destroy the protocol state and transport
- */
-void msg_proto_destroy (struct msg_proto *proto);
-
-
-#endif /* MSG_PROTO_H */