mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-04 09:00:41 +02:00
server side done
This commit is contained in:
parent
22c820771a
commit
1e309b67ef
@ -1492,6 +1492,8 @@ enum timingMode getTiming() {
|
||||
|
||||
/* configure mac */
|
||||
|
||||
int getNumberofUDPInterfaces() { return 1; }
|
||||
|
||||
void calcChecksum(udp_header *udp) {
|
||||
int count = IP_HEADER_SIZE;
|
||||
long int sum = 0;
|
||||
|
@ -1500,6 +1500,7 @@ enum timingMode getTiming() {
|
||||
}
|
||||
|
||||
/* configure mac */
|
||||
int getNumberofUDPInterfaces() { return 2; }
|
||||
|
||||
int getNumberofDestinations(int *retval) {
|
||||
#ifdef VIRTUAL
|
||||
|
@ -1299,6 +1299,8 @@ int getExtSignal(int signalIndex) {
|
||||
|
||||
/* configure mac */
|
||||
|
||||
int getNumberofUDPInterfaces() { return 1; }
|
||||
|
||||
void calcChecksum(mac_conf *mac, int sourceip, int destip) {
|
||||
mac->ip.ip_ver = 0x4;
|
||||
mac->ip.ip_ihl = 0x5;
|
||||
|
@ -1157,6 +1157,8 @@ enum timingMode getTiming() {
|
||||
|
||||
/* configure mac */
|
||||
|
||||
int getNumberofUDPInterfaces() { return 1; }
|
||||
|
||||
void calcChecksum(udp_header *udp) {
|
||||
int count = IP_HEADER_SIZE;
|
||||
long int sum = 0;
|
||||
|
@ -1719,6 +1719,8 @@ int getExtSignal(int signalIndex) {
|
||||
}
|
||||
}
|
||||
|
||||
int getNumberofUDPInterfaces() { return 1; }
|
||||
|
||||
int configureMAC() {
|
||||
|
||||
uint32_t srcip = udpDetails[0].srcip;
|
||||
|
@ -387,8 +387,8 @@ void calcChecksum(mac_conf *mac, int sourceip, int destip);
|
||||
#endif
|
||||
#if defined(JUNGFRAUD) || defined(GOTTHARD2D)
|
||||
void setNumberofUDPInterfaces(int val);
|
||||
int getNumberofUDPInterfaces();
|
||||
#endif
|
||||
int getNumberofUDPInterfaces();
|
||||
|
||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||
int getNumberofDestinations(int *retval);
|
||||
|
@ -4725,19 +4725,23 @@ void calculate_and_set_position() {
|
||||
LOG(logERROR, (mess));
|
||||
return;
|
||||
}
|
||||
int maxy = maxydet;
|
||||
// position does not change for gotthard2 (2 interfaces)
|
||||
#ifdef JUNGFRAUD
|
||||
maxy *= getNumberofUDPInterfaces();
|
||||
|
||||
// calculating new position
|
||||
int numInterfaces = getNumberofUDPInterfaces();
|
||||
int modulePorts[2] = {1, 1};
|
||||
// position does change for eiger and jungfrau (2 interfaces)
|
||||
#if defined(EIGERD)
|
||||
modulePorts[1] = numInterfaces; // horz
|
||||
#elif defined(JUNGFRAUD)
|
||||
modulePorts[0] = numInterfaces; // vert
|
||||
#endif
|
||||
int maxy = maxydet * modulePorts[0];
|
||||
int pos[2] = {0, 0};
|
||||
// row
|
||||
pos[0] = (detectorId % maxy);
|
||||
// col for horiz. udp ports
|
||||
pos[1] = (detectorId / maxy);
|
||||
#ifdef EIGERD
|
||||
pos[1] *= 2;
|
||||
#endif
|
||||
pos[1] = (detectorId / maxy) * modulePorts[1];
|
||||
|
||||
LOG(logDEBUG, ("Setting Positions (%d,%d)\n", pos[0], pos[1]));
|
||||
if (setDetectorPosition(pos) == FAIL) {
|
||||
ret = FAIL;
|
||||
@ -4854,7 +4858,6 @@ int is_udp_configured() {
|
||||
LOG(logWARNING, ("%s", configureMessage));
|
||||
return FAIL;
|
||||
}
|
||||
#if defined(JUNGFRAUD) || defined(GOTTHARD2D)
|
||||
if (getNumberofUDPInterfaces() == 2) {
|
||||
if (udpDetails[i].srcip2 == 0) {
|
||||
sprintf(configureMessage,
|
||||
@ -4881,7 +4884,6 @@ int is_udp_configured() {
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
@ -5320,7 +5322,16 @@ int set_num_interfaces(int file_des) {
|
||||
LOG(logINFO, ("Setting number of interfaces: %d\n", arg));
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARD2D)
|
||||
functionNotImplemented();
|
||||
// fixed number of udp interfaces
|
||||
int num_interfaces = getNumberofUDPInterfaces();
|
||||
if (arg != num_interfaces) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Could not set number of interfaces. Invalid value: %d. Must "
|
||||
"be %d\n",
|
||||
arg, num_interfaces);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
@ -5380,12 +5391,9 @@ int get_num_interfaces(int file_des) {
|
||||
int retval = -1;
|
||||
LOG(logDEBUG1, ("Getting number of udp interfaces\n"));
|
||||
|
||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARD2D)
|
||||
retval = 1;
|
||||
#else
|
||||
// get only
|
||||
retval = getNumberofUDPInterfaces();
|
||||
#endif
|
||||
|
||||
LOG(logDEBUG1, ("Number of udp interfaces retval: %u\n", retval));
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
@ -6883,11 +6891,7 @@ int get_receiver_parameters(int file_des) {
|
||||
|
||||
// sending real detector parameters
|
||||
// udp interfaces
|
||||
#if defined(JUNGFRAUD) || defined(GOTTHARD2D)
|
||||
i32 = getNumberofUDPInterfaces();
|
||||
#else
|
||||
i32 = 1;
|
||||
#endif
|
||||
n += sendData(file_des, &i32, sizeof(i32), INT32);
|
||||
if (n < 0)
|
||||
return printSocketReadError();
|
||||
@ -9025,10 +9029,7 @@ int set_dest_udp_list(int file_des) {
|
||||
}
|
||||
|
||||
// if still 0, set defaults
|
||||
int twoInterfaces = 0;
|
||||
#if defined(JUNGFRAUD) || defined(GOTTHARD2D)
|
||||
twoInterfaces = getNumberofUDPInterfaces() == 2 ? 1 : 0;
|
||||
#endif
|
||||
int twoInterfaces = getNumberofUDPInterfaces() == 2 ? 1 : 0;
|
||||
udpDetails[entry].srcport = DEFAULT_UDP_SRC_PORTNO;
|
||||
if (udpDetails[entry].dstport == 0) {
|
||||
udpDetails[entry].dstport =
|
||||
|
Loading…
x
Reference in New Issue
Block a user