updates.
[silc.git] / lib / silcutil / silcnet.h
1 /*
2
3   silcnet.h
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 1997 - 2001 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; either version 2 of the License, or
12   (at your option) any later version.
13   
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License for more details.
18
19 */
20
21 #ifndef SILCNET_H
22 #define SILCNET_H
23
24 /* Prototypes */
25 int silc_net_create_server(int port, char *ip_addr);
26 void silc_net_close_server(int sock);
27 int silc_net_create_connection(int port, char *host);
28 int silc_net_create_connection_async(int port, char *host);
29 void silc_net_close_connection(int sock);
30 int silc_net_accept_connection(int sock);
31 int silc_net_set_socket_nonblock(int sock);
32 int silc_net_set_socket_opt(int sock, int level, int option, int on);
33 int silc_net_is_ip(const char *addr);
34 bool silc_net_addr2bin(const char *addr, unsigned char *bin,
35                        uint32 bin_len);
36 bool silc_net_check_host_by_sock(int sock, char **hostname, char **ip);
37 bool silc_net_check_local_by_sock(int sock, char **hostname, char **ip);
38 uint16 silc_net_get_remote_port(int sock);
39 uint16 silc_net_get_local_port(int sock);
40 char *silc_net_localhost();
41
42 #endif