changeset 32:3cb72d649e94

Added a new function to the peer module
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 19 Jun 2008 15:52:24 +0900
parents a479cd3c52cd
children 4618f77f138e
files waaad/peer.c waaad/peer.h
diffstat 2 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/waaad/peer.c	Thu Jun 19 14:07:32 2008 +0900
+++ b/waaad/peer.c	Thu Jun 19 15:52:24 2008 +0900
@@ -147,3 +147,10 @@
 	TRACE_DEBUG (FULL, "@@@ %s: not implemented yet.", __FUNCTION__ );
 	return ENOTSUP;
 }
+
+/* Queue a message in the given peer */
+int peer_send ( peer_t * peer, msg_t * msg )
+{
+	TRACE_DEBUG (FULL, "@@@ %s: not implemented yet.", __FUNCTION__ );
+	return ENOTSUP;
+}
--- a/waaad/peer.h	Thu Jun 19 14:07:32 2008 +0900
+++ b/waaad/peer.h	Thu Jun 19 15:52:24 2008 +0900
@@ -44,6 +44,9 @@
 /* Include the API for the peer manager */
 #include <waaad/peer-api.h>
 
+/* Include the definition of msg_t */
+#include <waaad/message-api.h>
+
 /* Functions called only in the daemon */
 
 /*
@@ -96,6 +99,27 @@
 int peer_start ( void );
 
 
+/*
+ * FUNCTION:	peer_send
+ *
+ * PARAMETERS:
+ *  peer  : The peer to which the message must be sent.
+ *  msg   : The message that must be sent. 
+ *
+ * DESCRIPTION: 
+ *   Queue a message for sending to a specific peer.
+ *  If the peer is not in OPEN state, an error is returned.
+ *  msg_update_length is called on the message, then it is queued and sent asynchronously.
+ *  If an error occurs while the message is being sent, the caller of this function is not notified.
+ *
+ * RETURN VALUE:
+ *  0        : The message has been queued.
+ *  EINVAL   : a parameter is invalid.
+ *  ENOTCONN : the peer is not in OPEN state.
+ */
+int peer_send ( peer_t * peer, msg_t * msg );
+
+
 
 #endif /* ! _PEER_H */
 
"Welcome to our mercurial repository"