13 #if !defined(WITH_CONTIKI) && !defined(WITH_LWIP)
14 #ifdef HAVE_ARPA_INET_H
15 #include <arpa/inet.h>
17 #ifdef HAVE_NETINET_IN_H
18 #include <netinet/in.h>
20 #ifdef HAVE_SYS_SOCKET_H
21 #include <sys/socket.h>
23 #ifdef HAVE_WS2TCPIP_H
29 #define IN_MULTICAST(Address) (0)
35 switch (addr->
addr.
sa.sa_family) {
36 case AF_INET:
return ntohs(addr->
addr.
sin.sin_port);
37 case AF_INET6:
return ntohs(addr->
addr.
sin6.sin6_port);
47 switch (addr->
addr.
sa.sa_family) {
49 addr->
addr.
sin.sin_port = htons(port);
52 addr->
addr.
sin6.sin6_port = htons(port);
67 switch (a->
addr.
sa.sa_family) {
72 sizeof(
struct in_addr)) == 0;
76 sizeof(
struct in6_addr)) == 0;
87 switch (a->
addr.
sa.sa_family) {
89 return IN_MULTICAST(ntohl(a->
addr.
sin.sin_addr.s_addr));
91 return IN6_IS_ADDR_MULTICAST(&a->
addr.
sin6.sin6_addr) ||
92 (IN6_IS_ADDR_V4MAPPED(&a->
addr.
sin6.sin6_addr) &&
93 IN_MULTICAST(ntohl(a->
addr.
sin6.sin6_addr.s6_addr[12])));
105 #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