-shutdown completion callback
authorSree Harsha Totakura <totakura@in.tum.de>
Fri, 6 Apr 2012 07:46:24 +0000 (07:46 +0000)
committerSree Harsha Totakura <totakura@in.tum.de>
Fri, 6 Apr 2012 07:46:24 +0000 (07:46 +0000)
src/include/gnunet_stream_lib.h
src/stream/stream_api.c

index a16d052d65f5576e2d8ab887483af524274aaf65..4a574dfe447941adbe0b59ebd05b39613b0d9bf1 100644 (file)
@@ -130,16 +130,32 @@ GNUNET_STREAM_open (const struct GNUNET_CONFIGURATION_Handle *cfg,
 struct GNUNET_STREAM_ShutdownHandle;
 
 
+/**
+ * Completion callback for shutdown
+ *
+ * @param cls the closure from GNUNET_STREAM_shutdown call
+ * @param operation the operation that was shutdown (SHUT_RD, SHUT_WR,
+ *          SHUT_RDWR) 
+ */
+typedef void (*GNUNET_STREAM_ShutdownCompletion) (void *cls,
+                                                  int operation);
+
+
 /**
  * Shutdown the stream for reading or writing (man 2 shutdown).
  *
  * @param socket the stream socket
- * @param how SHUT_RD, SHUT_WR or SHUT_RDWR 
+ * @param opertion SHUT_RD, SHUT_WR or SHUT_RDWR
+ * @param completion_cb the callback that will be called upon successful
+ *          shutdown of given operation
+ * @param completion_cls the closure for the completion callback
  * @return the shutdown handle
  */
 struct GNUNET_STREAM_ShutdownHandle *
 GNUNET_STREAM_shutdown (struct GNUNET_STREAM_Socket *socket,
-                       int how);
+                       int operation,
+                        GNUNET_STREAM_ShutdownCompletion completion_cb,
+                        void *completion_cls);
 
 
 /**
index 2180f919ac1b9e34c8af2642494d517f0c4b599c..93d9c9fe231cc8c9d535e3ac22bd56ead8a97b9b 100644 (file)
@@ -2370,15 +2370,20 @@ GNUNET_STREAM_open (const struct GNUNET_CONFIGURATION_Handle *cfg,
 
 
 /**
- * Shutdown the stream for reading or writing (man 2 shutdown).
+ * Shutdown the stream for reading or writing (similar to man 2 shutdown).
  *
  * @param socket the stream socket
- * @param how SHUT_RD, SHUT_WR or SHUT_RDWR 
+ * @param opertion SHUT_RD, SHUT_WR or SHUT_RDWR
+ * @param completion_cb the callback that will be called upon successful
+ *          shutdown of given operation
+ * @param completion_cls the closure for the completion callback
  * @return the shutdown handle
  */
 struct GNUNET_STREAM_ShutdownHandle *
 GNUNET_STREAM_shutdown (struct GNUNET_STREAM_Socket *socket,
-                       int how)
+                       int operation,
+                        GNUNET_STREAM_ShutdownCompletion completion_cb,
+                        void *completion_cls)
 {
   return NULL;
 }