Add support for reading, merging, and querying configs
Change-Id: I04a07cf5e9a6b41213b3101f3e04be350e50b41f
diff --git a/aos/configuration.h b/aos/configuration.h
index fadd7a1..b30a2b3 100644
--- a/aos/configuration.h
+++ b/aos/configuration.h
@@ -6,12 +6,29 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+#include "absl/strings/string_view.h"
+#include "aos/configuration_generated.h"
+#include "aos/flatbuffers.h"
+
namespace aos {
// Holds global configuration data. All of the functions are safe to call
// from wherever.
namespace configuration {
+// Reads a json configuration. This includes all imports and merges. Note:
+// duplicate imports will result in a CHECK.
+Flatbuffer<Configuration> ReadConfig(const absl::string_view path);
+
+// Returns the resolved location for a name, type, and application name.
+//
+// If the application name is empty, it is ignored. Maps are processed in
+// reverse order, and application specific first.
+const Location *GetLocation(const Flatbuffer<Configuration> &config,
+ const absl::string_view name,
+ const absl::string_view type,
+ const absl::string_view application_name);
+
// Returns "our" IP address.
const in_addr &GetOwnIPAddress();