]> git.ipfire.org Git - thirdparty/nqptp.git/commitdiff
Stop using packed structures, increase the limit to 32 clocks.
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Sat, 20 Mar 2021 09:13:52 +0000 (09:13 +0000)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Sat, 20 Mar 2021 09:13:52 +0000 (09:13 +0000)
nqptp-shm-structures.h

index 5d9d6656d50e40a5a3d26d135676b98436ddf25a..07350ba5a71edadb66f03fcb3c2de9d834ac5742 100644 (file)
 #ifndef NQPTP_SHM_STRUCTURES_H
 #define NQPTP_SHM_STRUCTURES_H
 
-#define MAX_SHARED_CLOCKS 8
+#define MAX_SHARED_CLOCKS 32
 #define NQPTP_SHM_STRUCTURES_VERSION 1
 
 #include <inttypes.h>
 #include <netinet/in.h>
 #include <pthread.h>
 
-struct __attribute__((__packed__)) clock_source {
-    char ip[INET6_ADDRSTRLEN]; // where it's coming from
-    int flags;                 // not used yet
-    int valid;                 // this entry is valid
+struct clock_source {
+    char ip[64];               // 64 is nicely aligned and bigger than INET6_ADDRSTRLEN (46)
     uint64_t source_time;     // the time at the source at
     uint64_t local_time;       // the local time when the source time is valid
     uint64_t local_to_source_time_offset; // add this to the local time to get source time
+    int flags;                 // not used yet
+    int valid;                 // this entry is valid
 };
 
-struct __attribute__((__packed__)) shm_basic_structure {
+struct shm_basic_structure {
 };
 
-struct __attribute__((__packed__)) shm_structure {
+struct shm_structure {
     pthread_mutex_t shm_mutex; // for safely accessing the structure
     uint16_t size_of_clock_array; // check this is equal to MAX_SHARED_CLOCKS
     uint16_t version; // check this is equal to NQPTP_SHM_STRUCTURES_VERSION