]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Use a local copy of the nqptp shared memory interface description file.
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Thu, 22 Jul 2021 10:01:53 +0000 (11:01 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Thu, 22 Jul 2021 10:01:53 +0000 (11:01 +0100)
nqptp-shm-structures.h [new file with mode: 0644]
ptp-utilities.c

diff --git a/nqptp-shm-structures.h b/nqptp-shm-structures.h
new file mode 100644 (file)
index 0000000..36c8a81
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the nqptp distribution (https://github.com/mikebrady/nqptp).
+ * Copyright (c) 2021 Mike Brady.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Commercial licensing is also available.
+ */
+
+#ifndef NQPTP_SHM_STRUCTURES_H
+#define NQPTP_SHM_STRUCTURES_H
+
+#define STORAGE_ID "/nqptp"
+#define MAX_CLOCKS 32
+#define NQPTP_SHM_STRUCTURES_VERSION 5
+#define NQPTP_CONTROL_PORT 9000
+
+// the control port will accept a UDP packet with the first letter being:
+// "T", followed by a space and then a space-delimited
+// list of ip numbers, either IPv4 or IPv6
+// the whole not to exceed 4096 characters in total
+// The IPs will become the new list of timing peers, replacing any previous
+
+#include <inttypes.h>
+#include <pthread.h>
+
+struct shm_structure {
+  pthread_mutex_t shm_mutex;            // for safely accessing the structure
+  uint16_t version;                     // check this is equal to NQPTP_SHM_STRUCTURES_VERSION
+  uint32_t flags;                       // unused
+  uint64_t master_clock_id;             // the current master clock
+  char master_clock_ip[64];             // where it's coming from
+  uint64_t local_time;                  // the time when the offset was calculated
+  uint64_t local_to_master_time_offset; // add this to the local time to get master clock time
+  uint64_t master_clock_start_time;     // this is when the master clock became master
+};
+
+#endif
index a9cf614f947c629680dc7a93fd8e2bbc7325357e..0f80e9135167ac7b2c928aac87cffdc5c52f0c7d 100644 (file)
@@ -41,7 +41,7 @@
 #include <inttypes.h>
 #include <unistd.h>
 
-#include "../nqptp/nqptp-shm-structures.h"
+#include "nqptp-shm-structures.h"
 #include "ptp-utilities.h"
 
 int shm_fd;