Raw Ethernet: working in tests

This commit is contained in:
2023-04-11 14:21:28 +00:00
parent 49cf0dfa01
commit c4e70ca038
10 changed files with 285 additions and 290 deletions
+5 -2
View File
@@ -791,10 +791,13 @@ uint32_t DiffractionExperiment::GetSrcIPv4Address(uint32_t data_stream, uint32_t
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Non existing data stream");
if (half_module >= 2 * GetModulesNum())
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Non existing module");
if ((data_stream+1) >= 256/32)
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds,
"Cannot handle more than 7 data stream in the current model");
if (half_module >= 32)
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds,
"Cannot handle more than 16 modules / data stream in the current model");
uint32_t host = ((data_stream * 32) | half_module) << 24;
uint32_t host = (((data_stream+1) * 32) | half_module) << 24;
return internal.ipv4_subnet() | host;
}
@@ -802,7 +805,7 @@ uint32_t DiffractionExperiment::GetDestIPv4Address(uint32_t data_stream) const {
if (data_stream >= GetDataStreamsNum())
throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, "Non existing data stream");
uint32_t host = (0xFFlu - data_stream) << 24;
uint32_t host = (data_stream + 1) << 24;
return internal.ipv4_subnet() | host;
}