mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
binaries in
This commit is contained in:
@ -55,9 +55,6 @@ std::ostream &operator<<(std::ostream &os,
|
||||
std::string ToString(const slsDetectorDefs::currentSrcParameters &r);
|
||||
std::ostream &operator<<(std::ostream &os,
|
||||
const slsDetectorDefs::currentSrcParameters &r);
|
||||
std::string ToString(const slsDetectorDefs::udpDestination &r);
|
||||
std::ostream &operator<<(std::ostream &os,
|
||||
const slsDetectorDefs::udpDestination &r);
|
||||
const std::string &ToString(const std::string &s);
|
||||
|
||||
/** Convert std::chrono::duration with specified output unit */
|
||||
|
@ -30,7 +30,7 @@ class IpAddr {
|
||||
return addr_ != other;
|
||||
}
|
||||
constexpr uint32_t uint32() const noexcept { return addr_; }
|
||||
};
|
||||
} __attribute__((packed));
|
||||
|
||||
class MacAddr {
|
||||
private:
|
||||
@ -57,13 +57,33 @@ class MacAddr {
|
||||
return addr_ != other;
|
||||
}
|
||||
constexpr uint64_t uint64() const noexcept { return addr_; }
|
||||
};
|
||||
} __attribute__((packed));
|
||||
|
||||
struct UdpDestination {
|
||||
uint32_t entry{};
|
||||
uint32_t port{};
|
||||
uint32_t port2{};
|
||||
IpAddr ip;
|
||||
IpAddr ip2;
|
||||
MacAddr mac;
|
||||
MacAddr mac2;
|
||||
std::string str() const;
|
||||
|
||||
constexpr bool operator==(const UdpDestination &other) const {
|
||||
return ((entry == other.entry) && (port == other.port) &&
|
||||
(port2 == other.port2) && (ip== other.ip) &&
|
||||
(ip2 == other.ip2) && (mac == other.mac) &&
|
||||
(mac2 == other.mac2));
|
||||
}
|
||||
} __attribute__((packed));
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const IpAddr &addr);
|
||||
std::ostream &operator<<(std::ostream &out, const MacAddr &addr);
|
||||
std::ostream &operator<<(std::ostream &out, const UdpDestination &dest);
|
||||
|
||||
IpAddr HostnameToIp(const char *hostname);
|
||||
std::string IpToInterfaceName(const std::string &ip);
|
||||
MacAddr InterfaceNameToMac(const std::string &inf);
|
||||
IpAddr InterfaceNameToIp(const std::string &ifn);
|
||||
std::ostream &operator<<(std::ostream &out, const IpAddr &addr);
|
||||
std::ostream &operator<<(std::ostream &out, const MacAddr &addr);
|
||||
|
||||
} // namespace sls
|
||||
|
@ -494,28 +494,6 @@ typedef struct {
|
||||
}
|
||||
} __attribute__((packed));
|
||||
|
||||
struct udpDestination {
|
||||
uint32_t entry_{};
|
||||
uint32_t port_{};
|
||||
uint32_t port2_{};
|
||||
uint32_t ip_{};
|
||||
uint32_t ip2_{};
|
||||
uint64_t mac_{};
|
||||
uint64_t mac2_{};
|
||||
udpDestination() {}
|
||||
udpDestination(uint32_t entry, uint32_t port = 0, uint32_t ip = 0, uint64_t mac = 0,
|
||||
uint32_t port2 = 0, uint32_t ip2 = 0, uint64_t mac2 = 0)
|
||||
: entry_(entry), port_(port), port2_(port2), ip_(ip), ip2_(ip2),
|
||||
mac_(mac), mac2_(mac2) {}
|
||||
|
||||
bool operator==(const udpDestination &other) const {
|
||||
return ((entry_ == other.entry_) && (port_ == other.port_) &&
|
||||
(port2_ == other.port2_) && (ip_ == other.ip_) &&
|
||||
(ip2_ == other.ip2_) && (mac_ == other.mac_) &&
|
||||
(mac2_ == other.mac2_));
|
||||
}
|
||||
} __attribute__((packed));
|
||||
|
||||
/**
|
||||
* structure to udpate receiver
|
||||
*/
|
||||
|
@ -1,15 +1,13 @@
|
||||
/** API versions */
|
||||
#define GITBRANCH "roundrobin"
|
||||
|
||||
|
||||
|
||||
#define APILIB 0x210831
|
||||
#define APIRECEIVER 0x210831
|
||||
#define APIGUI 0x210819
|
||||
#define APICTB 0x210831
|
||||
#define APIGOTTHARD 0x210831
|
||||
#define APIGOTTHARD2 0x210831
|
||||
#define APIMYTHEN3 0x210831
|
||||
#define APIMOENCH 0x210831
|
||||
#define APIEIGER 0x210831
|
||||
#define APIJUNGFRAU 0x210831
|
||||
|
||||
#define APICTB 0x210907
|
||||
#define APIGOTTHARD 0x210907
|
||||
#define APIGOTTHARD2 0x210907
|
||||
#define APIJUNGFRAU 0x210907
|
||||
#define APIMYTHEN3 0x210907
|
||||
#define APIMOENCH 0x210907
|
||||
#define APIEIGER 0x210907
|
||||
|
@ -148,31 +148,6 @@ std::ostream &operator<<(std::ostream &os,
|
||||
return os << ToString(r);
|
||||
}
|
||||
|
||||
std::string ToString(const slsDetectorDefs::udpDestination &r) {
|
||||
std::ostringstream oss;
|
||||
oss << '[' << std::endl
|
||||
<< "entry " << r.entry_ << std::endl
|
||||
<< "ip " << IpAddr(r.ip_) << std::endl
|
||||
<< "mac " << MacAddr(r.mac_) << std::endl
|
||||
<< "port " << r.port_ << std::endl;
|
||||
if (r.port2_ != 0) {
|
||||
oss << "port2 " << r.port2_ << std::endl;
|
||||
}
|
||||
if (r.ip2_ != 0) {
|
||||
oss << "ip2 " << IpAddr(r.ip2_) << std::endl;
|
||||
}
|
||||
if (r.mac2_ != 0) {
|
||||
oss << "mac2 " << MacAddr(r.mac2_) << std::endl;
|
||||
}
|
||||
oss << ']';
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os,
|
||||
const slsDetectorDefs::udpDestination &r) {
|
||||
return os << ToString(r);
|
||||
}
|
||||
|
||||
std::string ToString(const defs::runStatus s) {
|
||||
switch (s) {
|
||||
case defs::ERROR:
|
||||
|
@ -69,6 +69,26 @@ std::string MacAddr::str() const { return to_hex(':'); }
|
||||
|
||||
std::string MacAddr::hex() const { return to_hex(); }
|
||||
|
||||
std::string UdpDestination::str() const {
|
||||
std::ostringstream oss;
|
||||
oss << '[' << std::endl
|
||||
<< "entry " << entry << std::endl
|
||||
<< "ip " << ip << std::endl
|
||||
<< "mac " << mac << std::endl
|
||||
<< "port " << port << std::endl;
|
||||
if (port2 != 0) {
|
||||
oss << "port2 " << port2 << std::endl;
|
||||
}
|
||||
if (ip2 != 0) {
|
||||
oss << "ip2 " << ip2 << std::endl;
|
||||
}
|
||||
if (mac2 != 0) {
|
||||
oss << "mac2 " << mac2 << std::endl;
|
||||
}
|
||||
oss << ']';
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const IpAddr &addr) {
|
||||
return out << addr.str();
|
||||
}
|
||||
@ -77,6 +97,10 @@ std::ostream &operator<<(std::ostream &out, const MacAddr &addr) {
|
||||
return out << addr.str();
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const UdpDestination &dest) {
|
||||
return out << dest.str();
|
||||
}
|
||||
|
||||
IpAddr HostnameToIp(const char *hostname) {
|
||||
addrinfo hints;
|
||||
addrinfo *result = nullptr;
|
||||
|
@ -9,7 +9,7 @@ TEST_CASE("Get size of empty file") {
|
||||
char fname[] = "temfile_XXXXXX";
|
||||
std::ifstream ifs(fname);
|
||||
auto size = sls::getFileSize(ifs);
|
||||
REQUIRE(size == 0);
|
||||
REQUIRE(size <= 0); // -1 or zero
|
||||
}
|
||||
|
||||
TEST_CASE("Get size of file with data") {
|
||||
|
@ -112,4 +112,19 @@ TEST_CASE("Copy construct a MacAddr") {
|
||||
CHECK(addr == addr2);
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("udp dst struct basic properties"){
|
||||
static_assert(sizeof(UdpDestination) == 36);
|
||||
UdpDestination dst{};
|
||||
REQUIRE(dst.entry == 0);
|
||||
REQUIRE(dst.port == 0);
|
||||
REQUIRE(dst.port2 == 0);
|
||||
REQUIRE(dst.ip == 0);
|
||||
REQUIRE(dst.ip2 == 0);
|
||||
REQUIRE(dst.mac == 0);
|
||||
REQUIRE(dst.mac2 == 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// TODO!(Erik) Look up a real hostname and verify the IP
|
||||
|
Reference in New Issue
Block a user