18#if !defined(WITH_CONTIKI) && !defined(WITH_LWIP)
19#ifdef HAVE_ARPA_INET_H
22#ifdef HAVE_NETINET_IN_H
23#include <netinet/in.h>
25#ifdef HAVE_SYS_SOCKET_H
26#include <sys/socket.h>
34#define IN_MULTICAST(Address) (0)
40 switch (addr->
addr.
sa.sa_family) {
41 case AF_INET:
return ntohs(addr->
addr.
sin.sin_port);
42 case AF_INET6:
return ntohs(addr->
addr.
sin6.sin6_port);
52 switch (addr->
addr.
sa.sa_family) {
54 addr->
addr.
sin.sin_port = htons(port);
57 addr->
addr.
sin6.sin6_port = htons(port);
72 switch (a->
addr.
sa.sa_family) {
77 sizeof(
struct in_addr)) == 0;
81 sizeof(
struct in6_addr)) == 0;
92 switch (a->
addr.
sa.sa_family) {
94 return IN_MULTICAST(ntohl(a->
addr.
sin.sin_addr.s_addr));
96 return IN6_IS_ADDR_MULTICAST(&a->
addr.
sin6.sin6_addr) ||
97 (IN6_IS_ADDR_V4MAPPED(&a->
addr.
sin6.sin6_addr) &&
98 IN_MULTICAST(ntohl(a->
addr.
sin6.sin6_addr.s6_addr[12])));
110#if !defined(WITH_LWIP) && !defined(WITH_CONTIKI)
void coap_address_set_port(coap_address_t *addr, uint16_t port)
Set the port field of addr to port (in host byte order).
void coap_address_init(coap_address_t *addr)
Resets the given coap_address_t object addr to its default values.
int coap_is_mcast(const coap_address_t *a)
Checks if given address a denotes a multicast address.
uint16_t coap_address_get_port(const coap_address_t *addr)
Returns the port from addr in host byte order.
int coap_address_equals(const coap_address_t *a, const coap_address_t *b)
Compares given address objects a and b.
Pulls together all the internal only header files.
multi-purpose address abstraction
socklen_t size
size of addr
union coap_address_t::@0 addr