From: xchaos Date: Thu, 11 Oct 2012 20:41:29 +0000 (+0000) Subject: more refucktoring (into multiple modules) X-Git-Url: http://git.harvie.cz/?p=svn%2FPrometheus-QoS%2F.git;a=commitdiff_plain;h=a1204fc9fd3dab261b08e0d1491ec4099a762c5a;hp=fe87b98b4b733f58664b913820fe317081f9ebb0 more refucktoring (into multiple modules) git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@198 251d49ef-1d17-4917-a970-b30cf55b089b --- diff --git a/parsehosts.c b/parsehosts.c index 2740c1c..db3bf2e 100644 --- a/parsehosts.c +++ b/parsehosts.c @@ -14,9 +14,32 @@ extern int class_count; extern int ip_count; extern int found_lmsid; extern int free_min; +extern const int highest_priority; -/* function implemented in prometheus.c */ -void TheIP(void); +/* This must be object oriented! This looks almost like constructor ;-) */ +void TheIP(void) +{ + create(ip,IP); + ip->name = ""; + ip->addr = ""; + ip->sharing = NULL; + ip->prio = highest_priority+1; + ip->lmsid = -1; + ip->fixedprio = \ + ip->mark = \ + ip->min = \ + ip->max = \ + ip->desired = \ + ip->credit = \ + ip->upload = \ + ip->proxy = \ + ip->direct = \ + ip->traffic = \ + ip->pktsup = \ + ip->pktsdown = 0; + ip->keyword = keywords; + push(ip,ips); +} /* == This function strips extra characters after IPv4 address and stores it = */ void parse_ip(char *str) diff --git a/prometheus.c b/prometheus.c index 2aec7ff..7179714 100644 --- a/prometheus.c +++ b/prometheus.c @@ -181,31 +181,9 @@ struct Index } *idxs=NULL, *idx, *metaindex; -/* Damned, this must be object oriented! This looks almost like constructor ;-) */ -void TheIP(void) -{ - create(ip,IP); - ip->name = ""; - ip->addr = ""; - ip->sharing = NULL; - ip->prio = highest_priority+1; - ip->lmsid = -1; - ip->fixedprio = \ - ip->mark = \ - ip->min = \ - ip->max = \ - ip->desired = \ - ip->credit = \ - ip->upload = \ - ip->proxy = \ - ip->direct = \ - ip->traffic = \ - ip->pktsup = \ - ip->pktsdown = 0; - ip->keyword = keywords; - push(ip,ips); -} +void TheIP(void); +/* function implemented in parsehosts.c */ /* ====== iptables indexes are used to reduce complexity to log8(N) ===== */