blob: dc2d6131bde35c00680f1eff30b3005cede35f40 [file] [log] [blame]
John Park33858a32018-09-28 23:05:48 -07001#ifndef AOS_UTIL_INET_ADDR_H_
2#define AOS_UTIL_INET_ADDR_H_
Brian Silverman66f079a2013-08-26 16:24:30 -07003
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 Park33858a32018-09-28 23:05:48 -070012#include "aos/network_port.h"
Brian Silverman66f079a2013-08-26 16:24:30 -070013
14namespace aos {
15namespace 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.
20const char *MakeIPAddress(const in_addr &base_address,
21 ::aos::NetworkAddress last_segment);
22
23// Sets the last byte of *address to last_segment.
24void SetLastSegment(in_addr *address, ::aos::NetworkAddress last_segment);
25
26} // namespace util
27} // namespace aos
28
John Park33858a32018-09-28 23:05:48 -070029#endif // AOS_UTIL_INET_ADDR_H_