1 /* 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/
5 * Copyright (C) 2007 Denis Vlasenko.
7 * Licensed under GPLv2, see file LICENSE in this tarball for details.
11 #include "ipsvd_perhost.h"
13 static struct hcc *cc;
14 static unsigned cclen;
18 void ipsvd_perhost_init(unsigned c)
21 cc = xzalloc(c * sizeof(*cc));
25 unsigned ipsvd_perhost_add(const char *ip, unsigned maxconn, struct hcc **hccpp)
31 for (i = 0; i < cclen; ++i) {
32 if (cc[i].ip[0] == 0) {
36 if (strncmp(cc[i].ip, ip, sizeof(cc[i].ip)) == 0) {
41 if (p == -1) return 0;
42 if (conn <= maxconn) {
49 void ipsvd_perhost_remove(int pid)
52 for (i = 0; i < cclen; ++i) {
53 if (cc[i].pid == pid) {
61 //void ipsvd_perhost_free(void)