mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-17 10:33:49 +01:00
gcoap: make use of sock_udp_ep_is_multicast()
This commit is contained in:
parent
15fd7a9a1c
commit
a7866f78a1
@ -85,7 +85,6 @@ static void _cache_process(gcoap_request_memo_t *memo,
|
|||||||
static ssize_t _cache_build_response(nanocoap_cache_entry_t *ce, coap_pkt_t *pdu,
|
static ssize_t _cache_build_response(nanocoap_cache_entry_t *ce, coap_pkt_t *pdu,
|
||||||
uint8_t *buf, size_t len);
|
uint8_t *buf, size_t len);
|
||||||
static void _receive_from_cache_cb(void *arg);
|
static void _receive_from_cache_cb(void *arg);
|
||||||
static bool _ep_is_multicast(const sock_udp_ep_t *remote_ep);
|
|
||||||
|
|
||||||
static int _request_matcher_default(gcoap_listener_t *listener,
|
static int _request_matcher_default(gcoap_listener_t *listener,
|
||||||
const coap_resource_t **resource,
|
const coap_resource_t **resource,
|
||||||
@ -353,7 +352,7 @@ static void _on_sock_udp_evt(sock_udp_t *sock, sock_async_flags_t type, void *ar
|
|||||||
.flags = SOCK_AUX_SET_LOCAL,
|
.flags = SOCK_AUX_SET_LOCAL,
|
||||||
.local = aux_in.local,
|
.local = aux_in.local,
|
||||||
};
|
};
|
||||||
if (_ep_is_multicast(&aux_in.local)) {
|
if (sock_udp_ep_is_multicast(&aux_in.local)) {
|
||||||
/* This eventually gets passed to sock_udp_send_aux, where NULL
|
/* This eventually gets passed to sock_udp_send_aux, where NULL
|
||||||
* simply does not set any flags */
|
* simply does not set any flags */
|
||||||
aux_out_ptr = NULL;
|
aux_out_ptr = NULL;
|
||||||
@ -845,24 +844,6 @@ static int _find_resource(gcoap_socket_type_t tl_type,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _ep_is_multicast(const sock_udp_ep_t *remote_ep)
|
|
||||||
{
|
|
||||||
switch (remote_ep->family) {
|
|
||||||
#ifdef SOCK_HAS_IPV6
|
|
||||||
case AF_INET6:
|
|
||||||
return ipv6_addr_is_multicast((const ipv6_addr_t *)&remote_ep->addr.ipv6);
|
|
||||||
#endif
|
|
||||||
#ifdef SOCK_HAS_IPV4
|
|
||||||
case AF_INET:
|
|
||||||
return ipv4_addr_is_multicast((const ipv4_addr_t *)&remote_ep->addr.ipv4);
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
assert(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finds the memo for an outstanding request within the _coap_state.open_reqs
|
* Finds the memo for an outstanding request within the _coap_state.open_reqs
|
||||||
* array. Matches on remote endpoint and token.
|
* array. Matches on remote endpoint and token.
|
||||||
@ -900,7 +881,7 @@ static void _find_req_memo(gcoap_request_memo_t **memo_ptr, coap_pkt_t *src_pdu,
|
|||||||
if ((memcmp(coap_get_token(src_pdu), coap_get_token(memo_pdu), cmplen) == 0)
|
if ((memcmp(coap_get_token(src_pdu), coap_get_token(memo_pdu), cmplen) == 0)
|
||||||
&& (sock_udp_ep_equal(&memo->remote_ep, remote)
|
&& (sock_udp_ep_equal(&memo->remote_ep, remote)
|
||||||
/* Multicast addresses are not considered in matching responses */
|
/* Multicast addresses are not considered in matching responses */
|
||||||
|| _ep_is_multicast(&memo->remote_ep)
|
|| sock_udp_ep_is_multicast(&memo->remote_ep)
|
||||||
)) {
|
)) {
|
||||||
*memo_ptr = memo;
|
*memo_ptr = memo;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user