diff options
| -rw-r--r-- | include/ouroboros/endian.h | 24 | ||||
| -rw-r--r-- | src/ipcpd/normal/enroll.c | 8 | 
2 files changed, 12 insertions, 20 deletions
diff --git a/include/ouroboros/endian.h b/include/ouroboros/endian.h index c6b0d80a..745f0c57 100644 --- a/include/ouroboros/endian.h +++ b/include/ouroboros/endian.h @@ -132,23 +132,15 @@ static inline uint64_t bswap_64(uint64_t x) {  #endif  #ifdef CPU_LITTLE_ENDIAN -#define htonll(x) bswap_64(x) -#ifndef htonl -#define htonl(x)  bswap_32(x) -#endif -#define ntohll(x) bswap_64(x) -#ifndef ntohl -#define ntohl(x)  bswap_32(x) -#endif +#define hton64(x) bswap_64(x) +#define hton32(x) bswap_32(x) +#define ntoh64(x) bswap_64(x) +#define ntoh32(x) bswap_32(x)  #else /* CPU_LITTLE_ENDIAN */ -#define htonll(x) (x) -#ifndef htonl -#define htonl(x)  (x) -#endif -#define ntohll(x) (x) -#ifndef ntohl -#define nothl(x)  (x) -#endif +#define hton64(x) (x) +#define hton32(x) (x) +#define ntoh64(x) (x) +#define noth32(x) (x)  #endif /* CPU_LITTLE_ENDIAN */  #endif /* OUROBOROS_ENDIAN_H */ diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c index cea33bf2..94e171c0 100644 --- a/src/ipcpd/normal/enroll.c +++ b/src/ipcpd/normal/enroll.c @@ -106,8 +106,8 @@ int enroll_handle(int fd)                          struct timespec t;                          uint64_t buf[2];                          clock_gettime(CLOCK_REALTIME, &t); -                        buf[0] = htonll(t.tv_sec); -                        buf[1] = htonll(t.tv_nsec); +                        buf[0] = hton64(t.tv_sec); +                        buf[1] = hton64(t.tv_nsec);                          cdap_reply_send(ci, key, 0, buf, sizeof(buf));                          free(name);                          continue; @@ -214,8 +214,8 @@ int enroll_boot(char * dst_name)          assert (len == 2 * sizeof (uint64_t)); -        rtt.tv_sec  = ntohll(((uint64_t *) data)[0]); -        rtt.tv_nsec = ntohll(((uint64_t *) data)[1]); +        rtt.tv_sec  = ntoh64(((uint64_t *) data)[0]); +        rtt.tv_nsec = ntoh64(((uint64_t *) data)[1]);          if (abs(ts_diff_ms(&t0, &rtt)) - delta_t > ENROLL_WARN_TIME_OFFSET)                  log_warn("Clock offset above threshold.");  | 
