Merged silc_1_1_branch to trunk.
[silc.git] / lib / silcutil / silcnet.h
1 /*
2
3   silcnet.h
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 1997 - 2007 Pekka Riikonen
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; version 2 of the License.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18 */
19
20 /****h* silcutil/SILC Net Interface
21  *
22  * DESCRIPTION
23  *
24  * SILC Net API provides various network routines for applications. It
25  * can be used to create TCP/IP and UDP/IP connections and listeners.
26  * Various utility functions for resolving various information is also
27  * provided.
28  *
29  * On WIN32 systems the SILC Net API must initialized by calling the
30  * silc_net_win32_init and uninitialized when the application ends by
31  * calling the silc_net_win32_uninit function. The initializing must be
32  * done in order to assure that the SILC Net API works correctly.
33  *
34  ***/
35
36 #ifndef SILCNET_H
37 #define SILCNET_H
38
39 /* Prototypes */
40
41 /****s* silcutil/SilcNetAPI/SilcNetListener
42  *
43  * NAME
44  *
45  *    typedef struct SilcNetListenerStruct *SilcNetListener;
46  *
47  * DESCRIPTION
48  *
49  *    The network listenr context.  This context is created with the
50  *    silc_net_create_listener function and destroyed with
51  *    silc_net_close_listener function.
52  *
53  ***/
54 typedef struct SilcNetListenerStruct *SilcNetListener;
55
56 /****d* silcutil/SilcNetAPI/SilcNetStatus
57  *
58  * NAME
59  *
60  *    typedef enum { ... } SilcNetStatus;
61  *
62  * DESCRIPTION
63  *
64  *    Status to indicate the result of the network operation creation.  This
65  *    type is returned in the SilcNetCallback callback function.
66  *
67  * SOURCE
68  */
69 typedef enum {
70   SILC_NET_OK,                         /* Everything Ok */
71   SILC_NET_UNKNOWN_IP,                 /* Unknown IP address */
72   SILC_NET_UNKNOWN_HOST,               /* Unknown hostname */
73   SILC_NET_HOST_UNREACHABLE,           /* Destination unreachable */
74   SILC_NET_CONNECTION_REFUSED,         /* Connection refused */
75   SILC_NET_CONNECTION_TIMEOUT,         /* Connection timedout */
76   SILC_NET_NO_MEMORY,                  /* System out of memory */
77   SILC_NET_ERROR,                      /* Unknown error */
78 } SilcNetStatus;
79 /***/
80
81 /****f* silcutil/SilcNetAPI/SilcNetCallback
82  *
83  * SYNOPSIS
84  *
85  *    typedef void (*SilcNetCallback)(SilcNetStatus status,
86  *                                    SilcStream stream, void *context);
87  *
88  * DESCRIPTION
89  *
90  *    A callback of this type is returned by silc_net_tcp_create_listener
91  *    and silc_net_tcp_connect functions.  For silc_net_tcp_create_listener
92  *    this callback means that new incoming connection was accepted, and the
93  *    `stream' is the socket stream representing the socket connection.
94  *
95  *    For silc_net_tcp_connect this means that we have connected to the
96  *    remote host and the `stream' is the socket stream for the socket
97  *    connection.  The SILC Stream API (such as silc_stream_read, etc.) can
98  *    be used to read and write to the stream.  The created stream is socket
99  *    stream so various SilcSocketStream API functions can be used with
100  *    the `stream'.
101  *
102  ***/
103 typedef void (*SilcNetCallback)(SilcNetStatus status,
104                                 SilcStream stream, void *context);
105
106 /****f* silcutil/SilcNetAPI/silc_net_tcp_create_listener
107  *
108  * SYNOPSIS
109  *
110  *    SilcNetListener
111  *    silc_net_tcp_create_listener(const char **local_ip_addr,
112  *                                 SilcUInt32 local_ip_count, int port,
113  *                                 SilcBool lookup, SilcBool require_fqdn,
114  *                                 SilcSchedule schedule,
115  *                                 SilcNetCallback callback, void *context);
116  *
117  * DESCRIPTION
118  *
119  *    This function creates TCP listener.  This is used to create network
120  *    listener for incoming connections, and `callback' will be called
121  *    everytime new connection is received.  If `local_ip_addr' is NULL 'any'
122  *    address is used.  If provided it can be used bind the listener to
123  *    `local_ip_count' many IP addresses provided in `local_ip_addr' table.
124  *    On success returns the SilcNetListener context, or NULL on error.
125  *    If `require_fqdn' is TRUE the listener will require that the incoming
126  *    connection has FQDN to be able to connect.  If the `lookup' is TRUE
127  *    then the incoming connection hostname will be resolved.  If the `port'
128  *    is zero (0), operating system will define it automatically.
129  *
130  *    The `callback' always delivers valid new stream.  It is not called
131  *    with an error status.
132  *
133  ***/
134 SilcNetListener
135 silc_net_tcp_create_listener(const char **local_ip_addr,
136                              SilcUInt32 local_ip_count, int port,
137                              SilcBool lookup, SilcBool require_fqdn,
138                              SilcSchedule schedule,
139                              SilcNetCallback callback, void *context);
140
141 /****f* silcutil/SilcNetAPI/silc_net_listener_get_port
142  *
143  * SYNOPSIS
144  *
145  *    SilcUInt16 silc_net_listener_get_port(SilcNetListener listener);
146  *
147  * DESCRIPTION
148  *
149  *    Returns the ports to where the `listener' is bound.  This can be used
150  *    to get the port if none was specified in silc_net_tcp_create_listener.
151  *    Returns an array of ports of size of `port_count'.  The caller must
152  *    free the array with silc_free.  There are as many ports in the array
153  *    as there were IP addresses provided in silc_net_tcp_create_listener.
154  *
155  ***/
156 SilcUInt16 *silc_net_listener_get_port(SilcNetListener listener,
157                                        SilcUInt32 *port_count);
158
159 /****f* silcutil/SilcNetAPI/silc_net_listener_get_ip
160  *
161  * SYNOPSIS
162  *
163  *    char **silc_net_listener_get_ip(SilcNetListener listener,
164  *                                    SilcUInt32 *ip_count);
165  *
166  * DESCRIPTION
167  *
168  *    Returns the IP's to where the `listener' is bound.  Returns an array
169  *    of IP addresses of size of `port_count'.  The caller must free the
170  *    array and its strings with silc_free.
171  *
172  ***/
173 char **silc_net_listener_get_ip(SilcNetListener listener,
174                                 SilcUInt32 *ip_count);
175
176 /****f* silcutil/SilcNetAPI/silc_net_listener_get_hostname
177  *
178  * SYNOPSIS
179  *
180  *    char **silc_net_listener_get_hostname(SilcNetListener listener,
181  *                                          SilcUInt32 *hostname_count);
182  *
183  * DESCRIPTION
184  *
185  *    Returns the hostnames to where the `listener' is bound.  Returns an
186  *    array of hostnames of size of `port_count'.  The caller must free the
187  *    array and its strings with silc_free.
188  *
189  ***/
190 char **silc_net_listener_get_hostname(SilcNetListener listener,
191                                       SilcUInt32 *hostname_count);
192
193 /****f* silcutil/SilcNetAPI/silc_net_close_listener
194  *
195  * SYNOPSIS
196  *
197  *    void silc_net_close_listener(SilcNetListener listener);
198  *
199  * DESCRIPTION
200  *
201  *    Closes the network listener indicated by `listener'.
202  *
203  ***/
204 void silc_net_close_listener(SilcNetListener listener);
205
206 /****f* silcutil/SilcNetAPI/silc_net_tcp_connect
207  *
208  * SYNOPSIS
209  *
210  *    SilcAsyncOperation silc_net_tcp_connect(const char *local_ip_addr,
211  *                                            const char *remote_ip_addr,
212  *                                            int remote_port,
213  *                                            SilcSchedule schedule,
214  *                                            SilcNetCallback callback,
215  *                                            void *context);
216  *
217  * DESCRIPTION
218  *
219  *    Creates TCP/IP connection to the remote host indicated by `remote_host'
220  *    which may be hostname or IP address, on the port indicated by
221  *    `remote_port'.  If the `local_ip_addr' is provided the local host is
222  *    bound to that address before creating the connection.  This is
223  *    asynchronous call, and this function returns before the connection is
224  *    actually established.  The `callback' will be called after the
225  *    connection is created to deliver the SilcStream for the created
226  *    connection.  This function supports IPv6 if the platform supports it.
227  *
228  *    The returned SilcAsyncOperation context can be used to control the
229  *    asynchronous connecting, such as to abort it.  If it is aborted
230  *    using silc_async_abort the `callback' will not be called.  If NULL
231  *    is returned the operation cannot be aborted.
232  *
233  ***/
234 SilcAsyncOperation silc_net_tcp_connect(const char *local_ip_addr,
235                                         const char *remote_ip_addr,
236                                         int remote_port,
237                                         SilcSchedule schedule,
238                                         SilcNetCallback callback,
239                                         void *context);
240
241 /****f* silcutil/SilcNetAPI/silc_net_udp_connect
242  *
243  * SYNOPSIS
244  *
245  *    SilcStream
246  *    silc_net_udp_connect(const char *local_ip_addr, int local_port,
247  *                         const char *remote_ip_addr, int remote_port,
248  *                         SilcSchedule schedule);
249  *
250  * DESCRIPTION
251  *
252  *    This function creates UDP stream.  The UDP stream is bound to the
253  *    `local_ip_addr' if it is specified.  If `local_port' is non-zero the
254  *    stream is bound to that port.  If the `remote_ip_addr' and `remote_port'
255  *    is also provided, packets may be sent to that address using
256  *    silc_stream_write function and packets may be received using
257  *    silc_stream_read function.
258  *
259  *    If the remote address is not provided the stream is in connectionless
260  *    state.  This means that packets can be received only by using
261  *    silc_net_udp_receive and sent only by using the function
262  *    silc_net_udp_send.
263  *
264  *    To receive packets the silc_stream_set_notifier must be called for the
265  *    returned SilcStream.  The packets are always received in the notifier
266  *    callback when the SILC_STREAM_CAN_READ is returned to the callback
267  *    To read the packet use silc_stream_read if the remote address was
268  *    provided, and silc_net_udp_receive if it was not.
269  *
270  *    Supports IPv6 if the platform supports it.
271  *
272  * EXAMPLE
273  *
274  *    SilcStream udpstream;
275  *
276  *    // Create UDP stream and prepare to receive packets
277  *    udpstream = silc_net_udp_connect("10.2.1.7", 5000,
278  *                                     "10.2.1.100, 5000, schedule);
279  *    silc_stream_set_notifier(udpstream, schedule, receive_callback, context);
280  *
281  *    // Send packet to remote host
282  *    silc_stream_write(udpstream, data, data_len);
283  *
284  *    Create UDP listener:
285  *
286  *    udpstream = silc_net_udp_connect("0.0.0.0", 500, NULL, 0, schedule);
287  *    silc_stream_set_notifier(udpstream, schedule, receive_callback, context);
288  *
289  ***/
290 SilcStream silc_net_udp_connect(const char *local_ip_addr, int local_port,
291                                 const char *remote_ip_addr, int remote_port,
292                                 SilcSchedule schedule);
293
294 /****f* silcutil/SilcNetAPI/silc_net_udp_receive
295  *
296  * SYNOPSIS
297  *
298  *    int
299  *    silc_net_udp_receive(SilcStream stream, char *remote_ip_addr,
300  *                         SilcUInt32 remote_ip_addr_size, int *remote_port,
301  *                         unsigned char *ret_data, SilcUInt32 data_size)
302  *
303  * DESCRIPTION
304  *
305  *    Receive a UDP packet from the `stream'.  The IP address and port of
306  *    the sender is returned into `remote_ip_addr' buffer and `remote_port'
307  *    pointer.  The packet data is returned into the `ret_data' buffer.
308  *
309  *    Returns the length of the packet, or -1 on error or 0 in case of EOF.
310  *
311  ***/
312 int silc_net_udp_receive(SilcStream stream, char *remote_ip_addr,
313                          SilcUInt32 remote_ip_addr_size, int *remote_port,
314                          unsigned char *ret_data, SilcUInt32 data_size);
315
316 /****f* silcutil/SilcNetAPI/silc_net_udp_send
317  *
318  * SYNOPSIS
319  *
320  *    int silc_net_udp_send(SilcStream stream,
321  *                          const char *remote_ip_addr, int remote_port,
322  *                          const unsigned char *data, SilcUInt32 data_len);
323  *
324  * DESCRIPTION
325  *
326  *    Sends an UDP packet to remote host `remote_ip_addr' on `remote_port'.
327  *    This may be used with UDP streams that are not connected to any
328  *    specific remote host.  With those stream silc_stream_write cannot be
329  *    used.  In those cases, this function must be used.  This may also be
330  *    used even if the stream is connected.
331  *
332  *    Returns the amount of data written, -1 if data could not be written
333  *    at this moment, or -2 if error occurred.  If -1 is returned the
334  *    notifier callback will later be called with SILC_STREAM_CAN_WRITE
335  *    status when stream is again ready for writing.
336  *
337  ***/
338 int silc_net_udp_send(SilcStream stream,
339                       const char *remote_ip_addr, int remote_port,
340                       const unsigned char *data, SilcUInt32 data_len);
341
342 /****f* silcutil/SilcNetAPI/silc_net_get_error_string
343  *
344  * SYNOPSIS
345  *
346  *    const char silc_net_get_error_string(SilcNetStatus error);
347  *
348  * DESCRIPTION
349  *
350  *    Return `error' as a string.
351  *
352  ***/
353 const char *silc_net_get_error_string(SilcNetStatus error);
354
355 /****f* silcutil/SilcNetAPI/silc_net_close_connection
356  *
357  * SYNOPSIS
358  *
359  *    void silc_net_close_connection(int sock);
360  *
361  * DESCRIPTION
362  *
363  *    Closes the connection by closing the socket connection.  This routine
364  *    can only be used with POSIX compliant systems.
365  *
366  ***/
367 void silc_net_close_connection(int sock);
368
369 /****f* silcutil/SilcNetAPI/silc_net_accept_connection
370  *
371  * SYNOPSIS
372  *
373  *    int silc_net_accept_connection(int sock);
374  *
375  * DESCRIPTION
376  *
377  *    Accepts a connection from a particular socket.  This routine can only
378  *    be used with POSIX compliant systems.  This call is equivalent to
379  *    accept(2).
380  *
381  ***/
382 int silc_net_accept_connection(int sock);
383
384 /****f* silcutil/SilcNetAPI/silc_net_set_socket_opt
385  *
386  * SYNOPSIS
387  *
388  *    int silc_net_set_socket_opt(int sock, int level, int option, int on);
389  *
390  * DESCRIPTION
391  *
392  *    Sets a option for a socket.  This function can be used to set
393  *    various options for the socket.  Some of the options might be
394  *    system specific.  This routine can only be used with POSIX compliant
395  *    systems.  This call is equivalent to setsockopt(2);
396  *
397  ***/
398 int silc_net_set_socket_opt(int sock, int level, int option, int on);
399
400 /****f* silcutil/SilcNetAPI/silc_net_get_socket_opt
401  *
402  * SYNOPSIS
403  *
404  *    int silc_net_get_socket_opt(int sock, int level, int option,
405  *                                void *optval, int *opt_len);
406  *
407  * DESCRIPTION
408  *
409  *    Return socket options to the `optval' and `opt_len'.  This routine
410  *    can only be used with POSIX compliant systems.  This call is
411  *    equivalent to getsockopt(2).
412  *
413  ***/
414 int silc_net_get_socket_opt(int sock, int level, int option,
415                             void *optval, int *opt_len);
416
417 /****f* silcutil/SilcNetAPI/silc_net_set_socket_nonblock
418  *
419  * SYNOPSIS
420  *
421  *    int silc_net_set_socket_nonblock(SilcSocket sock);
422  *
423  * DESCRIPTION
424  *
425  *    Sets the socket `sock' to non-blocking mode.
426  *
427  ***/
428 int silc_net_set_socket_nonblock(SilcSocket sock);
429
430 /****f* silcutil/SilcNetAPI/silc_net_is_ip4
431  *
432  * SYNOPSIS
433  *
434  *    SilcBool silc_net_is_ip4(const char *addr);
435  *
436  * DESCRIPTION
437  *
438  *    Checks whether IP address sent as argument is valid IPv4 address.
439  *
440  ***/
441 SilcBool silc_net_is_ip4(const char *addr);
442
443 /****f* silcutil/SilcNetAPI/silc_net_is_ip6
444  *
445  * SYNOPSIS
446  *
447  *    SilcBool silc_net_is_ip6(const char *addr);
448  *
449  * DESCRIPTION
450  *
451  *    Checks whether IP address sent as argument is valid IPv6 address.
452  *
453  ***/
454 SilcBool silc_net_is_ip6(const char *addr);
455
456 /****f* silcutil/SilcNetAPI/silc_net_is_ip
457  *
458  * SYNOPSIS
459  *
460  *    SilcBool silc_net_is_ip(const char *addr);
461  *
462  * DESCRIPTION
463  *
464  *    Checks whether IP address sent as argument is valid IP address.
465  *    This supports both IPv4 and IPv6 addresses.
466  *
467  ***/
468 SilcBool silc_net_is_ip(const char *addr);
469
470 /****f* silcutil/SilcNetAPI/silc_net_addr2bin
471  *
472  * SYNOPSIS
473  *
474  *    SilcBool silc_net_addr2bin(const char *addr, void *bin,
475  *                               SilcUInt32 bin_len);
476  *
477  * DESCRIPTION
478  *
479  *    Converts the IP number string from numbers-and-dots notation to
480  *    binary form in network byte order.  The address can be either
481  *    IPv4 or IPv6 address.
482  *
483  ***/
484 SilcBool silc_net_addr2bin(const char *addr, void *bin, SilcUInt32 bin_len);
485
486 /****f* silcutil/SilcNetAPI/SilcNetResolveCallback
487  *
488  * SYNOPSIS
489  *
490  *    typedef void (*SilcNetResolveCallback)(const char *result,
491  *                                           void *context);
492  *
493  * DESCRIPTION
494  *
495  *    A callback function of this type is called after the asynchronous
496  *    resolving operation has been completed.  This callback is used
497  *    when asynchronously resolving IP addresses and hostnames.
498  *
499  ***/
500 typedef void (*SilcNetResolveCallback)(const char *result, void *context);
501
502 /****f* silcutil/SilcNetAPI/silc_net_gethostbyname
503  *
504  * SYNOPSIS
505  *
506  *    SilcBool silc_net_gethostbyname(const char *name, SilcBool prefer_ipv6,
507  *                                    char *address, SilcUInt32 address_len);
508  *
509  * DESCRIPTION
510  *
511  *    Resolves the IP address of the hostname indicated by the `name'.
512  *    This returns TRUE and the IP address of the host to the `address'
513  *    buffer, or FALSE if the address could not be resolved.  This is
514  *    synchronous function and will block the calling process.  If the
515  *    `prefer_ipv6' is TRUE then this will return IPv6 address if it
516  *    finds.  If FALSE if returns IPv4 address even if it found IPv6
517  *    address also.
518  *
519  ***/
520 SilcBool silc_net_gethostbyname(const char *name, SilcBool prefer_ipv6,
521                                 char *address, SilcUInt32 address_len);
522
523 /****f* silcutil/SilcNetAPI/silc_net_gethostbyname_async
524  *
525  * SYNOPSIS
526  *
527  *    void silc_net_gethostbyname_async(const char *name,
528  *                                      SilcBool prefer_ipv6,
529  *                                      SilcSchedule schedule,
530  *                                      SilcNetResolveCallback completion,
531  *                                      void *context)
532  *
533  * DESCRIPTION
534  *
535  *    Asynchronously resolves the IP address of the hostname indicated
536  *    by the `name'.  This function returns immediately, and the
537  *    `completion' callback will be called after the resolving is
538  *    completed.
539  *
540  *    If the `prefer_ipv6' is TRUE then this will return IPv6 address if it
541  *    finds.  If FALSE if returns IPv4 address even if it found IPv6
542  *    address also.
543  *
544  ***/
545 void silc_net_gethostbyname_async(const char *name,
546                                   SilcBool prefer_ipv6,
547                                   SilcSchedule schedule,
548                                   SilcNetResolveCallback completion,
549                                   void *context);
550
551 /****f* silcutil/SilcNetAPI/silc_net_gethostbyaddr
552  *
553  * SYNOPSIS
554  *
555  *   SilcBool silc_net_gethostbyaddr(const char *addr, char *name,
556  *                                   SilcUInt32 name_len);
557  *
558 x * DESCRIPTION
559  *
560  *    Resolves the hostname for the IP address indicated by the `addr'
561  *    This returns TRUE and the resolved hostname to the `name' buffer,
562  *    or FALSE on error. The `addr' may be either IPv4 or IPv6 address.
563  *    This is synchronous function and will block the calling process.
564  *
565  ***/
566 SilcBool silc_net_gethostbyaddr(const char *addr, char *name,
567                                 SilcUInt32 name_len);
568
569 /****f* silcutil/SilcNetAPI/silc_net_gethostbyaddr_async
570  *
571  * SYNOPSIS
572  *
573  *    void silc_net_gethostbyaddr_async(const char *addr,
574  *                                      SilcSchedule schedule,
575  *                                      SilcNetResolveCallback completion,
576  *                                      void *context)
577  *
578  * DESCRIPTION
579  *
580  *    Asynchronously resolves the hostname for the IP address indicated
581  *    by the `addr'.  This function returns immediately, and the
582  *    `completion' callback will be called after the resolving is
583  *    completed.
584  *
585  ***/
586 void silc_net_gethostbyaddr_async(const char *addr,
587                                   SilcSchedule schedule,
588                                   SilcNetResolveCallback completion,
589                                   void *context);
590
591 /****f* silcutil/SilcNetAPI/silc_net_check_host_by_sock
592  *
593  * SYNOPSIS
594  *
595  *    SilcBool silc_net_check_host_by_sock(SilcSocket sock, char **hostname,
596  *                                         char **ip);
597  *
598  * DESCRIPTION
599  *
600  *    Performs lookups for remote name and IP address. This peforms reverse
601  *    lookup as well to verify that the IP has FQDN.
602  *
603  ***/
604 SilcBool silc_net_check_host_by_sock(SilcSocket sock, char **hostname,
605                                      char **ip);
606
607 /****f* silcutil/SilcNetAPI/silc_net_check_local_by_sock
608  *
609  * SYNOPSIS
610  *
611  *    SilcBool silc_net_check_local_by_sock(SilcSocket sock, char **hostname,
612  *                                          char **ip);
613  *
614  * DESCRIPTION
615  *
616  *    Performs lookups for local name and IP address. This peforms reverse
617  *    lookup as well to verify that the IP has FQDN.
618  *
619  ***/
620 SilcBool silc_net_check_local_by_sock(SilcSocket sock, char **hostname,
621                                       char **ip);
622
623 /****f* silcutil/SilcNetAPI/silc_net_get_remote_port
624  *
625  * SYNOPSIS
626  *
627  *    SilcUInt16 silc_net_get_remote_port(SilcSocket sock);
628  *
629  * DESCRIPTION
630  *
631  *    Return remote port by socket.
632  *
633  ***/
634 SilcUInt16 silc_net_get_remote_port(SilcSocket sock);
635
636 /****f* silcutil/SilcNetAPI/silc_net_get_local_port
637  *
638  * SYNOPSIS
639  *
640  *    SilcUInt16 silc_net_get_local_port(SilcSocket sock);
641  *
642  * DESCRIPTION
643  *
644  *    Return local port by socket.
645  *
646  ***/
647 SilcUInt16 silc_net_get_local_port(SilcSocket sock);
648
649 /****f* silcutil/SilcNetAPI/silc_net_localhost
650  *
651  * SYNOPSIS
652  *
653  *    char *silc_net_localhost(void);
654  *
655  * DESCRIPTION
656  *
657  *    Return name of localhost.  This will also attempt to resolve
658  *    the real hostname by the local host's IP address.  If unsuccessful
659  *    the first found hostname is returned.  The caller must free
660  *    returned hostname.
661  *
662  ***/
663 char *silc_net_localhost(void);
664
665 /****f* silcutil/SilcNetAPI/silc_net_localip
666  *
667  * SYNOPSIS
668  *
669  *    char *silc_net_localip(void)
670  *
671  * DESCRIPTION
672  *
673  *    Return IP of localhost.  The caller must free the returned IP.
674  *
675  ***/
676 char *silc_net_localip(void);
677
678 #include "silcnet_i.h"
679
680 #endif /* SILCNET_H */