mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
fixed conversion for IpAddr
This commit is contained in:
@ -343,8 +343,8 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
|||||||
(detId * ((shm()->myDetectorType == EIGER) ? 2 : 1));
|
(detId * ((shm()->myDetectorType == EIGER) ? 2 : 1));
|
||||||
shm()->rxUpstream = false;
|
shm()->rxUpstream = false;
|
||||||
shm()->rxReadFreq = 1;
|
shm()->rxReadFreq = 1;
|
||||||
shm()->zmqip = 0U;
|
shm()->zmqip = IpAddr{};
|
||||||
shm()->rxZmqip = 0U;
|
shm()->rxZmqip = IpAddr{};
|
||||||
shm()->gappixels = 0U;
|
shm()->gappixels = 0U;
|
||||||
memset(shm()->rxAdditionalJsonHeader, 0, MAX_STR_LENGTH);
|
memset(shm()->rxAdditionalJsonHeader, 0, MAX_STR_LENGTH);
|
||||||
shm()->rxFrameDiscardMode = NO_DISCARD;
|
shm()->rxFrameDiscardMode = NO_DISCARD;
|
||||||
@ -690,7 +690,7 @@ bool slsDetector::lockServer(int lock) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sls::IpAddr slsDetector::getLastClientIP() {
|
sls::IpAddr slsDetector::getLastClientIP() {
|
||||||
sls::IpAddr retval = 0U;
|
sls::IpAddr retval;
|
||||||
FILE_LOG(logDEBUG1) << "Getting last client ip to detector server";
|
FILE_LOG(logDEBUG1) << "Getting last client ip to detector server";
|
||||||
sendToDetector(F_GET_LAST_CLIENT_IP, nullptr, retval);
|
sendToDetector(F_GET_LAST_CLIENT_IP, nullptr, retval);
|
||||||
FILE_LOG(logDEBUG1) << "Last client IP to detector: " << retval;
|
FILE_LOG(logDEBUG1) << "Last client IP to detector: " << retval;
|
||||||
@ -1908,7 +1908,7 @@ void slsDetector::updateRxDestinationUDPIP() {
|
|||||||
auto ip = getDestinationUDPIP();
|
auto ip = getDestinationUDPIP();
|
||||||
if (ip == 0) {
|
if (ip == 0) {
|
||||||
// Hostname could be ip try to decode otherwise look up the hostname
|
// Hostname could be ip try to decode otherwise look up the hostname
|
||||||
ip = shm()->rxHostname;
|
ip = sls::IpAddr{shm()->rxHostname};
|
||||||
if (ip == 0) {
|
if (ip == 0) {
|
||||||
ip = HostnameToIp(shm()->rxHostname);
|
ip = HostnameToIp(shm()->rxHostname);
|
||||||
}
|
}
|
||||||
@ -1944,7 +1944,7 @@ void slsDetector::updateRxDestinationUDPIP2() {
|
|||||||
auto ip = getDestinationUDPIP2();
|
auto ip = getDestinationUDPIP2();
|
||||||
if (ip == 0) {
|
if (ip == 0) {
|
||||||
// Hostname could be ip try to decode otherwise look up the hostname
|
// Hostname could be ip try to decode otherwise look up the hostname
|
||||||
ip = shm()->rxHostname;
|
ip = sls::IpAddr{shm()->rxHostname};
|
||||||
if (ip == 0) {
|
if (ip == 0) {
|
||||||
ip = HostnameToIp(shm()->rxHostname);
|
ip = HostnameToIp(shm()->rxHostname);
|
||||||
}
|
}
|
||||||
@ -2116,7 +2116,7 @@ void slsDetector::updateReceiverStreamingIP() {
|
|||||||
auto ip = getReceiverStreamingIP();
|
auto ip = getReceiverStreamingIP();
|
||||||
if (ip == 0) {
|
if (ip == 0) {
|
||||||
// Hostname could be ip try to decode otherwise look up the hostname
|
// Hostname could be ip try to decode otherwise look up the hostname
|
||||||
ip = shm()->rxHostname;
|
ip = sls::IpAddr{shm()->rxHostname};
|
||||||
if (ip == 0) {
|
if (ip == 0) {
|
||||||
ip = HostnameToIp(shm()->rxHostname);
|
ip = HostnameToIp(shm()->rxHostname);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ int ClientInterface::send_update(Interface &socket) {
|
|||||||
int64_t i64 = -1;
|
int64_t i64 = -1;
|
||||||
char cstring[MAX_STR_LENGTH]{};
|
char cstring[MAX_STR_LENGTH]{};
|
||||||
|
|
||||||
sls::IpAddr ip = 0u;
|
sls::IpAddr ip;
|
||||||
ip = server->getLastClient();
|
ip = server->getLastClient();
|
||||||
n += socket.Send(&ip, sizeof(ip));
|
n += socket.Send(&ip, sizeof(ip));
|
||||||
|
|
||||||
@ -920,7 +920,7 @@ int ClientInterface::set_streaming_port(Interface &socket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ClientInterface::set_streaming_source_ip(Interface &socket) {
|
int ClientInterface::set_streaming_source_ip(Interface &socket) {
|
||||||
sls::IpAddr arg = 0u;
|
sls::IpAddr arg;
|
||||||
socket.Receive(arg);
|
socket.Receive(arg);
|
||||||
verifyIdle(socket);
|
verifyIdle(socket);
|
||||||
FILE_LOG(logDEBUG1) << "Setting streaming source ip:" << arg;
|
FILE_LOG(logDEBUG1) << "Setting streaming source ip:" << arg;
|
||||||
|
@ -90,7 +90,7 @@ void Implementation::InitializeMembers() {
|
|||||||
streamingFrequency = 1;
|
streamingFrequency = 1;
|
||||||
streamingTimerInMs = DEFAULT_STREAMING_TIMER_IN_MS;
|
streamingTimerInMs = DEFAULT_STREAMING_TIMER_IN_MS;
|
||||||
streamingPort = 0;
|
streamingPort = 0;
|
||||||
streamingSrcIP = 0u;
|
streamingSrcIP = sls::IpAddr{};
|
||||||
additionalJsonHeader = "";
|
additionalJsonHeader = "";
|
||||||
|
|
||||||
// detector parameters
|
// detector parameters
|
||||||
|
@ -12,8 +12,8 @@ class IpAddr {
|
|||||||
public:
|
public:
|
||||||
constexpr IpAddr() noexcept = default;
|
constexpr IpAddr() noexcept = default;
|
||||||
explicit constexpr IpAddr(uint32_t address) noexcept : addr_{address} {}
|
explicit constexpr IpAddr(uint32_t address) noexcept : addr_{address} {}
|
||||||
IpAddr(const std::string &address);
|
explicit IpAddr(const std::string &address);
|
||||||
IpAddr(const char *address);
|
explicit IpAddr(const char *address);
|
||||||
std::string str() const;
|
std::string str() const;
|
||||||
std::string hex() const;
|
std::string hex() const;
|
||||||
std::array<char, 16u> arr() const;
|
std::array<char, 16u> arr() const;
|
||||||
|
@ -48,7 +48,7 @@ ServerInterface2 ServerSocket::accept() {
|
|||||||
}
|
}
|
||||||
char tc[INET_ADDRSTRLEN]{};
|
char tc[INET_ADDRSTRLEN]{};
|
||||||
inet_ntop(AF_INET, &(clientAddr.sin_addr), tc, INET_ADDRSTRLEN);
|
inet_ntop(AF_INET, &(clientAddr.sin_addr), tc, INET_ADDRSTRLEN);
|
||||||
thisClient = tc;
|
thisClient = IpAddr{tc};
|
||||||
return ServerInterface2(newSocket);
|
return ServerInterface2(newSocket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user