diff options
Diffstat (limited to 'src/trackerlogic.h')
| -rw-r--r-- | src/trackerlogic.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/trackerlogic.h b/src/trackerlogic.h index 4086b23..a05c790 100644 --- a/src/trackerlogic.h +++ b/src/trackerlogic.h | |||
| @@ -4,10 +4,12 @@ | |||
| 4 | #ifndef OT_TRACKERLOGIC_H__ | 4 | #ifndef OT_TRACKERLOGIC_H__ |
| 5 | #define OT_TRACKERLOGIC_H__ | 5 | #define OT_TRACKERLOGIC_H__ |
| 6 | 6 | ||
| 7 | #include <arpa/inet.h> | ||
| 7 | #include <signal.h> | 8 | #include <signal.h> |
| 8 | #include <stdatomic.h> | 9 | #include <stdatomic.h> |
| 9 | #include <stdint.h> | 10 | #include <stdint.h> |
| 10 | #include <stdlib.h> | 11 | #include <stdlib.h> |
| 12 | #include <string.h> | ||
| 11 | #include <sys/time.h> | 13 | #include <sys/time.h> |
| 12 | #include <sys/types.h> | 14 | #include <sys/types.h> |
| 13 | #include <time.h> | 15 | #include <time.h> |
| @@ -124,6 +126,14 @@ static inline int time_is_past(ot_time deadline) { return time_now_seconds() > d | |||
| 124 | survive a restart, and the clock above counts from boot. */ | 126 | survive a restart, and the clock above counts from boot. */ |
| 125 | static inline ot_time time_wall_minutes(void) { return time(NULL) / 60; } | 127 | static inline ot_time time_wall_minutes(void) { return time(NULL) / 60; } |
| 126 | 128 | ||
| 129 | /* Appends a 32 bit value in network byte order to a binary reply and | ||
| 130 | advances the cursor. The caller has made sure of the room. */ | ||
| 131 | static inline void pack_uint32(char **cursor, uint32_t value) { | ||
| 132 | value = htonl(value); | ||
| 133 | memcpy(*cursor, &value, sizeof(value)); | ||
| 134 | *cursor += sizeof(value); | ||
| 135 | } | ||
| 136 | |||
| 127 | /* Cleared from the interrupt handler and read by every worker */ | 137 | /* Cleared from the interrupt handler and read by every worker */ |
| 128 | extern _Atomic int g_opentracker_running; | 138 | extern _Atomic int g_opentracker_running; |
| 129 | 139 | ||
