1 /*
2  * binding.h - server to port binding declarations and definitions
3  *
4  * Copyright (C) 2011-2013 Thien-Thi Nguyen
5  * Copyright (C) 2001 Stefan Jahn <stefan@lkcc.org>
6  *
7  * This is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * This software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this package.  If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef __BINDING_H__
22 #define __BINDING_H__ 1
23 
24 /* begin svzint */
25 #include "libserveez/defines.h"
26 /* end svzint */
27 
28 /* begin svzint */
29 /*
30  * A server can typically be bound to different port configurations.  This
31  * structure hold the binding for a single listening socket structure of a
32  * server.
33  */
34 typedef struct svz_binding
35 {
36   svz_server_t *server; /* The server structure.  */
37   svz_portcfg_t *port;  /* The port configuration the server is bound to.  */
38 }
39 svz_binding_t;
40 /* end svzint */
41 
42 __BEGIN_DECLS
43 SBO svz_array_t *svz_sock_bindings (const svz_socket_t *);
44 SBO void svz_sock_bindings_set (svz_socket_t *, svz_socket_t *);
45 SBO size_t svz_sock_bindings_zonk_server (svz_socket_t *, svz_server_t *);
46 SBO void svz_binding_destroy (svz_binding_t *);
47 SBO svz_array_t *svz_binding_filter (svz_socket_t *);
48 
49 SERVEEZ_API int svz_server_bind (svz_server_t *, svz_portcfg_t *);
50 SERVEEZ_API svz_array_t *svz_server_portcfgs (svz_server_t *);
51 SERVEEZ_API svz_array_t *svz_server_listeners (svz_server_t *);
52 SERVEEZ_API svz_array_t *svz_sock_servers (svz_socket_t *);
53 SERVEEZ_API int svz_binding_contains_server (svz_socket_t *,
54                                              svz_server_t *);
55 SERVEEZ_API size_t svz_pp_server_bindings (char *, size_t, svz_server_t *);
56 
57 __END_DECLS
58 
59 #endif /* not __BINDING_H__ */
60