compare coap addresses (currently only uip)

This commit is contained in:
Olaf Bergmann committed 2012-01-13 18:43:25 +01:00
1 parent cc116c3b5f
commit f300bf4d48
1 file changed
+14
+14
View File
@@ -41,6 +41,12 @@ typedef struct __coap_address_t {
} __coap_address_t;
#define coap_address_t __coap_address_t
#define _coap_address_equals_impl(A,B) \
((A)->size == (B)->size \
&& (A)->port == (B)->port \
&& uip_ipaddr_cmp((A),(B)))
#endif /* WITH_CONTIKI */
/** multi-purpose address abstraction */
@@ -56,6 +62,8 @@ typedef struct __coap_address_t {
} __coap_address_t;
#define coap_address_t __coap_address_t
/* FIXME: implement _coap_address_equals_impl(a, b);*/
#endif /* coap_address_t */
/**
@@ -72,4 +80,10 @@ coap_address_init(coap_address_t *addr) {
addr->size = sizeof(addr->addr);
}
static inline int
coap_address_equals(const coap_address_t *a, const coap_address_t *b) {
assert(a); assert(b);
return _coap_address_equals_impl(a, b);
}
#endif /* _COAP_ADDRESS_H_ */