]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
clientlog: remove unused code
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 26 Jan 2015 10:37:13 +0000 (11:37 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 26 Jan 2015 10:38:02 +0000 (11:38 +0100)
clientlog.c
clientlog.h
reports.h

index b895c590ff85cd8b31c3e9be79376e8b5956be09..df38b3812cac4ceeab8075397ad996e729abcaff 100644 (file)
@@ -261,31 +261,6 @@ find_subnet(Subnet *subnet, uint32_t *addr, int addr_len, int bits_consumed)
   }
 }
 
-
-/* ================================================== */
-/* Search for the record for a particular subnet, but return NULL if
-   one of the parents does not exist - never open a node out */
-
-static void *
-find_subnet_dont_open(Subnet *subnet, uint32_t *addr, int addr_len, int bits_consumed)
-{
-  uint32_t this_subnet;
-
-  if (bits_consumed >= 32 * addr_len) {
-    return subnet;
-  } else {
-    
-    this_subnet = get_subnet(addr, bits_consumed);
-    bits_consumed += NBITS;
-
-    if (!subnet->entry[this_subnet]) {
-      return NULL;
-    } else {
-      return find_subnet_dont_open((Subnet *) subnet->entry[this_subnet], addr, addr_len, bits_consumed);
-    }
-  }
-}
-
 /* ================================================== */
 
 void
@@ -391,95 +366,6 @@ CLG_LogCommandAccess(IPAddr *client, CLG_Command_Type type, time_t now)
 
 /* ================================================== */
 
-CLG_Status
-CLG_GetSubnetBitmap(IPAddr *subnet, int bits, CLG_Bitmap result)
-{
-  Subnet *s;
-  uint32_t ip6[4];
-  unsigned long i;
-  unsigned long word, bit, mask;
-
-  if (bits >= 0 && bits % 8 == 0) {
-    memset (result, 0, TABLE_SIZE/8);
-    if (active) {
-      switch (subnet->family) {
-        case IPADDR_INET4:
-          if (bits >= 32)
-            return CLG_BADSUBNET;
-          s = find_subnet_dont_open(&top_subnet4, &subnet->addr.in4, 1, 32 - bits);
-          break;
-        case IPADDR_INET6:
-          if (bits >= 128)
-            return CLG_BADSUBNET;
-          split_ip6(subnet, ip6);
-          s = find_subnet_dont_open(&top_subnet6, ip6, 4, 128 - bits);
-          break;
-        default:
-          return CLG_BADSUBNET;
-      }
-
-      if (s) {
-        for (i=0; i<256; i++) {
-          if (s->entry[i]) {
-            word = i / 32;
-            bit =  i % 32;
-            mask = 1UL << bit;
-            result[word] |= mask;
-          }
-        }
-        return CLG_SUCCESS;
-      } else {
-        return CLG_EMPTYSUBNET;
-      }
-    } else {
-      return CLG_INACTIVE;
-    }
-  } else {
-    return CLG_BADSUBNET;
-  }
-}
-
-/* ================================================== */
-
-CLG_Status
-CLG_GetClientAccessReportByIP(IPAddr *ip, RPT_ClientAccess_Report *report, time_t now)
-{
-  uint32_t ip6[4];
-  Node *node;
-
-  if (!active) {
-    return CLG_INACTIVE;
-  } else {
-    switch (ip->family) {
-      case IPADDR_INET4:
-        node = (Node *) find_subnet_dont_open(&top_subnet4, &ip->addr.in4, 1, 0);
-        break;
-      case IPADDR_INET6:
-        split_ip6(ip, ip6);
-        node = (Node *) find_subnet_dont_open(&top_subnet6, ip6, 4, 0);
-        break;
-      default:
-        return CLG_EMPTYSUBNET;
-    }
-
-    if (!node) {
-      return CLG_EMPTYSUBNET;
-    } else {
-      report->client_hits = node->client_hits;
-      report->peer_hits = node->peer_hits;
-      report->cmd_hits_auth = node->cmd_hits_auth;
-      report->cmd_hits_normal = node->cmd_hits_normal;
-      report->cmd_hits_bad = node->cmd_hits_bad;
-      report->last_ntp_hit_ago = now - node->last_ntp_hit;
-      report->last_cmd_hit_ago = now - node->last_cmd_hit;
-
-      return CLG_SUCCESS;
-    }
-  }
-}
-
-/* ================================================== */
-
 CLG_Status
 CLG_GetClientAccessReportByIndex(int index, RPT_ClientAccessByIndex_Report *report,
                                  time_t now, unsigned long *n_indices)
index 18fa4994ad2cfb59a3b9731eba2b74b25d7bd3c8..a1913b5accf4438437c4b37d69b2dbcad26d90ff 100644 (file)
@@ -31,9 +31,6 @@
 #include "sysincl.h"
 #include "reports.h"
 
-/* Enough to hold flags for 256 hosts in a class C */
-typedef uint32_t CLG_Bitmap[8];
-
 extern void CLG_Initialise(void);
 extern void CLG_Finalise(void);
 extern void CLG_LogNTPClientAccess(IPAddr *client, time_t now);
@@ -60,26 +57,8 @@ typedef enum {
   CLG_INDEXTOOLARGE             /* Node index is higher than number of nodes present */
 } CLG_Status;
 
-/* For bits=0, 8, 16, flag which immediate subnets of that subnet are
-   known.  For bits=24, flag which hosts in that subnet are known.
-   Other values, return 0 (failed) */
-
-extern CLG_Status CLG_GetSubnetBitmap(IPAddr *subnet, int bits, CLG_Bitmap result);
-
-extern CLG_Status
-CLG_GetClientAccessReportByIP(IPAddr *ip, RPT_ClientAccess_Report *report, time_t now);
-
 CLG_Status
 CLG_GetClientAccessReportByIndex(int index, RPT_ClientAccessByIndex_Report *report,
                                  time_t now, unsigned long *n_indices);
 
-/* And an iterating function, to call 'fn' for each client or peer
-   that has accessed us since 'since'. */
-
-extern void CLG_IterateNTPClients
-(void (*fn)(IPAddr *client, void *arb),
- void *arb,
- time_t since);
-
-
 #endif /* GOT_CLIENTLOG_H */
index 5ea504fe9b4ce6b6f05612430778cefb952b8359..776276a881e5cfb12d6c93cb8a6b2731966d3d92 100644 (file)
--- a/reports.h
+++ b/reports.h
@@ -86,16 +86,6 @@ typedef struct {
   double rtc_gain_rate_ppm;
 } RPT_RTC_Report;
 
-typedef struct {
-  unsigned long client_hits;
-  unsigned long peer_hits;
-  unsigned long cmd_hits_auth;
-  unsigned long cmd_hits_normal;
-  unsigned long cmd_hits_bad;
-  unsigned long last_ntp_hit_ago;
-  unsigned long last_cmd_hit_ago;
-} RPT_ClientAccess_Report;
-
 typedef struct {
   IPAddr ip_addr;
   unsigned long client_hits;