diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2014-08-08 14:42:07 +0300 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2014-08-08 14:42:07 +0300 |
| commit | a6163888f3c56123b1db313743c6147ba498732c (patch) | |
| tree | ff7d15d991d1d09ba6cbc0cec80924f57445bfdd /third_party/ptpd-1.1.0/src/ptpd.c | |
| parent | c3e4c9a25c2910d2d66d52215b3406b13d5b23d5 (diff) | |
Add third_party libs
Diffstat (limited to 'third_party/ptpd-1.1.0/src/ptpd.c')
| -rw-r--r-- | third_party/ptpd-1.1.0/src/ptpd.c | 59 |
1 files changed, 59 insertions, 0 deletions
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;
+}
|
