aboutsummaryrefslogtreecommitdiff
path: root/bbot/agent/agent.hxx
blob: ba3719e6da59b5a98af70cca8686c09f85a61d31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// file      : bbot/agent/agent.hxx -*- C++ -*-
// license   : TBC; see accompanying LICENSE file

#ifndef BBOT_AGENT_AGENT_HXX
#define BBOT_AGENT_AGENT_HXX

#include <sys/types.h> // uid_t

#include <bbot/types.hxx>
#include <bbot/utility.hxx>

#include <bbot/agent/agent-options.hxx>

namespace bbot
{
  extern agent_options ops;

  extern const string bs_prot; // Bootstrap protocol version.

  extern string           tc_name; // Toolchain name.
  extern uint16_t         tc_num;  // Toolchain number.
  extern standard_version tc_ver;  // Toolchain version.
  extern string           tc_id;   // Toolchain id.

  extern uint16_t inst; // Instance number.

  extern string hname; // Our host name.
  extern string hip;   // Our IP address.
  extern uid_t  uid;   // Our effective user id.
  extern string uname; // Our effective user name.

  extern uint16_t offset; // Agent offset.

  // Random number generator (currently not MT-safe and limited to RAND_MAX).
  //
  size_t
  genrand ();

  template <typename T>
  inline T
  genrand () {return static_cast<T> (genrand ());}

  // Return the IPv4 address of an interface.
  //
  string
  iface_addr (const string&);
}

#endif // BBOT_AGENT_AGENT_HXX