blob: f41b86efbed8cc1de484b5646a47cf491f2fc6ef [file] [log] [blame]
Brian Silverman66f079a2013-08-26 16:24:30 -07001#ifndef AOS_COMMON_UTIL_H_
2#define AOS_COMMON_UTIL_H_
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
12#include "aos/common/network_port.h"
13
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
29#endif // AOS_COMMON_UTIL_H_