blob: 35368f18bdf8d5973b0daf78f53818c44f04062e [file] [log] [blame]
Brianc1dc7d22014-04-02 12:21:08 -07001#ifndef AOS_COMMON_UTIL_INET_ADDR_H_
2#define AOS_COMMON_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
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
Brianc1dc7d22014-04-02 12:21:08 -070029#endif // AOS_COMMON_UTIL_INET_ADDR_H_