-/*
- Only one fallback is possible for each event (INPUT, OUTPUT, CONNECTION, LOST)
- INPUT: The function is called when there is at least a byte in the
- input buffer
- OUTPUT: The function is called when the system is sure the next write call
- will not block
- CONNECTION: Two cases is possible:
- Client socket -> the connection is established
- Server socket -> a client request a connection
- LOST: the connection is lost
-
- SetFallback accepts a combination of these flags so a same callback can
- receive different events.
-
- An event is generated only once and its state is reseted when the relative
- IO call is requested.
- For example: INPUT -> GSocket_Read()
- CONNECTION -> GSocket_Accept()
-*/
-void GSocket_SetFallback(GSocket *socket, GSocketEventFlags event,
- GSocketFallback fallback, char *cdata);
-
-/*
- UnsetFallback will disables all fallbacks specified by "event".
- NOTE: event may be a combination of flags
-*/
-void GSocket_UnsetFallback(GSocket *socket, GSocketEventFlags event);
+/* GSOCK_INPUT:
+ * There is data to be read in the input buffer. If, after a read
+ * operation, there is still data available, the callback function will
+ * be called again.
+ * GSOCK_OUTPUT:
+ * The socket is available for writing. That is, the next write call
+ * won't block. This event is generated only once, when the connection is
+ * first established, and then only if a call failed with GSOCK_WOULDBLOCK,
+ * when the output buffer empties again. This means that the app should
+ * assume that it can write since the first OUTPUT event, and no more
+ * OUTPUT events will be generated unless an error occurs.
+ * GSOCK_CONNECTION:
+ * Connection succesfully established, for client sockets, or incoming
+ * client connection, for server sockets. Wait for this event (also watch
+ * out for GSOCK_LOST) after you issue a nonblocking GSocket_Connect() call.
+ * GSOCK_LOST:
+ * The connection is lost (or a connection request failed); this could
+ * be due to a failure, or due to the peer closing it gracefully.
+ */
+
+/* GSocket_SetCallback:
+ * Enables the callbacks specified by 'flags'. Note that 'flags'
+ * may be a combination of flags OR'ed toghether, so the same
+ * callback function can be made to accept different events.
+ * The callback function must have the following prototype:
+ *
+ * void function(GSocket *socket, GSocketEvent event, char *cdata)
+ */
+void GSocket_SetCallback(GSocket *socket, GSocketEventFlags flags,
+ GSocketCallback fallback, char *cdata);
+
+/* GSocket_UnsetCallback:
+ * Disables all callbacks specified by 'flags', which may be a
+ * combination of flags OR'ed toghether.
+ */
+void GSocket_UnsetCallback(GSocket *socket, GSocketEventFlags flags);
+