Replace hard coded logMinPdelayReqInterval with configuration option.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2012-07-27 22:04:00 +02:00
parent e757b7a9d4
commit 4b0f4fda42
5 changed files with 8 additions and 3 deletions

View File

@ -79,6 +79,10 @@ static void scan_line(char *s, struct config *cfg)
pod->logMinDelayReqInterval = i8; pod->logMinDelayReqInterval = i8;
} else if (1 == sscanf(s, " logMinPdelayReqInterval %hhd", &i8)) {
pod->logMinPdelayReqInterval = i8;
} else if (1 == sscanf(s, " announceReceiptTimeout %hhu", &u8)) { } else if (1 == sscanf(s, " announceReceiptTimeout %hhu", &u8)) {
pod->announceReceiptTimeout = u8; pod->announceReceiptTimeout = u8;

View File

@ -15,6 +15,7 @@ offsetScaledLogVariance 0xFFFF
logAnnounceInterval 1 logAnnounceInterval 1
logSyncInterval 0 logSyncInterval 0
logMinDelayReqInterval 0 logMinDelayReqInterval 0
logMinPdelayReqInterval 0
announceReceiptTimeout 3 announceReceiptTimeout 3
# #
# Run time options # Run time options

1
ds.h
View File

@ -80,6 +80,7 @@ struct port_defaults {
Integer8 logAnnounceInterval; Integer8 logAnnounceInterval;
Integer8 logSyncInterval; Integer8 logSyncInterval;
Integer8 logMinDelayReqInterval; Integer8 logMinDelayReqInterval;
Integer8 logMinPdelayReqInterval;
UInteger8 announceReceiptTimeout; UInteger8 announceReceiptTimeout;
UInteger8 transportSpecific; UInteger8 transportSpecific;
}; };

4
port.c
View File

@ -39,8 +39,6 @@
#define PTP_VERSION 2 #define PTP_VERSION 2
#define LOG_MIN_PDELAY_REQ_INTERVAL 2 /* allow PDelay_Req every 4 sec */
struct port { struct port {
char *name; char *name;
struct clock *clock; struct clock *clock;
@ -663,7 +661,7 @@ static int port_initialize(struct port *p)
p->announceReceiptTimeout = p->pod.announceReceiptTimeout; p->announceReceiptTimeout = p->pod.announceReceiptTimeout;
p->transportSpecific = p->pod.transportSpecific; p->transportSpecific = p->pod.transportSpecific;
p->logSyncInterval = p->pod.logSyncInterval; p->logSyncInterval = p->pod.logSyncInterval;
p->logMinPdelayReqInterval = LOG_MIN_PDELAY_REQ_INTERVAL; p->logMinPdelayReqInterval = p->pod.logMinPdelayReqInterval;
tmtab_init(&p->tmtab, 1 + p->logMinDelayReqInterval); tmtab_init(&p->tmtab, 1 + p->logMinDelayReqInterval);

View File

@ -208,6 +208,7 @@ int main(int argc, char *argv[])
pod.logAnnounceInterval = 1; pod.logAnnounceInterval = 1;
pod.logSyncInterval = 0; pod.logSyncInterval = 0;
pod.logMinDelayReqInterval = 0; pod.logMinDelayReqInterval = 0;
pod.logMinPdelayReqInterval = 0;
pod.announceReceiptTimeout = 3; pod.announceReceiptTimeout = 3;
pod.transportSpecific = 0; pod.transportSpecific = 0;