From a6163888f3c56123b1db313743c6147ba498732c Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Fri, 8 Aug 2014 14:42:07 +0300 Subject: Add third_party libs --- third_party/ptpd-1.1.0/src/ptpd.c | 59 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 third_party/ptpd-1.1.0/src/ptpd.c (limited to 'third_party/ptpd-1.1.0/src/ptpd.c') diff --git a/third_party/ptpd-1.1.0/src/ptpd.c b/third_party/ptpd-1.1.0/src/ptpd.c new file mode 100644 index 0000000..f137ae5 --- /dev/null +++ b/third_party/ptpd-1.1.0/src/ptpd.c @@ -0,0 +1,59 @@ +/** + * @file ptpd.c + * @date Wed Jun 23 10:13:38 2010 + * + * @brief The main() function for the PTP daemon + * + * This file contains very little code, as should be obvious, + * and only serves to tie together the rest of the daemon. + * All of the default options are set here, but command line + * arguments are processed in the ptpdStartup() routine called + * below. + */ + +#include "ptpd.h" + +RunTimeOpts rtOpts; /* statically allocated run-time + * configuration data */ + +int +main(int argc, char **argv) +{ + PtpClock *ptpClock; + Integer16 ret; + + /* initialize run-time options to reasonable values */ + rtOpts.syncInterval = DEFAULT_SYNC_INTERVAL; + memcpy(rtOpts.subdomainName, DEFAULT_PTP_DOMAIN_NAME, PTP_SUBDOMAIN_NAME_LENGTH); + memcpy(rtOpts.clockIdentifier, IDENTIFIER_DFLT, PTP_CODE_STRING_LENGTH); + rtOpts.clockVariance = DEFAULT_CLOCK_VARIANCE; + rtOpts.clockStratum = DEFAULT_CLOCK_STRATUM; + rtOpts.unicastAddress[0] = 0; + rtOpts.inboundLatency.nanoseconds = DEFAULT_INBOUND_LATENCY; + rtOpts.outboundLatency.nanoseconds = DEFAULT_OUTBOUND_LATENCY; + rtOpts.noResetClock = DEFAULT_NO_RESET_CLOCK; + rtOpts.s = DEFAULT_DELAY_S; + rtOpts.ap = DEFAULT_AP; + rtOpts.ai = DEFAULT_AI; + rtOpts.max_foreign_records = DEFAULT_MAX_FOREIGN_RECORDS; + rtOpts.currentUtcOffset = DEFAULT_UTC_OFFSET; + rtOpts.logFd = -1; + rtOpts.recordFP = NULL; + rtOpts.useSysLog = FALSE; + rtOpts.ttl = 1; + + if (!(ptpClock = ptpdStartup(argc, argv, &ret, &rtOpts))) + return ret; + + if (rtOpts.probe) { + probe(&rtOpts, ptpClock); + } else { + /* do the protocol engine */ + protocol(&rtOpts, ptpClock); + } + + ptpdShutdown(); + + NOTIFY("self shutdown, probably due to an error\n"); + return 1; +} -- cgit v1.3.1