Added silc_net_tcp_create_listener2
[crypto.git] / lib / silcutil / silcnet.h
index ce4cdcc62d3561974cd2b5a43e85e8e816b3aa09..ffd5bfc337e1c0e1a327d80d10206aaeebe38065 100644 (file)
  * Various utility functions for resolving various information is also
  * provided.
  *
- * On WIN32 systems the SILC Net API must initialized by calling the
- * silc_net_win32_init and uninitialized when the application ends by
- * calling the silc_net_win32_uninit function. The initializing must be
- * done in order to assure that the SILC Net API works correctly.
- *
  ***/
 
 #ifndef SILCNET_H
@@ -118,7 +113,7 @@ typedef void (*SilcNetCallback)(SilcNetStatus status,
  *
  *    This function creates TCP listener.  This is used to create network
  *    listener for incoming connections, and `callback' will be called
- *    everytime new connection is received.  If `local_ip_addr' is NULL any
+ *    everytime new connection is received.  If `local_ip_addr' is NULL 'any'
  *    address is used.  If provided it can be used bind the listener to
  *    `local_ip_count' many IP addresses provided in `local_ip_addr' table.
  *    On success returns the SilcNetListener context, or NULL on error.
@@ -138,6 +133,45 @@ silc_net_tcp_create_listener(const char **local_ip_addr,
                             SilcSchedule schedule,
                             SilcNetCallback callback, void *context);
 
+/****f* silcutil/SilcNetAPI/silc_net_tcp_create_listener2
+ *
+ * SYNOPSIS
+ *
+ *    SilcNetListener
+ *    silc_net_tcp_create_listener2(const char *local_ip_addr, int *ports,
+ *                                  SilcUInt32 port_count,
+ *                                  SilcBool ignore_port_error,
+ *                                  SilcBool lookup, SilcBool require_fqdn,
+ *                                  SilcSchedule schedule,
+ *                                  SilcNetCallback callback, void *context);
+ *
+ * DESCRIPTION
+ *
+ *    This function creates TCP listener.  This is used to create network
+ *    listener for incoming connections, and `callback' will be called
+ *    everytime new connection is received.  If `local_ip_addr' is NULL 'any'
+ *    address is used.  If `ports' is NULL or it contains a zero (0) port,
+ *    operating system will define it automatically.  This function can be
+ *    used to bind to many ports at the same time.  If `ignore_port_error'
+ *    is TRUE this won't return NULL if at least one of the ports could
+ *    be bound.  Otherwise, NULL will be returned on error.
+ *
+ *    If `require_fqdn' is TRUE the listener will require that the incoming
+ *    connection has FQDN to be able to connect.  If the `lookup' is TRUE
+ *    then the incoming connection hostname will be resolved.
+ *
+ *    The `callback' always delivers valid new stream.  It is not called
+ *    with an error status.
+ *
+ ***/
+SilcNetListener
+silc_net_tcp_create_listener2(const char *local_ip_addr, int *ports,
+                             SilcUInt32 port_count,
+                             SilcBool ignore_port_error,
+                             SilcBool lookup, SilcBool require_fqdn,
+                             SilcSchedule schedule,
+                             SilcNetCallback callback, void *context);
+
 /****f* silcutil/SilcNetAPI/silc_net_listener_get_port
  *
  * SYNOPSIS
@@ -150,7 +184,8 @@ silc_net_tcp_create_listener(const char **local_ip_addr,
  *    to get the port if none was specified in silc_net_tcp_create_listener.
  *    Returns an array of ports of size of `port_count'.  The caller must
  *    free the array with silc_free.  There are as many ports in the array
- *    as there were IP addresses provided in silc_net_tcp_create_listener.
+ *    as there were IP addresses provided in silc_net_tcp_create_listener,
+ *    as there were ports provided in silc_net_tcp_create_listener2.
  *
  ***/
 SilcUInt16 *silc_net_listener_get_port(SilcNetListener listener,
@@ -504,7 +539,7 @@ typedef void (*SilcNetResolveCallback)(const char *result, void *context);
  * SYNOPSIS
  *
  *    SilcBool silc_net_gethostbyname(const char *name, SilcBool prefer_ipv6,
- *                                char *address, SilcUInt32 address_len);
+ *                                    char *address, SilcUInt32 address_len);
  *
  * DESCRIPTION
  *
@@ -553,9 +588,9 @@ void silc_net_gethostbyname_async(const char *name,
  * SYNOPSIS
  *
  *   SilcBool silc_net_gethostbyaddr(const char *addr, char *name,
- *                               SilcUInt32 name_len);
+ *                                   SilcUInt32 name_len);
  *
- * DESCRIPTION
+x * DESCRIPTION
  *
  *    Resolves the hostname for the IP address indicated by the `addr'
  *    This returns TRUE and the resolved hostname to the `name' buffer,