/*
* This file is part of DisOrder.
- * Copyright (C) 2004, 2007 Richard Kettlewell
+ * Copyright (C) 2004, 2007, 2008 Richard Kettlewell
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
}
+/** @brief Return nonzero if @p sin4 is an IPv4 multicast address */
static inline int multicast4(const struct sockaddr_in *sin4) {
return IN_MULTICAST(ntohl(sin4->sin_addr.s_addr));
}
+/** @brief Return nonzero if @p sin6 is an IPv6 multicast address */
static inline int multicast6(const struct sockaddr_in6 *sin6) {
return IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr);
}
}
}
+/** @brief Format an IPv4 address */
static inline char *format_sockaddr4(const struct sockaddr_in *sin4) {
char buffer[1024], *r;
return r;
}
+/** @brief Format an IPv6 address */
static inline char *format_sockaddr6(const struct sockaddr_in6 *sin6) {
char buffer[1024], *r;
return r;
}
+/** @brief Format a UNIX socket address */
static inline char *format_sockaddrun(const struct sockaddr_un *sun) {
return xstrdup(sun->sun_path);
}
-/** @brief Construct a text description a sockaddr */
+/** @brief Construct a text description a sockaddr
+ * @param sa Socket address
+ * @return Human-readable form of address
+ */
char *format_sockaddr(const struct sockaddr *sa) {
switch(sa->sa_family) {
case AF_INET: