blob: 6eb1335da62f8543a99f0f02e588fd9afa70f64d [file] [log] [blame]
John Park33858a32018-09-28 23:05:48 -07001#ifndef AOS_NETWORK_TEAM_NUMBER_H_
2#define AOS_NETWORK_TEAM_NUMBER_H_
Brian Silverman431500a2013-10-28 19:50:15 -07003
4#include <stdint.h>
5
Brian Silverman3dfbfb12020-02-17 20:35:18 -08006#include <optional>
Austin Schuhdf5591e2015-12-19 22:36:50 -08007#include <string>
8
Brian Silverman431500a2013-10-28 19:50:15 -07009namespace aos {
10namespace network {
11
12// Retrieves the current team number based off of the network address.
13// This function will only do the complicated stuff once so it is cheap to call
14// repeatedly.
15uint16_t GetTeamNumber();
16
Austin Schuh288479d2019-12-18 19:47:52 -080017// Returns the current hostname.
18::std::string GetHostname();
19
Brian Silvermande0a53a2014-02-10 22:27:44 -080020// Overrides the team number returned from GetTeamNumber(). Must be called
21// before GetTeamNumber() is ever called.
22// Overriding to team 0 won't work.
23// Intended only for tests.
Philipp Schraderf75a8bf2015-02-02 05:30:16 +000024// Guaranteed to be safe to call during static initialization time.
Brian Silvermande0a53a2014-02-10 22:27:44 -080025void OverrideTeamNumber(uint16_t team);
26
Brian Silverman3dfbfb12020-02-17 20:35:18 -080027namespace team_number_internal {
28
29std::optional<uint16_t> ParseRoborioTeamNumber(const std::string &hostname);
30
31} // namespace team_number_internal
Brian Silverman431500a2013-10-28 19:50:15 -070032} // namespace network
33} // namespace aos
34
John Park33858a32018-09-28 23:05:48 -070035#endif // AOS_NETWORK_TEAM_NUMBER_H_