]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
networking.h:
authorJohannes Maximilian Kuehn <kuehn@ntp.org>
Sat, 16 Aug 2008 20:57:54 +0000 (05:57 +0900)
committerJohannes Maximilian Kuehn <kuehn@ntp.org>
Sat, 16 Aug 2008 20:57:54 +0000 (05:57 +0900)
  Removed useless prototype filter_ntp
main.c, utilities.c, networking.c, kod_management.c:
  Cleaning up

bk: 48a73f52GWNMsDErcxi52vEU151EQw

gsoc_sntp/kod_management.c
gsoc_sntp/main.c
gsoc_sntp/networking.c
gsoc_sntp/networking.h
gsoc_sntp/utilities.c

index 54b7525e7634bc453daa03648b5c8947535062cc..685a4c75c75ae2bd09f0adac1ace850376b95bdb 100644 (file)
@@ -157,7 +157,6 @@ kod_init_kod_db (
 
        /* Max. of 255 characters for hostname, 10 for timestamp, 4 for kisscode, 2 for format : and 1 for \n */
        char fbuf[272];
-       char *obuf = fbuf;
        char error = 0;
 
 
@@ -179,7 +178,6 @@ kod_init_kod_db (
        printf("Starting to read KOD file %s...\n", db_file);
        /* First let's see how many entries there are and check for right syntax */
 
-       int scan_value = 0;
        while(!feof(db_s)) {
                fgets(fbuf, 272, db_s);
                
@@ -223,8 +221,8 @@ kod_init_kod_db (
        for(b=0; (!feof(db_s) || !ferror(db_s)) && b<entryc; b++) {
                char *str_ptr = fgets(fbuf, 272, db_s);
 
-               int j = sscanf(fbuf, "%255[^:]", &(kod_db[b].hostname));
-               j += sscanf(fbuf + j, "%*[^:]:%i:%4s", &kod_db[b].timestamp, &(kod_db[b].type));
+               int j = sscanf(fbuf, "%255[^:]", (char *) &(kod_db[b].hostname));
+               j += sscanf(fbuf + j, "%*[^:]:%i:%4s", &kod_db[b].timestamp, (char *) &(kod_db[b].type));
 
                if(str_ptr == NULL) {
                        b = entryc;
index 70fc9c739acfbd420f52bcdf991db7b67a3bae47..760167aaaabcc33d55125b52c347100a106ba313 100644 (file)
@@ -43,7 +43,6 @@ sntp_main (
                char **argv
                ) 
 {
-       char *kod_file, *log_file;
        register int c;
 
        if (isc_net_probeipv6() != ISC_R_SUCCESS) {
@@ -65,7 +64,7 @@ sntp_main (
 
        /* Initialize logging system */
        if(HAVE_OPT(FILELOG)) {
-               init_log(OPT_ARG(FILELOG));
+               init_log((char *) OPT_ARG(FILELOG));
        }
 
        if(HAVE_OPT(KOD)) {
@@ -129,24 +128,25 @@ on_wire (
                struct pkt *x_pkt = (struct pkt *) malloc(sizeof(struct pkt));
                struct pkt *r_pkt = (struct pkt *) malloc(sizeof(struct pkt));
 
-               struct timeval tv_org, tv_dst;
+               struct timeval tv_xmt, tv_dst;
        
                double t21, t34, delta, offset;
 
                int error, rsock, rpktl;
 
-               l_fp p_rec, p_xmt, p_ref, p_org, org, tmp, dst, theta;
+               l_fp p_rec, p_xmt, p_ref, p_org, xmt, org, tmp, dst, theta;
 
 
-               error = GETTIMEOFDAY(&tv_org, (struct timezone *)NULL);
+               error = GETTIMEOFDAY(&tv_xmt, (struct timezone *)NULL);
 
 #ifdef DEBUG
-               printf("Current time sec: %i msec: %i\n\n", tv_org.tv_sec, tv_org.tv_usec);
+               printf("Current time sec: %i msec: %i\n\n", (unsigned int) tv_xmt.tv_sec, 
+                               (unsigned int) tv_xmt.tv_usec);
 #endif
 
-               tv_org.tv_sec += JAN_1970;
-               TVTOTS(&tv_org, &org);
-               HTONL_FP(&org, &(x_pkt->org));
+               tv_xmt.tv_sec += JAN_1970;
+               TVTOTS(&tv_xmt, &xmt);
+               HTONL_FP(&xmt, &(x_pkt->xmt));
 
                x_pkt->stratum = STRATUM_TO_PKT(STRATUM_UNSPEC);
                x_pkt->ppoll = 8;
@@ -162,8 +162,8 @@ on_wire (
 
                close_socket(sock);
 
-               if(rpktl == -1) 
-                       return -1; 
+/*             if(rpktl == -1) 
+                       return -1; */
                
                /* -2 would indicate that we should try to get a packet 
                 * from this server again 
@@ -199,6 +199,8 @@ on_wire (
 #endif
 
                        GETTIMEOFDAY(&tv_dst, (struct timezone *)NULL);
+
+                       tv_dst.tv_sec += JAN_1970;
        
                        tmp = p_rec;
                        L_SUB(&tmp, &p_org);
@@ -220,7 +222,7 @@ on_wire (
                                printf("on_wire: t21: %.6f\t t34: %.6f\ndelta: %.6f\t offset: %.6f\n", 
                                                t21, t34, delta, offset);
 
-                       set_time(offset);
+/*                     set_time(offset); */
 
                        return 0;
                }
index 90b8aa4995a7ec4c26c18b72a04c77aacdc2beef..e2f06f67e3b8a92a859b1348b319f73589d3932c 100644 (file)
@@ -1,4 +1,5 @@
 #include <config.h>
+#include <unistd.h>
 
 #include "sntp-opts.h" 
 #include "networking.h"
@@ -31,9 +32,8 @@ resolve_hosts (
                printf("Starting host resolution for %s...\n", hosts[a]); 
 #endif
 
-               struct addrinfo hints, *dres, *res0;
+               struct addrinfo hints, *dres;
                int error;
-               const char *cause = NULL;
 
                memset(&hints, 0, sizeof(hints));
                hints.ai_family = PF_UNSPEC;
@@ -98,7 +98,7 @@ resolve_hosts (
        for(a=0; a<entryc; a++)
                getnameinfo(result[a]->ai_addr, result[a]->ai_addrlen, adr_buf, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST);
 
-               printf("%x: IP %s\n", result[a], adr_buf); 
+               printf("%x: IP %s\n", (unsigned int) result[a], adr_buf); 
 #endif
 
        *res = (struct addrinfo *) malloc(sizeof(struct addrinfo *) * entryc);
@@ -188,7 +188,6 @@ recvdata (
 #endif
 
 #ifdef DEBUG
-       register int a;
 
        if(recvc > 0) {
                getnameinfo((struct sockaddr *)sender, sender->ss_len, adr_buf, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST);
@@ -226,11 +225,9 @@ recvpkt (
        int has_mac;
        int is_authentic;
 
-       l_fp ts;
-       l_fp t10, t23, tmp;
+       l_fp tmp;
        l_fp org;
        l_fp rec;
-       l_fp ci;
 
 
        struct sockaddr_storage sender;
@@ -419,12 +416,3 @@ filter_reachable (
 
        return filter_elements;
 }
-
-/* Will be handled by recvpkt */
-int
-filter_ntp (
-               struct addrinfo **res,
-               int resc
-          )
-{
-}
index fb5b26cc96e49b26f600c3ca74dd76de45fc096c..03d39188717250464c6568f30a507b7525468c5f 100644 (file)
@@ -1,16 +1,8 @@
 #ifndef NETWORK_H
 #define NETWORK_H
 
-#if 0
-#include <sys/types.h> /**/
-/* #include <sys/socket.h>     /**/
-/* #include <netinet/in.h>     /**/
-/* #include <netdb.h>  /**/
-#include <stdlib.h>    /**/
-#include <string.h>    /**/
-#endif
-#include <strings.h>   /**/
-#include <errno.h>     /**/
+#include <strings.h>   
+#include <errno.h>
 
 #include <ntp_stdlib.h>
 
 #define closesocket close
 #endif
 
-/* Check if necessary or not */
-/* Maximum number of sockets... should be specified in sntp.h later */
-#define MAX_AF 2
-
-int descriptors[MAX_AF];
-
 
 /* From ntpdate.c */
 int is_reachable (struct addrinfo *dst);
@@ -45,6 +31,4 @@ int recvdata (SOCKET rsock, struct sockaddr_storage *sender, char *rdata, size_t
 
 int recvpkt (SOCKET rsock, struct pkt *rpkt, struct pkt *spkt);
 
-int filter_reachable (struct addrinfo **res, int resc);
-
 #endif
index 1d6de37af816f5e00e7b26a3c62c80fdac799c19..f8a6d5c676d6e0d1f46da803fb78dd57ccde3e7f 100644 (file)
@@ -52,7 +52,7 @@ l_fp_output_bin (
                FILE *output
                )
 {
-       register int a, b, bexp;
+       register int a, b;
 
        fprintf(output, HLINE);