osquery-1/osquery/system/network/hostname.cpp
Alexander Kindyakov ce6eabb58b Struct [HostIdentity] to represent minimal info to identify a certain host in osquery
Summary:
I'm going to it as one of the decorators for streaming events. To be able to associate event with a certain machine on the backend side.

Why a new directory in osquery/? There are some libraries that depend on
core/database and any monster modules. To be able to keep utils simple,
lightweight and independent we should not put stuff like filesystem or network
under utils/ directory. But we need a single place to put all system assosiated
libs. So, let's make a `system` in the root of osquery.

Reviewed By: guliashvili

Differential Revision: D14706186

fbshipit-source-id: d40fde3872ca6b6677a1d8f89cfd8eda63c6b83d
2019-04-09 08:23:50 -07:00

24 lines
529 B
C++

/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed in accordance with the terms specified in
* the LICENSE file found in the root directory of this source tree.
*/
#include <osquery/system/network/hostname.h>
#include <osquery/system.h>
#include <osquery/utils/status/status.h>
namespace osquery {
HostIdentity HostIdentity::localhost() {
auto inst = HostIdentity{};
inst.fqdn = getFqdn();
getHostUUID(inst.uuid);
return inst;
}
} // namespace osquery