1 /*
2  *  Copyright (C) 2013-2022 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
3  *  Copyright (C) 2008-2013 Sourcefire, Inc.
4  *
5  *  Author: aCaB <acab@clamav.net>
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  *  MA 02110-1301, USA.
20  */
21 
22 #ifndef _CONNPOOL_H
23 #define _CONNPOOL_H
24 
25 #if HAVE_CONFIG_H
26 #include "clamav-config.h"
27 #endif
28 
29 #include <sys/socket.h>
30 #include <netinet/in_systm.h>
31 #include <netinet/in.h>
32 #include <netinet/ip.h>
33 #include <pthread.h>
34 
35 #include "optparser.h"
36 
37 struct CP_ENTRY {
38     struct sockaddr *server;
39     void *gai;
40     socklen_t socklen;
41     time_t last_poll;
42     uint8_t type;
43     uint8_t dead;
44     uint8_t local;
45 };
46 
47 struct CPOOL {
48     unsigned int entries;
49     unsigned int alive;
50     struct CP_ENTRY *local_cpe;
51     struct CP_ENTRY *pool;
52 };
53 
54 void cpool_init(struct optstruct *copt);
55 void cpool_free(void);
56 struct CP_ENTRY *cpool_get_rand(int *s);
57 
58 extern struct CPOOL *cp;
59 
60 #endif
61 
62 /*
63  * Local Variables:
64  * mode: c
65  * c-basic-offset: 4
66  * tab-width: 8
67  * End:
68  * vim: set cindent smartindent autoindent softtabstop=4 shiftwidth=4 tabstop=8:
69  */
70