11 #if !defined(WITH_CONTIKI) && !defined(WITH_LWIP)
12 #ifdef HAVE_ARPA_INET_H
13 #include <arpa/inet.h>
15 #ifdef HAVE_NETINET_IN_H
16 #include <netinet/in.h>
18 #ifdef HAVE_SYS_SOCKET_H
19 #include <sys/socket.h>
21 #ifdef HAVE_WS2TCPIP_H
27 #define IN_MULTICAST(Address) (0)
33 switch (addr->
addr.
sa.sa_family) {
34 case AF_INET:
return ntohs(addr->
addr.
sin.sin_port);
35 case AF_INET6:
return ntohs(addr->
addr.
sin6.sin6_port);
45 switch (addr->
addr.
sa.sa_family) {
47 addr->
addr.
sin.sin_port = htons(port);
50 addr->
addr.
sin6.sin6_port = htons(port);
65 switch (a->
addr.
sa.sa_family) {
70 sizeof(
struct in_addr)) == 0;
74 sizeof(
struct in6_addr)) == 0;
85 switch (a->
addr.
sa.sa_family) {
87 return IN_MULTICAST(ntohl(a->
addr.
sin.sin_addr.s_addr));
89 return IN6_IS_ADDR_MULTICAST(&a->
addr.
sin6.sin6_addr) ||
90 (IN6_IS_ADDR_V4MAPPED(&a->
addr.
sin6.sin6_addr) &&
91 IN_MULTICAST(ntohl(a->
addr.
sin6.sin6_addr.s6_addr[12])));
103 #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