mirror of
https://github.com/valitydev/osquery-1.git
synced 2024-11-08 18:33:54 +00:00
36 lines
883 B
C++
36 lines
883 B
C++
/*
|
|
* Copyright (c) 2014, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <ifaddrs.h>
|
|
#include <arpa/inet.h>
|
|
|
|
namespace osquery {
|
|
namespace tables {
|
|
|
|
// Define AF_INTERFACE as the alias for interface details.
|
|
#ifdef __linux__
|
|
#define AF_INTERFACE AF_PACKET
|
|
#else
|
|
#define AF_INTERFACE AF_LINK
|
|
#endif
|
|
|
|
// Return a string representation for an IPv4/IPv6 struct.
|
|
std::string ipAsString(const struct sockaddr *in);
|
|
std::string ipAsString(const struct in_addr *in);
|
|
std::string macAsString(const struct ifaddrs *addr);
|
|
std::string macAsString(const char *addr);
|
|
int netmaskFromIP(const struct sockaddr *in);
|
|
}
|
|
}
|