| 607 | // ipv4 version of name routines |
| 608 | |
| 609 | static void NetAddressToIPSocket(const NetAddress *address, struct sockaddr_in *sockAddr) |
| 610 | { |
| 611 | dMemset(sockAddr, 0, sizeof(struct sockaddr_in)); |
| 612 | sockAddr->sin_family = AF_INET; |
| 613 | sockAddr->sin_port = htons(address->port); |
| 614 | #if defined(TORQUE_OS_BSD) || defined(TORQUE_OS_MAC) |
| 615 | sockAddr->sin_len = sizeof(struct sockaddr_in); |
| 616 | #endif |
| 617 | if (address->type == NetAddress::IPBroadcastAddress) |
| 618 | { |
| 619 | sockAddr->sin_addr.s_addr = htonl(INADDR_BROADCAST); |
| 620 | } |
| 621 | else |
| 622 | { |
| 623 | dMemcpy(&sockAddr->sin_addr, &address->address.ipv4.netNum[0], 4); |
| 624 | } |
| 625 | } |
| 626 | |
| 627 | static void IPSocketToNetAddress(const struct sockaddr_in *sockAddr, NetAddress *address) |
| 628 | { |
no test coverage detected