blob: 2e093c1c423680824e9c13b6bbd838de870ea12a [file] [log] [blame]
Denis Vlasenko57a426b2007-04-01 10:59:33 +00001/* Based on ipsvd utilities written by Gerrit Pape <pape@smarden.org>
2 * which are released into public domain by the author.
3 * Homepage: http://smarden.sunsite.dk/ipsvd/
4 *
Denis Vlasenkod18f52b2008-03-02 12:53:15 +00005 * Copyright (C) 2007 Denys Vlasenko.
Denis Vlasenko57a426b2007-04-01 10:59:33 +00006 *
7 * Licensed under GPLv2, see file LICENSE in this tarball for details.
8 */
9
Denis Vlasenko98636eb2008-05-09 17:59:34 +000010#if __GNUC_PREREQ(4,1)
11# pragma GCC visibility push(hidden)
12#endif
13
Denis Vlasenko2856dab2007-04-01 01:18:20 +000014struct hcc {
Denis Vlasenko4b924f32007-05-30 00:29:55 +000015 char *ip;
16 int pid;
Denis Vlasenko2856dab2007-04-01 01:18:20 +000017};
18
19void ipsvd_perhost_init(unsigned);
Denis Vlasenko729bd9e2007-04-02 12:37:28 +000020
21/* Returns number of already opened connects to this ips, including this one.
22 * ip should be a malloc'ed ptr.
23 * If return value is <= maxconn, ip is inserted into the table
24 * and pointer to table entry if stored in *hccpp
25 * (useful for storing pid later).
26 * Else ip is NOT inserted (you must take care of it - free() etc) */
27unsigned ipsvd_perhost_add(char *ip, unsigned maxconn, struct hcc **hccpp);
28
29/* Finds and frees element with pid */
Denis Vlasenko2856dab2007-04-01 01:18:20 +000030void ipsvd_perhost_remove(int pid);
Denis Vlasenko729bd9e2007-04-02 12:37:28 +000031
Denis Vlasenko2856dab2007-04-01 01:18:20 +000032//unsigned ipsvd_perhost_setpid(int pid);
33//void ipsvd_perhost_free(void);
Denis Vlasenko98636eb2008-05-09 17:59:34 +000034
35#if __GNUC_PREREQ(4,1)
36# pragma GCC visibility pop
37#endif