mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 09:08:00 +02:00
Dev/fix port size (#805)
* port datatype changing from int to uint16_t * throwing for -1 given for uint16_t ports
This commit is contained in:
@ -316,6 +316,7 @@ template <> defs::vetoAlgorithm StringTo(const std::string &s);
|
||||
template <> defs::gainMode StringTo(const std::string &s);
|
||||
template <> defs::polarity StringTo(const std::string &s);
|
||||
|
||||
template <> uint16_t StringTo(const std::string &s);
|
||||
template <> uint32_t StringTo(const std::string &s);
|
||||
template <> uint64_t StringTo(const std::string &s);
|
||||
template <> int StringTo(const std::string &s);
|
||||
|
@ -7,6 +7,7 @@ UDP socket class to receive data. The intended use is in the
|
||||
receiver listener loop. Should be used RAII style...
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h> //ssize_t
|
||||
namespace sls {
|
||||
|
||||
@ -15,8 +16,8 @@ class UdpRxSocket {
|
||||
int sockfd_{-1};
|
||||
|
||||
public:
|
||||
UdpRxSocket(int port, ssize_t packet_size, const char *hostname = nullptr,
|
||||
int kernel_buffer_size = 0);
|
||||
UdpRxSocket(uint16_t port, ssize_t packet_size,
|
||||
const char *hostname = nullptr, int kernel_buffer_size = 0);
|
||||
~UdpRxSocket();
|
||||
bool ReceivePacket(char *dst) noexcept;
|
||||
int getBufferSize() const;
|
||||
|
@ -103,7 +103,7 @@ class ZmqSocket {
|
||||
* @param hostname_or_ip hostname or ip of server
|
||||
* @param portnumber port number
|
||||
*/
|
||||
ZmqSocket(const char *const hostname_or_ip, const uint32_t portnumber);
|
||||
ZmqSocket(const char *const hostname_or_ip, const uint16_t portnumber);
|
||||
|
||||
/**
|
||||
* Constructor for a server
|
||||
@ -111,7 +111,7 @@ class ZmqSocket {
|
||||
* @param portnumber port number
|
||||
* @param ethip is the ip of the ethernet interface to stream zmq from
|
||||
*/
|
||||
ZmqSocket(const uint32_t portnumber, const char *ethip);
|
||||
ZmqSocket(const uint16_t portnumber, const char *ethip);
|
||||
|
||||
/** Returns high water mark for outbound messages */
|
||||
int GetSendHighWaterMark();
|
||||
@ -143,7 +143,7 @@ class ZmqSocket {
|
||||
* Returns Port Number
|
||||
* @returns Port Number
|
||||
*/
|
||||
uint32_t GetPortNumber() { return portno; }
|
||||
uint16_t GetPortNumber() { return portno; }
|
||||
|
||||
/**
|
||||
* Returns Server Address
|
||||
@ -251,7 +251,7 @@ class ZmqSocket {
|
||||
};
|
||||
|
||||
/** Port Number */
|
||||
uint32_t portno;
|
||||
uint16_t portno;
|
||||
|
||||
/** Socket descriptor */
|
||||
mySocketDescriptors sockfd;
|
||||
|
@ -64,8 +64,8 @@ class MacAddr {
|
||||
|
||||
struct UdpDestination {
|
||||
uint32_t entry{};
|
||||
uint32_t port{};
|
||||
uint32_t port2{};
|
||||
uint16_t port{};
|
||||
uint16_t port2{};
|
||||
IpAddr ip;
|
||||
IpAddr ip2;
|
||||
MacAddr mac;
|
||||
@ -88,5 +88,6 @@ IpAddr HostnameToIp(const char *hostname);
|
||||
std::string IpToInterfaceName(const std::string &ip);
|
||||
MacAddr InterfaceNameToMac(const std::string &inf);
|
||||
IpAddr InterfaceNameToIp(const std::string &ifn);
|
||||
|
||||
void validatePortNumber(uint16_t port);
|
||||
void validatePortRange(uint16_t startPort, int numPorts);
|
||||
} // namespace sls
|
||||
|
@ -30,8 +30,8 @@
|
||||
// C includes
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
//Need macros for C compatibility
|
||||
//NOLINTBEGIN(cppcoreguidelines-macro-usage)
|
||||
// Need macros for C compatibility
|
||||
// NOLINTBEGIN(cppcoreguidelines-macro-usage)
|
||||
#define BIT32_MASK 0xFFFFFFFF
|
||||
#define MAX_RX_DBIT 64
|
||||
|
||||
@ -80,7 +80,7 @@
|
||||
#define DEFAULT_STREAMING_TIMER_IN_MS 500
|
||||
|
||||
#define NUM_RX_THREAD_IDS 9
|
||||
//NOLINTEND(cppcoreguidelines-macro-usage)
|
||||
// NOLINTEND(cppcoreguidelines-macro-usage)
|
||||
#ifdef __cplusplus
|
||||
class slsDetectorDefs {
|
||||
public:
|
||||
@ -556,10 +556,10 @@ enum streamingInterface {
|
||||
int moduleIndex{0};
|
||||
char hostname[MAX_STR_LENGTH];
|
||||
int udpInterfaces{1};
|
||||
int udp_dstport{0};
|
||||
uint16_t udp_dstport{0};
|
||||
uint32_t udp_dstip{0U};
|
||||
uint64_t udp_dstmac{0LU};
|
||||
int udp_dstport2{0};
|
||||
uint16_t udp_dstport2{0};
|
||||
uint32_t udp_dstip2{0U};
|
||||
uint64_t udp_dstmac2{0LU};
|
||||
int64_t frames{0};
|
||||
|
@ -60,6 +60,6 @@ bool is_int(const std::string &s);
|
||||
bool replace_first(std::string *s, const std::string &substr,
|
||||
const std::string &repl);
|
||||
|
||||
std::pair<std::string, int> ParseHostPort(const std::string &s);
|
||||
std::pair<std::string, uint16_t> ParseHostPort(const std::string &s);
|
||||
|
||||
} // namespace sls
|
||||
|
@ -4,10 +4,10 @@
|
||||
#define RELEASE "developer"
|
||||
#define APILIB "developer 0x230224"
|
||||
#define APIRECEIVER "developer 0x230224"
|
||||
#define APICTB "developer 0x230829"
|
||||
#define APIGOTTHARD "developer 0x230829"
|
||||
#define APIGOTTHARD2 "developer 0x230829"
|
||||
#define APIJUNGFRAU "developer 0x230829"
|
||||
#define APIMYTHEN3 "developer 0x230829"
|
||||
#define APIMOENCH "developer 0x230829"
|
||||
#define APIEIGER "developer 0x230829"
|
||||
#define APICTB "developer 0x230922"
|
||||
#define APIGOTTHARD "developer 0x230922"
|
||||
#define APIGOTTHARD2 "developer 0x230922"
|
||||
#define APIJUNGFRAU "developer 0x230922"
|
||||
#define APIMYTHEN3 "developer 0x230922"
|
||||
#define APIMOENCH "developer 0x230922"
|
||||
#define APIEIGER "developer 0x230922"
|
||||
|
Reference in New Issue
Block a user