John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 1 | #ifndef AOS_UTIL_INET_ADDR_H_ |
| 2 | #define AOS_UTIL_INET_ADDR_H_ |
Brian Silverman | 66f079a | 2013-08-26 16:24:30 -0700 | [diff] [blame] | 3 | |
| 4 | #ifdef __VXWORKS__ |
| 5 | #include <inetLib.h> |
| 6 | #else |
| 7 | #include <sys/socket.h> |
| 8 | #include <netinet/in.h> |
| 9 | #include <arpa/inet.h> |
| 10 | #endif |
| 11 | |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 12 | #include "aos/network_port.h" |
Brian Silverman | 66f079a | 2013-08-26 16:24:30 -0700 | [diff] [blame] | 13 | |
| 14 | namespace aos { |
| 15 | namespace util { |
| 16 | |
| 17 | // Makes an IP address string from base_address with the last byte set to |
| 18 | // last_segment. |
| 19 | // Returns a malloc(3)ed string. |
| 20 | const char *MakeIPAddress(const in_addr &base_address, |
| 21 | ::aos::NetworkAddress last_segment); |
| 22 | |
| 23 | // Sets the last byte of *address to last_segment. |
| 24 | void SetLastSegment(in_addr *address, ::aos::NetworkAddress last_segment); |
| 25 | |
| 26 | } // namespace util |
| 27 | } // namespace aos |
| 28 | |
John Park | 33858a3 | 2018-09-28 23:05:48 -0700 | [diff] [blame] | 29 | #endif // AOS_UTIL_INET_ADDR_H_ |