struct GNUNET_STREAM_Socket *socket);
+/**
+ * Callback for signalling stream listen success; See
+ * GNUNET_STREAM_OPTION_SIGNAL_LISTEN_SUCCESS
+ */
+typedef void (*GNUNET_STREAM_ListenSuccessCallback) (void);
+
+
/**
* Options for the stream.
*/
* Option to set the write sequence number. Takes a uint32_t as parameter
* to set the value of the write sequence number
*/
- GNUNET_STREAM_OPTION_TESTING_SET_WRITE_SEQUENCE_NUMBER
+ GNUNET_STREAM_OPTION_TESTING_SET_WRITE_SEQUENCE_NUMBER,
+
+ /**
+ * Listen socket timeout in milliseconds given as uint32_t
+ */
+ GNUNET_STREAM_OPTION_LISTEN_TIMEOUT,
+
+ /**
+ * Option to register a callback when stream listening is
+ * successfull. Takes parameter of the form
+ * GNUNET_STREAM_ListenSuccessCallback. The callback is only called if
+ * listen is successful
+ */
+ GNUNET_STREAM_OPTION_SIGNAL_LISTEN_SUCCESS
};
* @param target the target peer to which the stream has to be opened
* @param app_port the application port number which uniquely identifies this
* stream
- * @param open_cb this function will be called after stream has be established
+ * @param open_cb this function will be called after stream has be established;
+ * cannot be NULL
* @param open_cb_cls the closure for open_cb
* @param ... options to the stream, terminated by GNUNET_STREAM_OPTION_END
* @return if successful it returns the stream socket; NULL if stream cannot be
* Functions of this type are called upon new stream connection from other peers
*
* @param cls the closure from GNUNET_STREAM_listen
- * @param socket the socket representing the stream
+ * @param socket the socket representing the stream; NULL on binding error
* @param initiator the identity of the peer who wants to establish a stream
- * with us
+ * with us; NULL on binding error
* @return GNUNET_OK to keep the socket open, GNUNET_SYSERR to close the
* stream (the socket will be invalid after the call)
*/
* Listens for stream connections for a specific application ports
*
* @param cfg the configuration to use
- * @param app_port the application port for which new streams will be accepted
+ *
+ * @param app_port the application port for which new streams will be
+ * accepted. If another stream is listening on the same port the
+ * listen_cb will be called to signal binding error and the returned
+ * ListenSocket will be invalidated.
+ *
* @param listen_cb this function will be called when a peer tries to establish
* a stream with us
* @param listen_cb_cls closure for listen_cb