|
lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
|
Finds the MAC address of a host: first in /proc/net/arp, then by logging in to the device with telnet and reading the eth0 HWaddr from its ifconfig output. More...
#include <JungfrauDetectorId.hh>
Public Member Functions | |
| JungfrauIdLookup () | |
| Construct with an empty cache. | |
| ~JungfrauIdLookup () | |
| Does nothing; empty body. | |
| bool | has (const std::string &hostname) |
| Return true if a MAC address is known for the IP address of hostname. | |
| const std::string & | operator[] (const std::string &hostname) |
| Return the cached MAC address for the IP address of hostname; a missing entry is inserted as an empty string. | |
Static Public Member Functions | |
| static std::string | host_to_ip (const std::string &hostname) |
| Resolve hostname with gethostbyname() and return its first address as a dotted IPv4 string. | |
| static uint64_t | mac_to_hex (std::string mac) |
| Remove the colons from mac and parse the remaining text as a hexadecimal number with strtoul(). | |
Finds the MAC address of a host: first in /proc/net/arp, then by logging in to the device with telnet and reading the eth0 HWaddr from its ifconfig output.
| Drp::JungfrauIdLookup::JungfrauIdLookup | ( | ) |
Construct with an empty cache.
| Drp::JungfrauIdLookup::~JungfrauIdLookup | ( | ) |
Does nothing; empty body.
| bool Drp::JungfrauIdLookup::has | ( | const std::string & | hostname | ) |
Return true if a MAC address is known for the IP address of hostname.
If it is not cached, /proc/net/arp is reloaded, and if still missing the device is queried over telnet (port 23).
|
static |
Resolve hostname with gethostbyname() and return its first address as a dotted IPv4 string.
A failed lookup is not checked (null pointer dereference).
|
static |
Remove the colons from mac and parse the remaining text as a hexadecimal number with strtoul().
| const std::string & Drp::JungfrauIdLookup::operator[] | ( | const std::string & | hostname | ) |
Return the cached MAC address for the IP address of hostname; a missing entry is inserted as an empty string.