| 665 | // ipv4 version of name routines |
| 666 | |
| 667 | static void NetAddressToIPSocket(const NetAddress *address, struct sockaddr_in *sockAddr) |
| 668 | { |
| 669 | dMemset(sockAddr, 0, sizeof(struct sockaddr_in)); |
| 670 | sockAddr->sin_family = AF_INET; |
| 671 | sockAddr->sin_port = htons(address->port); |
| 672 | #if defined(TORQUE_OS_BSD) || defined(TORQUE_OS_MAC) |
| 673 | sockAddr->sin_len = sizeof(struct sockaddr_in); |
| 674 | #endif |
| 675 | if (address->type == NetAddress::IPBroadcastAddress) |
| 676 | { |
| 677 | sockAddr->sin_addr.s_addr = htonl(INADDR_BROADCAST); |
| 678 | } |
| 679 | else |
| 680 | { |
| 681 | dMemcpy(&sockAddr->sin_addr, &address->address.ipv4.netNum[0], 4); |
| 682 | } |
| 683 | } |
| 684 | |
| 685 | static void IPSocketToNetAddress(const struct sockaddr_in *sockAddr, NetAddress *address) |
| 686 | { |
no test coverage detected