extern endpt * any_interface; /* IPv4 wildcard */
extern endpt * any6_interface; /* IPv6 wildcard */
extern endpt * loopback_interface; /* IPv4 loopback for refclocks */
-extern struct interface *inter_list; /* linked list */
+extern endpt * ep_list; /* linked list */
/* ntp_loopfilter.c */
extern double drift_comp; /* clock frequency (s/s) */
split = ntpcal_split_eradays(rd - 1, &leaps);
retv = leaps;
/* get year and day-of-year */
- jd->year = split.hi + 1;
+ jd->year = (u_short)split.hi + 1;
if (jd->year != split.hi + 1) {
jd->year = 0;
retv = -1; /* bletch. overflow trouble. */
}
- jd->yearday = split.lo + 1;
+ jd->yearday = (u_short)split.lo + 1;
/* convert to month and mday */
split = ntpcal_split_yeardays(split.lo, leaps);
- jd->month = split.hi + 1;
- jd->monthday = split.lo + 1;
+ jd->month = (u_char)split.hi + 1;
+ jd->monthday = (u_char)split.lo + 1;
return retv ? retv : leaps;
}
/* split time part */
ds.hi += priv_timesplit(ts, ds.lo);
- id->hour = ts[0];
- id->minute = ts[1];
- id->second = ts[2];
+ id->hour = (u_char)ts[0];
+ id->minute = (u_char)ts[1];
+ id->second = (u_char)ts[2];
/* split date part */
ds.lo = ds.hi + DAY_NTP_STARTS - 1; /* elapsed era days */
ds.hi -= 1;
ds.lo += 7;
}
- id->weekday = ds.lo + 1; /* weekday result */
+ id->weekday = (u_char)ds.lo + 1; /* weekday result */
ds = isocal_split_eraweeks(ds.hi); /* elapsed years&week*/
- id->year = ds.hi + 1; /* shift to current */
- id->week = ds.lo + 1;
+ id->year = (u_short)ds.hi + 1; /* shift to current */
+ id->week = (u_char)ds.lo + 1;
return (ds.hi >= 0 && ds.hi < 0xFFFFU);
}
struct interface * la;
/*
- * loop over [0..sys_ifnum] searching inter_list for each
+ * loop over [0..sys_ifnum] searching ep_list for each
* ifnum in turn.
*/
for (ifidx = 0; ifidx < sys_ifnum; ifidx++) {
- for (la = inter_list; la != NULL; la = la->link)
+ for (la = ep_list; la != NULL; la = la->elink)
if (ifidx == la->ifnum)
break;
if (NULL == la)
)
{
int current = 0;
- u_long new_gen = ~ (u_long) 0;
time_t pivot = time(NULL);
if (!(gen->flag & FGEN_FLAG_ENABLED)) {
break;
case FILEGEN_PID:
- current = (gen->id_lo == getpid());
+ current = ((int)gen->id_lo == getpid());
break;
case FILEGEN_AGE:
static void close_and_delete_fd_from_list(SOCKET);
static void add_addr_to_list (sockaddr_u *, endpt *);
static void create_wildcards (u_short);
-static endpt * getinterface (sockaddr_u *, u_int32);
static endpt * findlocalinterface (sockaddr_u *, int, int);
static endpt * findclosestinterface (sockaddr_u *, int);
#ifdef MULTICAST_NONEWSOCKET
}
ninterfaces--;
- ntp_monclearinterface(ep);
+ mon_clearinterface(ep);
/* remove restrict interface entry */
SET_HOSTMASK(&resmask, AF(&ep->sin));
#ifdef OPEN_BCAST_SOCKET
/*
* Enable a broadcast address to a given socket
- * The socket is in the inter_list all we need to do is enable
+ * The socket is in the ep_list all we need to do is enable
* broadcasting. It is not this function's job to select the socket
*/
static isc_boolean_t
/*
* Remove a broadcast address from a given socket
- * The socket is in the inter_list all we need to do is disable
+ * The socket is in the ep_list all we need to do is disable
* broadcasting. It is not this function's job to select the socket
*/
static isc_boolean_t
/*
* Add a multicast address to a given socket
- * The socket is in the inter_list all we need to do is enable
+ * The socket is in the ep_list all we need to do is enable
* multicasting. It is not this function's job to select the socket
*/
#ifdef MCAST
/*
* Remove a multicast address from a given socket
- * The socket is in the inter_list all we need to do is disable
+ * The socket is in the ep_list all we need to do is disable
* multicasting. It is not this function's job to select the socket
*/
static isc_boolean_t
endpt * niface;
endpt * piface;
- niface = select_peerinterface(peer, &peer->srcadr, NULL,
- peer->cast_flags);
+ niface = select_peerinterface(p, &p->srcadr, NULL);
DPRINTF(4, (
"peer_refresh_interface: %s->%s mode %d vers %d poll %d %d flags 0x%x 0x%x ttl %d key %08x: new interface: ",
- peer->dstadr == NULL ? "<null>" :
- stoa(&peer->dstadr->sin), stoa(&peer->srcadr),
- peer->hmode, peer->version, peer->minpoll,
- peer->maxpoll, peer->flags, peer->cast_flags,
- peer->ttl, peer->keyid));
+ p->dstadr == NULL ? "<null>" :
+ stoa(&p->dstadr->sin), stoa(&p->srcadr), p->hmode,
+ p->version, p->minpoll, p->maxpoll, p->flags, p->cast_flags,
+ p->ttl, p->keyid));
if (niface != NULL) {
DPRINTF(4, (
"fd=%d, bfd=%d, name=%.16s, flags=0x%x, scope=%d, sin=%s",
DPRINTF(4, ("<NONE>\n"));
}
- piface = peer->dstadr;
- set_peerdstadr(peer, niface);
- if (peer->dstadr) {
+ piface = p->dstadr;
+ set_peerdstadr(p, niface);
+ if (p->dstadr) {
/*
* clear crypto if we change the local address
*/
keyFile.cpp \
kodDatabase.cpp \
kodFile.cpp \
- logFile.cpp \
networking.cpp \
packetHandling.cpp \
packetProcessing.cpp \
EXTRA_DIST = data
-CLEANFILES = data/log-output-debug \
- data/kod-output-multiple \
+CLEANFILES = data/kod-output-multiple \
data/kod-output-single \
data/debug-output-pkt \
data/debug-output-lfp-dec \
data/kod-output-blank \
- data/log-output-log \
data/debug-output-lfp-bin \
data/debug-output-lfp-hex \
$(NULL)
+++ /dev/null
-Thu Jul 29 13:01:00 2010
-: This is a debug message
-Thu Jul 29 13:01:00 2010
-: Another debug message
+++ /dev/null
-Thu Jul 29 13:01:00 2010
-: Test log message
-Thu Jul 29 13:01:00 2010
-: Test message 2
+++ /dev/null
-#include "fileHandlingTest.h"
-
-extern "C" {
-#include "log.h"
-#include <fcntl.h>
-};
-
-class logFileTest : public fileHandlingTest {
-};
-
-#if 0 /* temporarily disable, needs rework */
-TEST_F(logFileTest, WriteLogFile) {
- std::string filename = CreatePath("log-output-log", OUTPUT_DIR);
-
- ClearFile(filename);
-
- init_log(filename.c_str());
-
- log_msg("Test log message", 0);
- log_msg("Test message 2", 0);
-
- /*
- * Compare the file size, since the contents differs in the
- * timestamp.
- */
- ifstream expected(CreatePath("log-expected-log", INPUT_DIR).c_str());
- ifstream actual(CreatePath("log-output-log", OUTPUT_DIR).c_str());
- ASSERT_TRUE(expected.good());
- ASSERT_TRUE(actual.good());
-
- EXPECT_EQ(GetFileSize(expected), GetFileSize(actual));
-}
-
-TEST_F(logFileTest, WriteDebugMessage) {
- ActivateOption("-l", "/dev/null");
-
- std::string filename = CreatePath("log-output-debug", OUTPUT_DIR);
-
- // Create and/or truncate the file.
- FILE* debugFile = fopen(filename.c_str(), "w");
-
- fflush(stderr);
-
- /*
- * Copy stderr's original file handle, so we can restore
- * it later on. Then redirect stderr to our debugFile.
- */
- int orig = dup(fileno(stderr));
- dup2(fileno(debugFile), fileno(stderr));
- fclose(debugFile);
-
- debug_msg("This is a debug message");
- debug_msg("Another debug message");
-
- // Restore the original stderr handle.
- fflush(stderr);
- dup2(orig, fileno(stderr));
- close(orig);
-
- /*
- * Compare the file size, since the contents differs in the
- * timestamp.
- */
- ifstream expected(CreatePath("log-expected-debug", INPUT_DIR).c_str());
- ifstream actual(filename.c_str());
- ASSERT_TRUE(expected.good());
- ASSERT_TRUE(actual.good());
-
- EXPECT_EQ(GetFileSize(expected), GetFileSize(actual));
-}
-#endif