blob: 697c9b1d0876e15bf4451ae14ae9cf2b9afc2f3c [file] [log] [blame]
Brian Silverman431500a2013-10-28 19:50:15 -07001#include "aos/common/network/team_number.h"
2
3#include <netinet/in.h>
4
5#include "aos/common/once.h"
6#include "aos/atom_code/configuration.h"
7
8namespace aos {
9namespace network {
10namespace {
11
12uint16_t *DoGetTeamNumber() {
13 const in_addr &address = configuration::GetOwnIPAddress();
14 static uint16_t r = address.s_addr >> 8;
15 return &r;
16}
17
18} // namespace
19
20uint16_t GetTeamNumber() {
21 static Once<uint16_t> once(DoGetTeamNumber);
22 return *once.Get();
23}
24
25} // namespace network
26} // namespace aos