blob: 654028327f7f17f7d1fdade3438d0035d4cf6e6e [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
Austin Schuhdf5591e2015-12-19 22:36:50 -08006#include <string>
7
Brian Silverman431500a2013-10-28 19:50:15 -07008namespace aos {
9namespace network {
10
11// Retrieves the current team number based off of the network address.
12// This function will only do the complicated stuff once so it is cheap to call
13// repeatedly.
14uint16_t GetTeamNumber();
15
Brian Silvermande0a53a2014-02-10 22:27:44 -080016// Overrides the team number returned from GetTeamNumber(). Must be called
17// before GetTeamNumber() is ever called.
18// Overriding to team 0 won't work.
19// Intended only for tests.
Philipp Schraderf75a8bf2015-02-02 05:30:16 +000020// Guaranteed to be safe to call during static initialization time.
Brian Silvermande0a53a2014-02-10 22:27:44 -080021void OverrideTeamNumber(uint16_t team);
22
Austin Schuhdf5591e2015-12-19 22:36:50 -080023namespace internal {
24int ParseTeamNumber(const std::string &hostname, uint16_t *teamnumber);
25} // namespace internal
Brian Silverman431500a2013-10-28 19:50:15 -070026} // namespace network
27} // namespace aos
28
John Park33858a32018-09-28 23:05:48 -070029#endif // AOS_NETWORK_TEAM_NUMBER_H_