Author: Bleep <helveytw@home.com>
[ircu2.10.12-pk.git] / ircd / client.c
index 17000c0650529d5c7cad3b676b8568371c36da3e..3caa2ded01044ae4180ac10a6152cbaeadbc5abe 100644 (file)
 
 #define BAD_PING                ((unsigned int)-2)
 
+/*
+ * client_get_ping
+ * returns shortest ping time in attached server or client conf
+ * classes or PINGFREQUENCY
+ */
 unsigned int client_get_ping(const struct Client* acptr)
 {
   unsigned int     ping = 0;
@@ -59,31 +64,10 @@ unsigned int client_get_ping(const struct Client* acptr)
 #define BAD_CONF_CLASS          ((unsigned int)-1)
 #define BAD_CLIENT_CLASS        ((unsigned int)-3)
 
-unsigned int get_conf_class(struct ConfItem *aconf)
-{
-  if ((aconf) && (aconf->confClass))
-    return (ConfClass(aconf));
-
-  Debug((DEBUG_DEBUG, "No Class For %s", (aconf) ? aconf->name : "*No Conf*"));
-
-  return (BAD_CONF_CLASS);
-
-}
-
-static unsigned int get_conf_ping(struct ConfItem *aconf)
-{
-  if ((aconf) && (aconf->confClass))
-    return (ConfPingFreq(aconf));
-
-  Debug((DEBUG_DEBUG, "No Ping For %s", (aconf) ? aconf->name : "*No Conf*"));
-
-  return (BAD_PING);
-}
-
 unsigned int get_client_class(struct Client *acptr)
 {
   struct SLink *tmp;
-  struct ConfClass *cl;
+  struct ConnectionClass *cl;
   unsigned int retc = BAD_CLIENT_CLASS;
 
   if (acptr && !IsMe(acptr) && (acptr->confs))
@@ -99,100 +83,6 @@ unsigned int get_client_class(struct Client *acptr)
 
   return (retc);
 }
-unsigned int get_con_freq(struct ConfClass * clptr)
-{
-  if (clptr)
-    return (ConFreq(clptr));
-  else
-    return (CONNECTFREQUENCY);
-}
-
-/*
- * When adding a class, check to see if it is already present first.
- * if so, then update the information for that class, rather than create
- * a new entry for it and later delete the old entry.
- * if no present entry is found, then create a new one and add it in
- * immeadiately after the first one (class 0).
- */
-void add_class(unsigned int conClass, unsigned int ping, unsigned int confreq,
-    unsigned int maxli, unsigned int sendq)
-{
-  struct ConfClass *t, *p;
-
-  t = find_class(conClass);
-  if ((t == classes) && (conClass != 0))
-  {
-    p = (struct ConfClass *) make_class();
-    NextClass(p) = NextClass(t);
-    NextClass(t) = p;
-  }
-  else
-    p = t;
-  Debug((DEBUG_DEBUG, "Add Class %u: p %p t %p - cf: %u pf: %u ml: %u sq: %d",
-      conClass, p, t, confreq, ping, maxli, sendq));
-  ConClass(p) = conClass;
-  ConFreq(p) = confreq;
-  PingFreq(p) = ping;
-  MaxLinks(p) = maxli;
-  MaxSendq(p) = (sendq > 0) ? sendq : DEFAULTMAXSENDQLENGTH;
-  if (p != t)
-    Links(p) = 0;
-}
-
-struct ConfClass *find_class(unsigned int cclass)
-{
-  struct ConfClass *cltmp;
-
-  for (cltmp = FirstClass(); cltmp; cltmp = NextClass(cltmp))
-    if (ConClass(cltmp) == cclass)
-      return cltmp;
-  return classes;
-}
-
-void check_class(void)
-{
-  struct ConfClass *cltmp, *cltmp2;
-
-  Debug((DEBUG_DEBUG, "Class check:"));
-
-  for (cltmp2 = cltmp = FirstClass(); cltmp; cltmp = NextClass(cltmp2))
-  {
-    Debug((DEBUG_DEBUG,
-        "Class %d : CF: %d PF: %d ML: %d LI: %d SQ: %d",
-        ConClass(cltmp), ConFreq(cltmp), PingFreq(cltmp),
-        MaxLinks(cltmp), Links(cltmp), MaxSendq(cltmp)));
-    if (IsMarkedDelete(cltmp))
-    {
-      NextClass(cltmp2) = NextClass(cltmp);
-      if (Links(cltmp) == 0)
-        free_class(cltmp);
-    }
-    else
-      cltmp2 = cltmp;
-  }
-}
-
-void initclass(void)
-{
-  classes = (struct ConfClass *) make_class();
-
-  ConClass(FirstClass()) = 0;
-  ConFreq(FirstClass()) = CONNECTFREQUENCY;
-  PingFreq(FirstClass()) = PINGFREQUENCY;
-  MaxLinks(FirstClass()) = MAXIMUM_LINKS;
-  MaxSendq(FirstClass()) = DEFAULTMAXSENDQLENGTH;
-  Links(FirstClass()) = 0;
-  NextClass(FirstClass()) = NULL;
-}
-
-void report_classes(struct Client *sptr)
-{
-  struct ConfClass *cltmp;
-
-  for (cltmp = FirstClass(); cltmp; cltmp = NextClass(cltmp))
-    send_reply(sptr, RPL_STATSYLINE, 'Y', ConClass(cltmp), PingFreq(cltmp),
-              ConFreq(cltmp), MaxLinks(cltmp), MaxSendq(cltmp));
-}
 
 unsigned int get_sendq(struct Client *cptr)
 {
@@ -204,7 +94,7 @@ unsigned int get_sendq(struct Client *cptr)
 
   else if (cptr->confs) {
     struct SLink*     tmp;
-    struct ConfClass* cl;
+    struct ConnectionClass* cl;
 
     for (tmp = cptr->confs; tmp; tmp = tmp->next) {
       if (!tmp->value.aconf || !(cl = tmp->value.aconf->confClass))