| 237 | } |
| 238 | |
| 239 | Result SetMulticastIf(Socket socket, Address address) |
| 240 | { |
| 241 | #if defined(__EMSCRIPTEN__) |
| 242 | return RESULT_AFNOSUPPORT; |
| 243 | #else |
| 244 | int result = -1; |
| 245 | if (IsSocketIPv4(socket)) |
| 246 | { |
| 247 | struct in_addr inaddr; |
| 248 | memset(&inaddr, 0, sizeof(inaddr)); |
| 249 | inaddr.s_addr = *IPv4(&address); |
| 250 | result = setsockopt(socket, IPPROTO_IP, IP_MULTICAST_IF, (char *) &inaddr, sizeof(inaddr)); |
| 251 | } |
| 252 | #if !defined(DM_IPV6_UNSUPPORTED) |
| 253 | else if (IsSocketIPv6(socket)) |
| 254 | { |
| 255 | struct in6_addr inaddr; |
| 256 | memcpy(&inaddr, IPv6(&address), sizeof(struct in6_addr)); |
| 257 | result = setsockopt(socket, IPPROTO_IP, IP_MULTICAST_IF, (char *) &inaddr, sizeof(inaddr)); |
| 258 | } |
| 259 | #endif // no ipv6 |
| 260 | else |
| 261 | { |
| 262 | dmLogError("Failed to enable multicast interface, unsupported address family!"); |
| 263 | return RESULT_AFNOSUPPORT; |
| 264 | } |
| 265 | |
| 266 | return result == 0 ? RESULT_OK : NATIVETORESULT(DM_SOCKET_ERRNO); |
| 267 | #endif |
| 268 | } |
| 269 | |
| 270 | Result Delete(Socket socket) |
| 271 | { |
nothing calls this directly
no test coverage detected