Added SILC Thread Queue API
[silc.git] / lib / silcutil / silcnet.h
index ffd5bfc337e1c0e1a327d80d10206aaeebe38065..b8db06f8fc4e382905045600648f0e5d2c88a964 100644 (file)
  ***/
 typedef struct SilcNetListenerStruct *SilcNetListener;
 
-/****d* silcutil/SilcNetAPI/SilcNetStatus
- *
- * NAME
- *
- *    typedef enum { ... } SilcNetStatus;
- *
- * DESCRIPTION
- *
- *    Status to indicate the result of the network operation creation.  This
- *    type is returned in the SilcNetCallback callback function.
- *
- * SOURCE
- */
-typedef enum {
-  SILC_NET_OK,                        /* Everything Ok */
-  SILC_NET_UNKNOWN_IP,                /* Unknown IP address */
-  SILC_NET_UNKNOWN_HOST,              /* Unknown hostname */
-  SILC_NET_HOST_UNREACHABLE,          /* Destination unreachable */
-  SILC_NET_CONNECTION_REFUSED,        /* Connection refused */
-  SILC_NET_CONNECTION_TIMEOUT,        /* Connection timedout */
-  SILC_NET_NO_MEMORY,                 /* System out of memory */
-  SILC_NET_ERROR,                     /* Unknown error */
-} SilcNetStatus;
-/***/
-
 /****f* silcutil/SilcNetAPI/SilcNetCallback
  *
  * SYNOPSIS
  *
- *    typedef void (*SilcNetCallback)(SilcNetStatus status,
+ *    typedef void (*SilcNetCallback)(SilcResult status,
  *                                    SilcStream stream, void *context);
  *
  * DESCRIPTION
@@ -95,7 +70,7 @@ typedef enum {
  *    the `stream'.
  *
  ***/
-typedef void (*SilcNetCallback)(SilcNetStatus status,
+typedef void (*SilcNetCallback)(SilcResult status,
                                SilcStream stream, void *context);
 
 /****f* silcutil/SilcNetAPI/silc_net_tcp_create_listener
@@ -123,7 +98,8 @@ typedef void (*SilcNetCallback)(SilcNetStatus status,
  *    is zero (0), operating system will define it automatically.
  *
  *    The `callback' always delivers valid new stream.  It is not called
- *    with an error status.
+ *    with an error status.  If `schedule' is NULL this will call
+ *    silc_schedule_get_global to try to get global scheduler.
  *
  ***/
 SilcNetListener
@@ -161,7 +137,8 @@ silc_net_tcp_create_listener(const char **local_ip_addr,
  *    then the incoming connection hostname will be resolved.
  *
  *    The `callback' always delivers valid new stream.  It is not called
- *    with an error status.
+ *    with an error status.  If `schedule' is NULL this will call
+ *    silc_schedule_get_global to try to get global scheduler.
  *
  ***/
 SilcNetListener
@@ -263,7 +240,8 @@ void silc_net_close_listener(SilcNetListener listener);
  *    The returned SilcAsyncOperation context can be used to control the
  *    asynchronous connecting, such as to abort it.  If it is aborted
  *    using silc_async_abort the `callback' will not be called.  If NULL
- *    is returned the operation cannot be aborted.
+ *    is returned the operation cannot be aborted.  If `schedule' is NULL
+ *    this will call silc_schedule_get_global to try to get global scheduler.
  *
  ***/
 SilcAsyncOperation silc_net_tcp_connect(const char *local_ip_addr,
@@ -302,7 +280,8 @@ SilcAsyncOperation silc_net_tcp_connect(const char *local_ip_addr,
  *    To read the packet use silc_stream_read if the remote address was
  *    provided, and silc_net_udp_receive if it was not.
  *
- *    Supports IPv6 if the platform supports it.
+ *    Supports IPv6 if the platform supports it.  If `schedule' is NULL this
+ *    will call silc_schedule_get_global to try to get global scheduler.
  *
  * EXAMPLE
  *
@@ -374,19 +353,6 @@ int silc_net_udp_send(SilcStream stream,
                      const char *remote_ip_addr, int remote_port,
                      const unsigned char *data, SilcUInt32 data_len);
 
-/****f* silcutil/SilcNetAPI/silc_net_get_error_string
- *
- * SYNOPSIS
- *
- *    const char silc_net_get_error_string(SilcNetStatus error);
- *
- * DESCRIPTION
- *
- *    Return `error' as a string.
- *
- ***/
-const char *silc_net_get_error_string(SilcNetStatus error);
-
 /****f* silcutil/SilcNetAPI/silc_net_close_connection
  *
  * SYNOPSIS
@@ -570,7 +536,8 @@ SilcBool silc_net_gethostbyname(const char *name, SilcBool prefer_ipv6,
  *    Asynchronously resolves the IP address of the hostname indicated
  *    by the `name'.  This function returns immediately, and the
  *    `completion' callback will be called after the resolving is
- *    completed.
+ *    completed.  If `schedule' is NULL this will call silc_schedule_get_global
+ *    to try to get global scheduler.
  *
  *    If the `prefer_ipv6' is TRUE then this will return IPv6 address if it
  *    finds.  If FALSE if returns IPv4 address even if it found IPv6
@@ -615,7 +582,8 @@ SilcBool silc_net_gethostbyaddr(const char *addr, char *name,
  *    Asynchronously resolves the hostname for the IP address indicated
  *    by the `addr'.  This function returns immediately, and the
  *    `completion' callback will be called after the resolving is
- *    completed.
+ *    completed.  If `schedule' is NULL this will call silc_schedule_get_global
+ *    to try to get global scheduler.
  *
  ***/
 void silc_net_gethostbyaddr_async(const char *addr,