diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/gmrf/gmrf.h | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/include/gmrf/gmrf.h b/include/gmrf/gmrf.h index 02442b1..05657fd 100644 --- a/include/gmrf/gmrf.h +++ b/include/gmrf/gmrf.h @@ -30,24 +30,32 @@ #include <stdbool.h> #include <stddef.h> #include <stdint.h> +#include <string.h> typedef struct gmrf_context gmrf_context_t; typedef struct gmrf_iface gmrf_iface_t; +#define GMRF_ADDR_LEN 8 + typedef struct gmrf_addr { - uint8_t d[8]; + uint8_t d[GMRF_ADDR_LEN]; } gmrf_addr_t; static const gmrf_addr_t gmrf_addr_unspec = {}; +static inline bool gmrf_addr_equal(const gmrf_addr_t *addr1, const gmrf_addr_t *addr2) { + return (memcmp(addr1->d, addr2->d, GMRF_ADDR_LEN) == 0); +} + + gmrf_addr_t gmrf_iface_get_addr(gmrf_context_t *ctx, gmrf_iface_t *iface); size_t gmrf_iface_get_mtu(gmrf_context_t *ctx, gmrf_iface_t *iface); -bool gmrf_iface_send(gmrf_context_t *ctx, gmrf_iface_t *iface, void *data, size_t len, gmrf_addr_t dest); -bool gmrf_iface_send_bc(gmrf_context_t *ctx, gmrf_iface_t *iface, void *data, size_t len); +bool gmrf_iface_send(gmrf_context_t *ctx, gmrf_iface_t *iface, const void *data, size_t len, const gmrf_addr_t *dest); +bool gmrf_iface_send_bc(gmrf_context_t *ctx, gmrf_iface_t *iface, const void *data, size_t len); #endif /* _GMRF_GMRF_H_ */ |