Skip to content
Snippets Groups Projects
Commit ba0a45ea authored by Valerio Pastore's avatar Valerio Pastore
Browse files

tail management fix

parent 07191051
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,7 @@ uint AstriHornGeneric::getHeaderSize() const {
uint AstriHornGeneric::getPayloadSize() const {
auto val = this->operator [](5);
if(val.has_value())
return val.value()-1;
return val.value()+1;
else{
std::cerr << "Error: cannot access index 5 to get payload size." << std::endl;
exit(EXIT_FAILURE);
......@@ -25,7 +25,7 @@ uint AstriHornGeneric::getPayloadSize() const {
}
uint AstriHornGeneric::getTailSize() const {
return 2;
return 0;
}
bool AstriHornGeneric::isRecognizedHeader() const {
......@@ -49,8 +49,8 @@ bool AstriHornGeneric::isRecognizedHeader(std::vector<uint8_t> buff) const {
size_t type = buff[1] >> 4;
size_t subtype = buff[1] & 0x0F;
ssize_t length = (buff[4] << 8) + buff[5] -1;
ssize_t totLength = this->getHeaderSize() + length + this->getTailSize();
ssize_t length = (buff[4] << 8) + buff[5];
ssize_t totLength = this->getHeaderSize() + length+1 + this->getTailSize();
std::tuple<size_t, size_t, size_t> target = std::make_tuple(type, subtype,totLength);
auto it = std::find(AstriHorn::recognizedPackets.begin(),
AstriHorn::recognizedPackets.end(), target);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment