Add reverse name lookup for channels

This makes it so that if you know the fully-resolved channel name you
can figure out all the possible ways that it can be referred to. This is
potentially useful for a variety of things, including:
* Config validation (e.g. identifying all the channels that exist
  on the /aos/remote_timestamp/* namespace, to determine if there are
  any extraneous channels).
* Improving auto-complete for command-line utilities.
* Adding more options for how channel names are presented in
  log-analysis tools (e.g., currently foxglove doesn't support the
  concept of channel maps/aliases/whatever, so making node-agnostic
  plots is irritating).

Change-Id: I334881199ad6b300a97f96d4a427ae25e55fa15f
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/aos/configuration.h b/aos/configuration.h
index cb52d09..31603fe 100644
--- a/aos/configuration.h
+++ b/aos/configuration.h
@@ -91,6 +91,23 @@
                     channel->type()->string_view(), application_name, node);
 }
 
+// Returns a list of all the channel names that can be used to refer to the
+// specified channel on the given node/application. this allows a reverse-lookup
+// of any renames that happen.
+// Does not perform forwards-lookup first.
+std::set<std::string> GetChannelAliases(const Configuration *config,
+                                        std::string_view name,
+                                        std::string_view type,
+                                        const std::string_view application_name,
+                                        const Node *node);
+inline std::set<std::string> GetChannelAliases(
+    const Configuration *config, const Channel *channel,
+    const std::string_view application_name, const Node *node) {
+  return GetChannelAliases(config, channel->name()->string_view(),
+                           channel->type()->string_view(), application_name,
+                           node);
+}
+
 // Returns the channel index (or dies) of channel in the provided config.
 size_t ChannelIndex(const Configuration *config, const Channel *channel);