29 m_geonetFlag(geonetFlag),
58 printf(
"Geonet constructor UNLOCKED\n");
63 printf(
"RawSocketSend can't be initialized\n");
71 QThread* threadReceive =
new QThread;
72 m_RP->moveToThread(threadReceive);
73 QObject::connect(threadReceive, SIGNAL(started()),
m_RP, SLOT(receive()));
74 threadReceive->start();
96 gen2ut =
new QUdpSocket(
this);
112 m_tcpSocket->setSocketOption(QAbstractSocket::KeepAliveOption, 1);
120 QObject::connect(
m_sslSocket, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(
socketError(QAbstractSocket::SocketError)));
132 for(
const auto &error : errors)
133 qDebug() <<
"SSL Error" << i++ << error.errorString();
135 if(
m_tcpSocket->state() != QAbstractSocket::ConnectedState)
137 qDebug() <<
"Deactivation of hybridization due to error(s)";
144 qDebug() <<
"Socket error" <<
m_tcpSocket->errorString();
163 QObject::connect(
m_tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(
socketError(QAbstractSocket::SocketError)));
169 if(
m_tcpSocket->state() == QAbstractSocket::ConnectedState)
170 qDebug() <<
"Connection success" ;
172 qDebug() <<
"Connection failed" <<
m_tcpSocket->errorString();
197 if(i.value().isNeighbour() != 0 && *(i.value().isNeighbour()))
201 double ratio = nbNeighbour/aireCommunication;
205 else if(ratio < 0.05)
391 struct sockaddr_ll socket_address;
393 struct ether_header *eh = (
struct ether_header *) sendbuf;
394 char ifName[IFNAMSIZ] = {
'\0'};
396 eh = (
struct ether_header *) sendbuf;
398 memset(&socket_address, 0,
sizeof socket_address);
404 if((rawSocket = socket(AF_PACKET, SOCK_RAW, htons(0x8947))) == -1)
406 qDebug() <<
"socket" << strerror(errno);
411 memset(&if_idx, 0,
sizeof(
struct ifreq));
412 strncpy(if_idx.ifr_name, ifName, IFNAMSIZ - 1);
413 if(ioctl(rawSocket, SIOCGIFINDEX, &if_idx) < 0)
415 qDebug() <<
"SIOCGIFINDEX geonet" << strerror(errno) << ifName;
420 socket_address.sll_ifindex = if_idx.ifr_ifindex;
423 socket_address.sll_halen = ETH_ALEN;
425 socket_address.sll_family = AF_INET;
428 eh->ether_type = htons(0x8947);
449 QDataStream ds(&resUt, QIODevice::WriteOnly);
451 ds << (quint16)packetLen;
452 ds.writeRawData((
char*)packetFull, packetLen);
469 for(
int i = 0 ; i < 6 ; i++)
472 int ret =
send(lsRequestData,
true, bh);
500 QDataStream dsPayload(&payload, QIODevice::WriteOnly);
505 unsigned char btp[4] = {0x00};
508 dsPayload.writeRawData((
const char*)btp, 4);
509 dsPayload.writeRawData(gnDR.
payload.data(), gnDR.
payload.length());
587 QByteArray beaconData;
588 QDataStream ds(&beaconData, QIODevice::WriteOnly);
590 ds.writeRawData(ch.toHex().data(), ch.toHex().length());
591 ds.writeRawData(beacon.toHex().data(), beacon.toHex().length());
593 for(
int i = 0 ; i < 6 ; i++)
596 int ret =
send(beaconData,
true, bh);
600 printf(
"\n--> Beacon successfuly send!\n");
603 printf(
"\n--> Beacon sending failure. Error code : %s",
geonetErrors[ret].toStdString().c_str());
637 QByteArray lsRequestData;
638 QDataStream ds(&lsRequestData, QIODevice::WriteOnly);
640 ds.writeRawData(ch.toHex().data(), ch.toHex().length());
641 ds.writeRawData(lsR.toHex().data(), lsR.toHex().length());
650 (*m_locationTable)[destination.
toHex()].setLsPending(
true);
651 (*m_locationTable)[destination.
toHex()].setNeverReceived(
true);
653 (*m_locationTable)[destination.
toHex()].setLastTimestamp(0);
724 inArea =
f(x, y, gac.destinationArea().distanceA(), gac.destinationArea().distanceB(), shape);
727 x*cos(gac.destinationArea().angle())-y*sin(gac.destinationArea().angle()),
728 x*sin(gac.destinationArea().angle())+y*cos(gac.destinationArea().angle()),
729 gac.destinationArea().distanceA(), gac.destinationArea().distanceB(), shape);
733 if(inArea<0 && m_paramConf->itsGnGeoAreaLineForwarding())
751 if(res.isInteger() && res.integer() == 0)
753 else if(res.isInteger() && res.integer() == -1)
777 if(res.isInteger() && res.integer() == 0)
779 else if(res.isInteger() && res.integer() == -1)
791 QDataStream ds(&gacData, QIODevice::WriteOnly);
793 ds.writeRawData(ch.
toHex().data(), ch.
toHex().length());
794 ds.writeRawData(gac.toHex().data(), gac.toHex().length());
799 for(
int i = 0 ; i < 6 ; i++)
804 int ret =
send(gacData,
true, bh);
823 true << 15 :
false << 15;
856 if((gbc.destinationArea().distanceA() * gbc.destinationArea().distanceA() * M_PI) >
862 if((gbc.destinationArea().distanceA() * gbc.destinationArea().distanceB()) >
868 if((gbc.destinationArea().distanceA() * gbc.destinationArea().distanceB() * M_PI) >
905 QDataStream ds(&gbcData, QIODevice::WriteOnly);
907 ds.writeRawData(ch.
toHex().data(), ch.
toHex().length());
908 ds.writeRawData(gbc.toHex().data(), gbc.toHex().length());
913 for(
int i = 0 ; i < 6 ; i++)
918 int ret =
send(gbcData,
true, bh);
1000 QDataStream ds(&gucData, QIODevice::WriteOnly);
1002 ds.writeRawData(ch.
toHex().data(), ch.
toHex().length());
1003 ds.writeRawData(guc.toHex().data(), guc.toHex().length());
1009 for(
int i = 0 ; i < 6 ; i++){
1011 printf(
"PARAMNETWORK [%d] -> %d\n", i,
m_paramNetwork->
eh.ether_dhost[i]);}
1015 int ret =
send(gucData,
true, bh);
1045 bool noNeighbour =
true;
1050 noNeighbour =
false;
1071 QDataStream ds(&shbData, QIODevice::WriteOnly);
1073 ds.writeRawData(ch.toHex().data(), ch.toHex().length());
1074 ds.writeRawData(shb.toHex().data(), shb.toHex().length());
1078 for(
int i = 0 ; i < 6 ; i++)
1081 int ret =
send(shbData,
true, bh);
1109 bool noNeighbour =
true;
1114 noNeighbour =
false;
1135 QDataStream ds(&tsbData, QIODevice::WriteOnly);
1137 ds.writeRawData(ch.toHex().data(), ch.toHex().length());
1138 ds.writeRawData(tsb.toHex().data(), tsb.toHex().length());
1142 for(
int i = 0 ; i < 6 ; i++)
1145 int ret =
send(tsbData,
true, bh);
1160 size_t tx_len =
sizeof(
struct ether_header);
1167 payload = bh.
toHex() + payloadToSend;
1170 for(
int i = 0 ; i < 6 ; i++)
1174 for(
int i = 0 ; i < payload.length(); i++)
1182 qDebug() <<
"sendto" << strerror(errno);
1191 qDebug() <<
"hybridSend" <<
m_tcpSocket->errorString();
1195 qInfo() <<
"HybridSend success";
1199 QTimer::singleShot(0,
this, SLOT(
lpvUpdate()));
1210 if(
m_tcpSocket->state() == QAbstractSocket::ConnectedState)
1212 p =
m_tcpSocket->write(payload.data(), payload.length());
1229 if(
m_tcpSocket->state() == QAbstractSocket::ConnectedState)
1231 p =
m_tcpSocket->write(payload.data(), payload.length());
1239 qDebug() << p <<
"bytes sent";
1250 uchar* packet = (uchar*) rawPacket.data();
1257 printf(
"\n--> Successfuly received and treated a packet.\n");
1259 printf(
"\n--> Failure while treating a packet. Error code : %s",
geonetErrors[res].toStdString().c_str());
1266 qDebug() <<
"BH processing";
1269 bool *verifySecuredPacket = 0;
1270 QByteArray securedPacket;
1289 verifySecuredPacket = (
bool*)calloc(1,
sizeof *verifySecuredPacket);
1290 securedPacket =
verifySecuredPayload(QByteArray((
const char*)packet, len), verifySecuredPacket);
1291 if(verifySecuredPacket)
1293 free(verifySecuredPacket);
1296 free(verifySecuredPacket);
1390 for(
int i=0; i<6; i++)
1404 (*m_locationTable)[packetIndex].setLongPositionVector(beac.
soPv());
1405 (*m_locationTable)[packetIndex].setLlAddr(eth->
ether_shost);
1406 (*m_locationTable)[packetIndex].setLastTimestamp(beac.
soPv().
timestamp());
1407 (*m_locationTable)[packetIndex].setVersion(bh.
version());
1409 (*m_locationTable)[packetIndex].setIsNeighbour(
true);
1447 for(
int i=0; i<6; i++)
1462 if((*m_locationTable).find(packetIndex) == (*m_locationTable).end())
1464 (*m_locationTable)[packetIndex].setLongPositionVector(LSRequest.
soPv());
1466 (*m_locationTable)[packetIndex].setVersion(bh.
version());
1468 (*m_locationTable)[packetIndex].setIsNeighbour(
false);
1469 (*m_locationTable)[packetIndex].setLastTimestamp(LSRequest.
soPv().
timestamp());
1470 (*m_locationTable)[packetIndex].setSequenceNumber(LSRequest.
sequenceNumber());
1483 (*m_locationTable)[packetIndex].setLongPositionVector(LSRequest.
soPv());
1485 (*m_locationTable)[packetIndex].setVersion(bh.
version());
1487 (*m_locationTable)[packetIndex].setLastTimestamp(LSRequest.
soPv().
timestamp());
1488 (*m_locationTable)[packetIndex].setSequenceNumber(LSRequest.
sequenceNumber());
1535 res =
greedy(bh, ch, LSReply, QByteArray(), QByteArray());
1553 QByteArray LSReplyData;
1554 QDataStream ds(&LSReplyData, QIODevice::WriteOnly);
1556 ds.writeRawData(ch.
toHex().data(), ch.
toHex().length());
1557 ds.writeRawData(LSReply.
toHex().data(), LSReply.
toHex().length());
1561 for(
int i = 0 ; i < 6 ; i++)
1566 int ret =
send(LSReplyData,
true, bh);
1582 quint16 port, portInfo;
1593 QByteArray LSRequestData;
1594 QDataStream ds(&LSRequestData, QIODevice::WriteOnly);
1596 ds.writeRawData(ch.
toHex().data(), ch.
toHex().length());
1597 ds.writeRawData(LSRequest.
toHex().data(), LSRequest.
toHex().length());
1600 for(
int i = 0 ; i < 6 ; i++)
1603 return send(LSRequestData,
false, bh);
1628 for(
int i=0; i<6; i++)
1643 if((*m_locationTable).find(packetIndex) == (*m_locationTable).end())
1645 (*m_locationTable)[packetIndex].setLongPositionVector(lsReply.
soPv());
1647 (*m_locationTable)[packetIndex].setVersion(bh.
version());
1648 (*m_locationTable)[packetIndex].setLastTimestamp(lsReply.
soPv().
timestamp());
1649 (*m_locationTable)[packetIndex].setSequenceNumber(lsReply.
sequenceNumber());
1651 (*m_locationTable)[packetIndex].setIsNeighbour(
false);
1664 (*m_locationTable)[packetIndex].setLongPositionVector(lsReply.
soPv());
1666 (*m_locationTable)[packetIndex].setVersion(bh.
version());
1668 (*m_locationTable)[packetIndex].setLastTimestamp(lsReply.
soPv().
timestamp());
1669 (*m_locationTable)[packetIndex].setSequenceNumber(lsReply.
sequenceNumber());
1688 (*m_locationTable)[packetIndex].setLsPending(
false);
1689 (*m_locationTable)[packetIndex].setNeverReceived(
false);
1716 res =
greedy(bh, ch, lsReply, packetIndex);
1735 for(
int i = 0 ; i < 6 ; i++)
1741 QByteArray basicHeaderData;
1742 QDataStream ds(&basicHeaderData, QIODevice::WriteOnly);
1744 ds.writeRawData(ch.
toHex().data(), ch.
toHex().length());
1745 ds.writeRawData(lsReply.
toHex().data(), lsReply.
toHex().length());
1747 int ret =
send(basicHeaderData,
false, bh);
1749 printf(
"\nSuccesfully forwarded LSReply");
1763 QByteArray packetIndex = QByteArray((
const char*)gac.soPv().gnAddr().toHex(),
GnAddr::helper_size);
1777 for(
int i=0; i<6; i++)
1778 if(gac.soPv().gnAddr().mid()[i] !=
m_gnAddr->
mid(i))
1792 if((*m_locationTable).find(packetIndex) == (*m_locationTable).end())
1794 (*m_locationTable)[packetIndex].setLongPositionVector(gac.soPv());
1796 (*m_locationTable)[packetIndex].setVersion(bh.
version());
1797 (*m_locationTable)[packetIndex].setStationType(gac.soPv().gnAddr().stationType());
1798 (*m_locationTable)[packetIndex].setIsNeighbour(
false);
1799 (*m_locationTable)[packetIndex].setLastTimestamp(gac.soPv().timestamp());
1800 (*m_locationTable)[packetIndex].setSequenceNumber(gac.sequenceNumber());
1813 (*m_locationTable)[packetIndex].setLongPositionVector(gac.soPv());
1815 (*m_locationTable)[packetIndex].setVersion(bh.
version());
1816 (*m_locationTable)[packetIndex].setStationType(gac.soPv().gnAddr().stationType());
1817 (*m_locationTable)[packetIndex].setLastTimestamp(gac.soPv().timestamp());
1818 (*m_locationTable)[packetIndex].setSequenceNumber(gac.sequenceNumber());
1839 if(((gac.destinationArea().distanceA() * gac.destinationArea().distanceA()) * M_PI) > (
itsGnMaxGeoAreaSize * 1000 * 1000))
1844 if((gac.destinationArea().distanceA() * gac.destinationArea().distanceB()) > (
itsGnMaxGeoAreaSize * 1000 * 1000))
1849 if((gac.destinationArea().distanceA() * gac.destinationArea().distanceB() * M_PI) > (
itsGnMaxGeoAreaSize * 1000 * 1000))
1860 y *= y < 0 ? -1 : 1;
1864 inArea =
f(x, y, gac.destinationArea().distanceA(), gac.destinationArea().distanceB(), shape);
1867 x*cos(gac.destinationArea().angle())-y*sin(gac.destinationArea().angle()),
1868 x*sin(gac.destinationArea().angle())+y*cos(gac.destinationArea().angle()),
1869 gac.destinationArea().distanceA(), gac.destinationArea().distanceB(), shape);
1873 quint16 port, portInfo;
1910 for(
int i = 0 ; i < 6 ; i++)
1916 QByteArray basicHeaderData;
1917 QDataStream ds(&basicHeaderData, QIODevice::WriteOnly);
1919 ds.writeRawData(ch.
toHex().data(), ch.
toHex().length());
1920 ds.writeRawData(gac.toHex().data(), gac.toHex().length());
1921 ds.writeRawData(payload, payload.length());
1923 int ret =
send(basicHeaderData,
false, bh);
1925 printf(
"\nSuccesfully forwarded GAC");
1942 QByteArray packetIndex = QByteArray((
const char*)gbc.soPv().gnAddr().toHex(),
GnAddr::helper_size);
1963 for(
int i=0; i<6; i++)
1964 if(gbc.soPv().gnAddr().mid()[i] !=
m_gnAddr->
mid(i))
1979 if((*m_locationTable).find(packetIndex) == (*m_locationTable).end())
1981 (*m_locationTable)[packetIndex].setLongPositionVector(gbc.soPv());
1983 (*m_locationTable)[packetIndex].setVersion(bh.
version());
1984 (*m_locationTable)[packetIndex].setStationType(gbc.soPv().gnAddr().stationType());
1985 (*m_locationTable)[packetIndex].setIsNeighbour(
false);
1986 (*m_locationTable)[packetIndex].setLastTimestamp(gbc.soPv().timestamp());
1987 (*m_locationTable)[packetIndex].setSequenceNumber(gbc.sequenceNumber());
2000 (*m_locationTable)[packetIndex].setLongPositionVector(gbc.soPv());
2002 (*m_locationTable)[packetIndex].setVersion(bh.
version());
2003 (*m_locationTable)[packetIndex].setStationType(gbc.soPv().gnAddr().stationType());
2004 (*m_locationTable)[packetIndex].setLastTimestamp(gbc.soPv().timestamp());
2005 (*m_locationTable)[packetIndex].setSequenceNumber(gbc.sequenceNumber());
2022 if(((gbc.destinationArea().distanceA() * gbc.destinationArea().distanceA()) * M_PI) > (
itsGnMaxGeoAreaSize * 1000 * 1000))
2024 printf(
"GBC_AREA_SIZE_C\n");
2030 if((gbc.destinationArea().distanceA() * gbc.destinationArea().distanceB()) > (
itsGnMaxGeoAreaSize * 1000 * 1000))
2032 printf(
"GBC_AREA_SIZE_R\n");
2038 if((gbc.destinationArea().distanceA() * gbc.destinationArea().distanceB() * M_PI) > (
itsGnMaxGeoAreaSize * 1000 * 1000))
2040 printf(
"GBC_AREA_SIZE_E\n");
2053 y *= y < 0 ? -1 : 1;
2057 inArea =
f(x, y, gbc.destinationArea().distanceA(), gbc.destinationArea().distanceB(), shape);
2060 x*cos(gbc.destinationArea().angle())-y*sin(gbc.destinationArea().angle()),
2061 x*sin(gbc.destinationArea().angle())+y*cos(gbc.destinationArea().angle()),
2062 gbc.destinationArea().distanceA(), gbc.destinationArea().distanceB(), shape);
2066 quint16 port, portInfo;
2070 printf(
"PACKET send to FAC\n");
2078 printf(
"Not in area\n");
2108 for(
int i = 0 ; i < 6 ; i++)
2114 QByteArray basicHeaderData;
2115 QDataStream ds(&basicHeaderData, QIODevice::WriteOnly);
2117 ds.writeRawData(ch.
toHex().data(), ch.
toHex().length());
2118 ds.writeRawData(gbc.toHex().data(), gbc.toHex().length());
2119 ds.writeRawData(payload, payload.length());
2121 int ret =
send(basicHeaderData,
false, bh);
2123 printf(
"\nSuccesfully forwarded GBC");
2137 QByteArray packetIndex = QByteArray((
const char*)guc.soPv().gnAddr().toHex(),
GnAddr::helper_size);
2155 for(
int i=0; i<6; i++)
2156 if(guc.soPv().gnAddr().mid()[i] !=
m_gnAddr->
mid(i))
2170 if((*m_locationTable).find(packetIndex) == (*m_locationTable).end())
2172 (*m_locationTable)[packetIndex].setLongPositionVector(guc.soPv());
2174 (*m_locationTable)[packetIndex].setVersion(bh.
version());
2175 (*m_locationTable)[packetIndex].setStationType(guc.soPv().gnAddr().stationType());
2176 (*m_locationTable)[packetIndex].setIsNeighbour(
false);
2177 (*m_locationTable)[packetIndex].setLastTimestamp(guc.soPv().timestamp());
2178 (*m_locationTable)[packetIndex].setSequenceNumber(guc.sequenceNumber());
2191 (*m_locationTable)[packetIndex].sequenceNumber(), guc.sequenceNumber()))
2192 || (*m_locationTable)[packetIndex].isPending())
2194 (*m_locationTable)[packetIndex].setLongPositionVector(guc.soPv());
2196 (*m_locationTable)[packetIndex].setVersion(bh.
version());
2197 (*m_locationTable)[packetIndex].setStationType(guc.soPv().gnAddr().stationType());
2198 (*m_locationTable)[packetIndex].setLastTimestamp(guc.soPv().timestamp());
2199 (*m_locationTable)[packetIndex].setSequenceNumber(guc.sequenceNumber());
2202 (*m_locationTable)[packetIndex].setNeverReceived(
false);
2203 (*m_locationTable)[packetIndex].setLsPending(
false);
2219 if(guc.dePv().gnAddr() == *
m_gnAddr)
2221 quint16 port, portInfo;
2236 QByteArray destIndex = QByteArray((
const char*)guc.dePv().gnAddr().toHex(),
GnAddr::helper_size);
2238 QHash<QByteArray, LocationTableEntry>::Iterator pos =
m_locationTable->find(destIndex);
2241 (*
m_locationTable)[destIndex].setLongPositionVector(
LongPositionVector(guc.dePv().gnAddr(), guc.dePv().timestamp(), guc.dePv().latitude(), guc.dePv().longitude(), 0, 0, 0));
2245 if((*
m_locationTable)[destIndex].lastTimestamp() < guc.dePv().timestamp())
2247 (*m_locationTable)[destIndex].setLastTimestamp(guc.dePv().timestamp());
2248 (*m_locationTable)[destIndex].setLongPositionVector(guc.dePv());
2268 res =
greedy(bh, ch, guc, payload, packetIndex);
2282 for(
int i = 0 ; i < 6 ; i++)
2288 QByteArray basicHeaderData;
2289 QDataStream ds(&basicHeaderData, QIODevice::WriteOnly);
2291 ds.writeRawData(ch.
toHex().data(), ch.
toHex().length());
2292 ds.writeRawData(guc.toHex().data(), guc.toHex().length());
2293 ds.writeRawData(payload, payload.length());
2295 int ret =
send(basicHeaderData,
false, bh);
2297 printf(
"\nSuccesfully forwarded GUC");
2320 for(
int i=0; i<6; i++)
2334 (*m_locationTable)[packetIndex].setLongPositionVector(shb.
soPv());
2335 (*m_locationTable)[packetIndex].setLlAddr(eth->
ether_shost);
2336 (*m_locationTable)[packetIndex].setLastTimestamp(shb.
soPv().
timestamp());
2337 (*m_locationTable)[packetIndex].setVersion(bh.
version());
2339 (*m_locationTable)[packetIndex].setIsNeighbour(
true);
2352 quint16 port, portInfo;
2373 QByteArray packetIndex = QByteArray((
const char*)tsb.soPv().gnAddr().toHex(),
GnAddr::helper_size);
2385 for(
int i=0; i<6; i++)
2386 if(tsb.soPv().gnAddr().mid()[i] !=
m_gnAddr->
mid(i))
2401 if((*m_locationTable).find(packetIndex) == (*m_locationTable).end())
2403 (*m_locationTable)[packetIndex].setLongPositionVector(tsb.soPv());
2405 (*m_locationTable)[packetIndex].setVersion(bh.
version());
2406 (*m_locationTable)[packetIndex].setStationType(tsb.soPv().gnAddr().stationType());
2407 (*m_locationTable)[packetIndex].setIsNeighbour(
false);
2408 (*m_locationTable)[packetIndex].setLastTimestamp(tsb.soPv().timestamp());
2409 (*m_locationTable)[packetIndex].setSequenceNumber(tsb.sequenceNumber());
2422 (*m_locationTable)[packetIndex].setLongPositionVector(tsb.soPv());
2424 (*m_locationTable)[packetIndex].setVersion(bh.
version());
2425 (*m_locationTable)[packetIndex].setStationType(tsb.soPv().gnAddr().stationType());
2426 (*m_locationTable)[packetIndex].setLastTimestamp(tsb.soPv().timestamp());
2427 (*m_locationTable)[packetIndex].setSequenceNumber(tsb.sequenceNumber());
2445 quint16 port, portInfo;
2460 bool noNeighbour =
true;
2465 noNeighbour =
false;
2477 QDataStream ds(&tsbData, QIODevice::WriteOnly);
2479 ds.writeRawData(ch.
toHex().data(), ch.
toHex().length());
2480 ds.writeRawData(tsb.toHex().data(), tsb.toHex().length());
2481 ds.writeRawData(payload.data(), payload.length());
2484 for(
int i = 0 ; i < 6 ; i++)
2487 int ret =
send(tsbData,
false, bh);
2529 qint32 packetLat, packetLong;
2566 double MFR = distDest;
2567 bool hasNeighbour =
false;
2575 if(i.key() != sender && tmp.isNeighbour() != 0 && *tmp.isNeighbour())
2577 hasNeighbour =
true;
2578 double distNeighbour =
dist(packetLat, packetLong, tmp.longPositionVector().latitude(),
2579 tmp.longPositionVector().longitude());
2580 if(distNeighbour<MFR)
2583 NH[i] = tmp.llAddr()[i];
2584 MFR = distNeighbour;
2605 printf(
"Packet stocké dans le UnicastPacketBuffer\n");
2610 printf(
"Packet stocké dans le BroadcastPacketBuffer\n");
2635 y *= y < 0 ? -1 : 1;
2662 QHash<QByteArray, LocationTableEntry>::Iterator pos =
m_locationTable->find(sender);
2748 printf(
"Succès de l'ajout du packet au cbfpb!\n");
2750 printf(
"Echec de l'ajout du packet au cbfpb : DuplicatePacket (Ceci n'est pas censé arrivé)\n");
2764 QHash<QByteArray, LocationTableEntry>::Iterator pos =
m_locationTable->find(sender);
2814 double xSender, ySender;
2824 ySender *= ySender<0?-1:1;
2827 double xFrwrd = 0, yFrwrd = 0;
2837 bool isForwarder =
true;
2838 for(
int j = 0; j < ETHER_ADDR_LEN; j++)
2839 if(i->llAddr(j) != forwarderEth[j])
2840 isForwarder =
false;
2845 yFrwrd *= yFrwrd<0?-1:1;
2878 double dist_r =
dist(x, y, xSender, ySender);
2879 double dist_f =
dist(xFrwrd, yFrwrd, xSender, ySender);
2880 double dist_fr =
dist(x, y, xFrwrd, yFrwrd);
2907 printf(
"\n\nTIMER PROLONGER\n\n");
2909 printf(
"Echec de l'update du timer du packet dans le cbfpb : PacketNotFound (Ceci n'est pas censé arrivé)\n");
2919 bool iAmDest =
true, destIsBC =
true;
2920 for(
int j = 0; j < ETHER_ADDR_LEN; j++)
2923 if(*destEth != 0xff)
2927 if(iAmDest || destIsBC)
2931 addr =
greedy(bh, ch, packet, packetPayload, sender, destEth, forwarderEth);
2937 printf(
"Succès de l'ajout du packet au cbfpb!\n");
2939 printf(
"Echec de l'ajout du packet au cbfpb : DuplicatePacket (Ceci n'est pas censé arrivé)\n");
2960 printf(
"Succès de l'ajout du packet au cbfpb!\n");
2962 printf(
"Echec de l'ajout du packet au cbfpb : DuplicatePacket (Ceci n'est pas censé arrivé)\n");
2986 return greedy(bh, ch, packet, packetPayload, sender, destEth, forwarderEth);
3021 qDebug() <<
"CBFUnicast erase";
3039 printf(
"Succès de l'ajout du packet au cbfpb!\n");
3041 printf(
"Echec de l'ajout du packet au cbfpb : DuplicatePacket (Ceci n'est pas censé arrivé)\n");
3058 printf(
"Succès de l'ajout du packet au cbfpb!\n");
3060 printf(
"Echec de l'ajout du packet au cbfpb : DuplicatePacket (Ceci n'est pas censé arrivé)\n");
3131 printf(
"LifeTime outdated\n");
3140 QDataStream ds(&packet, QIODevice::WriteOnly);
3159 printf(
"geonetError_checkUC_guc_bufferedPacket\n");
3164 printf(
"geonetError_checkUC_guc_discardedPacket\n");
3172 for(
int k = 0 ; k < 6 ; k++)
3176 for(
int k = 0 ; k < 6 ; k++)
3179 size_t tx_len =
sizeof(
struct ether_header);
3182 for(
int k = 0 ; k < packet.length(); k++)
3187 qDebug() <<
"sendto" << strerror(errno);
3199 for(
int priority = 0; priority < 4; priority++)
3203 if(i->gucPacket().dePv().gnAddr() == destination && i->commonHeader().trafficClass().TCID() == priority)
3205 i->updateSourcePacketSoPv(lpv);
3206 quint64 lt = i->basicHeader().lifeTime().lifeTime() - i->m_elapsed.elapsed();
3209 i->basicHeader().setLifeTime(
LifeTime(lt));
3212 QDataStream ds(&packet, QIODevice::WriteOnly);
3213 ds.writeRawData(i->basicHeader().toHex().data(), i->basicHeader().toHex().length());
3214 ds.writeRawData(i->commonHeader().toHex().data(), i->commonHeader().toHex().length());
3222 res =
greedy(i->basicHeader(), i->commonHeader(), i->gucPacket(), i->payload(), i->sender());
3225 res =
CBFUnicast(i->basicHeader(), i->commonHeader(), i->gucPacket(), i->payload());
3231 printf(
"geonetError_flushUC_guc_bufferedPacket\n");
3236 printf(
"geonetError_flushUC_guc_discardedPacket\n");
3240 ds.writeRawData(i->gucPacket().toHex().data(), i->gucPacket().toHex().length());
3241 ds.writeRawData(i->payload().data(), i->payload().length());
3244 for(
int k = 0 ; k < 6 ; k++)
3248 for(
int k = 0 ; k < 6 ; k++)
3251 size_t tx_len =
sizeof(
struct ether_header);
3254 for(
int k = 0 ; k < packet.length(); k++)
3259 qDebug() <<
"sendto" << strerror(errno);
3269 printf(
"\n\nCHECK BCFPB\n\n");
3278 i->updateSourcePacketSoPv(lpv);
3279 if(i->basicHeader().lifeTime().lifeTime() - i->m_elapsed.elapsed() < 0)
3306 quint64 lt = i->basicHeader().lifeTime().lifeTime() - i->m_elapsed.elapsed();
3309 i->basicHeader().setLifeTime(
LifeTime(lt));
3311 switch(i->commonHeader().headerType())
3316 printf(
"\n\nCHECK BCFPB\n\n");
3320 geoPacket = i->gacPacket();
3322 geoPacket = i->gbcPacket();
3327 switch(i->commonHeader().headerSubType())
3333 printf(
"GBC Sending Error : Area size is too large.\n");
3341 printf(
"GBC Sending Error : Area size is too large.\n");
3349 printf(
"GBC Sending Error : Area size is too large.\n");
3358 bool iamsender = (i->sender() == QByteArray());
3365 res =
simpleForwardingAlgorithm(i->basicHeader(), i->commonHeader(), geoPacket, i->payload(), shape, QByteArray(),
true);
3367 res =
simpleForwardingAlgorithm(i->basicHeader(), i->commonHeader(), geoPacket, i->payload(), shape, i->sender(),
false);
3377 res =
advancedForwarding(i->basicHeader(), i->commonHeader(), geoPacket, i->payload(), shape, QByteArray(), i->destination(), i->forwarder(),
true);
3379 res =
advancedForwarding(i->basicHeader(), i->commonHeader(), geoPacket, i->payload(), shape, i->sender(), i->destination(), i->forwarder(),
true);
3385 printf(
"checkBCFPB packet buffered GBC/GAC\n");
3391 for(
int k = 0 ; k < 6 ; k++)
3396 QDataStream ds(&packet, QIODevice::WriteOnly);
3398 ds.writeRawData(i->commonHeader().toHex().data(), i->commonHeader().toHex().length());
3399 ds.writeRawData(geoPacket.
toHex().data(), geoPacket.
toHex().length());
3400 ds.writeRawData(i->payload().data(), i->payload().length());
3402 send(packet,
true, i->basicHeader());
3409 bool noNeighbour =
true;
3413 noNeighbour =
false;
3415 if(noNeighbour && i->commonHeader().trafficClass().SCF() == 1)
3419 m_BCFPB->
addPacket(i->basicHeader(), i->commonHeader(), i->shbPacket(), i->payload(), i->sender());
3421 m_BCFPB->
addPacket(i->basicHeader(), i->commonHeader(), i->tsbPacket(), i->payload(), i->sender());
3428 QDataStream ds(&shbData, QIODevice::WriteOnly);
3430 ds.writeRawData(i->commonHeader().toHex().data(), i->commonHeader().toHex().length());
3432 ds.writeRawData(i->shbPacket().toHex().data(), i->shbPacket().toHex().length());
3434 ds.writeRawData(i->tsbPacket().toHex().data(), i->tsbPacket().toHex().length());
3435 ds.writeRawData(i->payload().data(), i->payload().length());
3438 for(
int i = 0 ; i < 6 ; i++)
3442 send(shbData,
true, i->basicHeader());
3485 return bh.
toHex() + signedPayload;
3490 QNetworkDatagram response;
3497 qDebug() << response.data().toHex() <<
"received from verify";
3498 *success = (bool)response.data()[0];
3499 qDebug() << (int)response.data()[0] << *success;
3502 qDebug() << response.data().right(response.data().length() - 1).toHex();
3503 return response.data().right(response.data().length() - 1);
#define itsGnLifetimeLocTE
void setPresent(ForwardingAlgorithmResponse_PR p)
setPresent Set the type of response
int sendGUC(gnDataRequest_t gnDR)
sendGUC Send a GUC.
ForwardingAlgorithmResponse simpleForwardingAlgorithm(BasicHeader bh, CommonHeader ch, GBCPacket packet, QByteArray packetPayload, e_shape shape, QByteArray sender, bool flagSrc)
simpleForwardingAlgorithm Simple algorithm.
FakeGPSProvider * m_paramGPS
quint32 timestamp() const
timestamp Entry timestamp getter.
void checkBCFPB()
checkBCFPB Check to flush the broadcast forawarding packet buffer.
gnDataRequest_t structure is the GN data request definition.
void addPacket(BasicHeader bh, CommonHeader ch, GUCPacket packet, QByteArray payload, QByteArray sender)
addPacket Add packet to the buffer.
void flushLSPB(GnAddr destination)
flushLSPB Flush LS packet buffer.
int sendGBC(gnDataRequest_t gnDR)
sendGBC Send an LSRequest.
LifeTime * maximumPacketLifeTime
quint16 * repetitionInterval
CBFPacketBuffer * m_CBFPB
GeoNet()
GeoNet GeoNet constructor.
u_char ether_dhost[ETHER_ADDR_LEN]
quint16 timeout() const
timeout Timeout to wait for server response getter.
void sendPacketFromRPB(gnDataRequest_t rawPacket)
sendPacketFromRPB Slot used to send packet from repetition packet buffer.
ForwardingAlgorithmResponse contentionBasedForwardingAlgorithm(BasicHeader bh, CommonHeader ch, GBCPacket packet, QByteArray packetPayload, e_shape shape, QByteArray sender, bool flagSrc)
contentionBasedForwardingAlgorithm CBF algorithm.
void verifLocT()
verifLocT Checks if the LocT has expired packet.
int upperTesterEventIndicationListenPort() const
upperTesterEventIndicationListenPort Port used to listen for event indication getter.
int gbcPacketProcessing(uchar *packet, sniff_ethernet_t *eth, BasicHeader bh, CommonHeader ch)
gbcPacketProcessing GBC Header decoding.
LSReplyPacket lsReplyPacket()
beaconPacket LSReply entry creation.
bool itsGnGeoAreaLineForwarding() const
itsGnGeoAreaLineForwarding Is the GN geo area line forwarding used?
void addPacket(gnDataRequest_t gnDR)
addPacket Add packet to the buffer.
quint64 extract(uchar *packet)
extract Extract GBC from packet.
int integer() const
integer Integer getter.
int lsRetransmit(GnAddr destination, QByteArray lsRequestData, BasicHeader bh)
lsRetransmit Retransmission of an LSRequest.
int TO_CBF_GUC(int distance)
TO_CBF_GUC TO_CBF_GUC computation.
sniff_destinationArea_t destinationArea
#define itsGnBeaconServiceRetransmitTimer
BasicHeader basicHeader() const
basicHeader Entry Basic Header getter.
quint16 * maximumRepetitionTime
void clear()
clear Clear the buffer.
Security profile for CAM purpose.
void clear()
clear Clear the buffer.
TrafficClass trafficClass() const
trafficClass ITS-S traffic class getter.
void clear()
clear Clear the buffer.
~GeoNet()
~GeoNet GeoNet destructor.
bool isDuplicateTimestamp(BeaconPacket packet)
isDuplicateTimestamp Check is the packet is duplicate.
void treatPackets(QByteArray)
treatPackets Slot used to treat received packets.
quint64 extract(uchar *packet)
extract Extract GUCPacket from packet.
CommonHeader commonHeader() const
basicHeader Entry Common Header getter.
ParameterSecurity * m_paramSecu
double dist(qint32 x1, qint32 y1, qint32 x2, qint32 y2)
dist This function calculate the euclidian distance between two points ([x1, y1], [x2...
quint64 extract(uchar *packet)
extract Extract GBC from packet.
int commonHeaderProcessing(uchar *packet, sniff_ethernet_t *eth, BasicHeader bh)
commonHeaderProcessing Common Header decoding.
LongPositionVector soPv() const
soPv TSB SO PV getter.
void sslErrors(const QList< QSslError > &errors)
sslErrors Print SSL errors.
LongPositionVector soPv() const
soPv SO PV getter.
BasicHeader basicHeader() const
basicHeader Entry Basic Header getter.
QByteArray getSecuredPayload(QByteArray payload, BasicHeader bh)
getSecuredPayload Send payload to secure to the HSM.jar.
QVector< BroadcastForwardingPacketEntry > bcForwardPacketBuffer() const
bcForwardPacketBuffer Buffer getter.
void sendBeacon()
sendBeacon Slot used to send Beacon.
GUCPacket gucPacket()
beaconPacket GUC entry creation.
quint32 timestamp() const
timestamp Timestamp field getter
#define itsGnBeaconServiceMaxJitter
QHash< QByteArray, LocationTableEntry > * m_locationTable
void changeMID()
changeMID Slot used when need to change the MID.
ParameterUpperTester * m_paramUpperTester
QHash< QString, void * > hashMap
quint64 timestamp()
timestamp Timestamp getter.
QUdpSocket * m_signatureSocket
uchar * mid()
mid MID getter.
quint16 sequenceNumber() const
sequenceNumber Sequence number getter.
u_char ether_shost[ETHER_ADDR_LEN]
QByteArray payload() const
payload Entry payload getter.
#define itsGnLocalAddrConfMethod_auto
static int nbLSForwardingPacketQueued
quint16 distanceB() const
geoAreaPosLatitude Distance B field getter.
QHash< int, QString > geonetErrors
int sendLsRequest(GnAddr dest, gnDataRequest_t gnDR)
sendLsRequest Send an LSRequest.
void flushPB(GnAddr destination)
flushPB Flush buffer.
ForwardingAlgorithmResponse advancedForwarding(BasicHeader bh, CommonHeader ch, GBCPacket packet, QByteArray packetPayload, e_shape shape, QByteArray sender, uchar *destEth, uchar *forwarderEth, bool flagSrc)
advancedForwarding Advanced algorithm.
The sniff_ethernet_t structure is a C style of the Ethernet header.
GnAddr destination() const
destination LS destination getter.
static quint16 sequenceNumber
GnAddr gnAddr() const
gnAddr GnAddr field getter
void socketReadyRead()
socketReadyRead Slot used when socket is ready to read.
#define itsGnLocationServiceRetransmitTimer
bool isDuplicatePacketDetectionTimestampSN(quint32 lastReceivedTimestamp, quint32 nowReceivedTimestamp, quint16 lastReceivedSN, quint16 nowReceivedSN)
isDuplicatePacketDetectionTimestamp Calculate if the packet is a duplicate using the timestamp and th...
GBCPacket gbcPacket()
beaconPacket GBC entry creation.
#define itsGnBroadcastCBFDefSectorAngle
GACPacket gacPacket()
beaconPacket GAC entry creation.
HeadingValue_t headingValue
#define itsGnSecurity_enabled
SemiAxisLength_t semiMajorConfidence
int upperTesterEventIndicationWritePort() const
upperTesterEventIndicationWritePort Port used to write for event indication getter.
ParameterConfiguration * m_paramConf
QByteArray payload() const
basicHeader Entry payload getter.
ParameterHybrid * m_paramHybrid
QByteArray sender() const
sender Entry sender getter.
FakeCANProvider * m_paramCAN
QList< LocationServicePacketEntry > lsPacketBuffer()
lsPacketBuffer The LS buffer getter.
quint32 lifeTime() const
lifeTime Life time value computation.
PosConfidenceEllipse_t positionConfidenceEllipse
ParameterGPS & data()
data GPS data getter.
CommonHeader::e_upperProtocolEntity upperProtocolEntity
QHash< QByteArray, int > m_lsRetransmission
int basicHeaderProcessing(uchar *packet, int len, sniff_ethernet_t *eth)
basicHeaderProcessing Basic Header decoding.
HistoryPacketBuffer * m_HPB
void packetReceived(QByteArray)
packetReceived Signal used when a packet is received.
QByteArray certificate() const
certificate Certificate getter.
int shbPacketProcessing(uchar *packet, sniff_ethernet_t *eth, BasicHeader bh, CommonHeader ch)
shbPacketProcessing SHB Header decoding.
int maxRepetitionAdvancedContention() const
maxRepetitionAdvancedContention Counter used for the Advance GBC forwarding algorithm getter...
uchar * destination()
destination Entry destination getter.
quint8 * mid()
mid MID field getter.
void clear()
clear Clear the buffer.
void initHybridSocket()
initHybridSocket Set the hybridization sockets.
QHash< QByteArray, int > m_CBFPBCounter
quint16 MStationTypeCountryCode() const
MStationTypeCountryCode Manually StationType CountryCode field getter.
quint64 extract(uchar *packet)
extract Extract GBC from packet.
int tsbPacketProcessing(uchar *packet, sniff_ethernet_t *eth, BasicHeader bh, CommonHeader ch)
tsbPacketProcessing TSB Header decoding.
quint16 serverPort() const
serverPort ITS-C port getter.
void addPacket(BasicHeader bh, CommonHeader ch, GACPacket packet, QByteArray payload, QByteArray sender, uchar *destination, uchar *forwarder)
addPacket Add packet to the buffer.
#define itsGnGeoBroadcastCbfMaxTime
quint16 internalBTPPort(quint16 port, quint16 portInfo)
internalBTPPort Get the internal BTP port.
int gucPacketProcessing(uchar *packet, sniff_ethernet_t *eth, BasicHeader bh, CommonHeader ch)
gucPacketProcessing GUC Header decoding.
quint64 extract(uchar *packet)
extract Extract GBC from packet.
LocationServicePacketBuffer * m_LSPB
bool update(GBCPacket packet, int timeToBuffer)
update Update the packet of the buffer.
#define itsGnLocationServiceMaxRetrans
destinationAddress_t destinationAddress
bool erase(GBCPacket packet)
erase Remove packet from the buffer.
qint32 geoAreaPosLatitude() const
geoAreaPosLatitude Geo area position latitude field getter.
int g(double dist_r, double dist_f, double dist_fr, int angleThreshold)
g Compute the g function.
qint32 latitude() const
latitude Latitude field getter
quint8 packetTransportSubType
#define itsGnDefaultHopLimit
QString serverAddress() const
serverAddress IP address of the security server getter.
int beaconPacketProcessing(uchar *packet, sniff_ethernet_t *eth, BasicHeader bh, CommonHeader ch)
beaconPacketProcessing Beacon Header decoding.
e_shape
The e_shape enum defines the shapes type.
ForwardingAlgorithmResponse greedy(BasicHeader bh, CommonHeader ch, GACPacket packet, QByteArray payload, QByteArray sender, uchar *destination, uchar *forwarder)
greedy Greedy algorithm.
int sendTSB(gnDataRequest_t gnDR)
sendTSB Send an LSRequest.
bool erase(GUCPacket packet)
erase Remove packet from the buffer.
#define itsGnMaxGeoAreaSize
qint32 latitude() const
latitude Latitude field getter
void sendEventIndicationToUT(uchar *packetFull, int packetLen)
sendEventIndicationToUT Send decoding success notification to the UpperTester.
void setInteger(int n)
setInteger Integer setter.
quint16 angle() const
geoAreaPosLatitude Angle field getter.
QUdpSocket * m_verifySocket
void setupUnsecureSocket()
setupUnsecureSocket Set TCP socket for hybridization.
ShortPositionVector dePv() const
dePv GUC DE PV getter.
int TO_CBF_GBC(int distance)
TO_CBF_GBC TO_CBF_GBC computation.
bool isMacAddr()
isMacAddr Look if the ForwardingAlgorithmResponse is a MAC address.
uchar * forwarder()
forwarder Entry forwarder getter.
Speed_t speed() const
speed ITS-S speed getter.
bool sslUsed() const
sslUsed Is SSL used?
quint8 SCF() const
SCF Store-carry-forward field getter.
quint64 circAtLat(long l)
circAtLat Compute the circumference at a latitude.
ReferencePosition_t referencePosition() const
referencePosition ITS-S position getter.
quint64 extract(uchar *packet)
extract Extract Beacon from packet.
int sendSHB(gnDataRequest_t gnDR)
sendSHB Send an LSRequest.
QByteArray toHex()
toHex Create a QByteArray containing the hexadecimal format of the GnAddr.
LongPositionVector longPositionVector() const
longPositionVector LPV getter.
quint16 sequenceNumber() const
sequenceNumber TSB sequence number getter.
void clear()
clear Clear the buffer.
quint64 get_UINT16(u_char *field, quint16 *uint16)
get_INT64 Extract an integer encoded in 64 bits from a byte array.
int sendGAC(gnDataRequest_t gnDR)
sendGAC Send an LSRequest.
QByteArray signPayload(QByteArray payload, SecurityProfile::e_securityProfileType profile)
signPayload Sign a payload.
uchar * macAddr()
macAddr MAC address getter.
BroadcastForwardingPacketBuffer * m_BCFPB
bool itsGnLocalAddrConfMethod() const
itsGnLocalAddrConfMethod ITS GN-ADDR configuration method getter.
qint32 geoAreaPosLongitude() const
geoAreaPosLatitude Geo area position longitude field getter.
double f(long x, long y, double lengthA, double lengthB, e_shape shape)
f Compute the f function.
int addPacket(BasicHeader bh, CommonHeader ch, GBCPacket packet, QByteArray payload, int timeToBuffer)
addPacket Add packet to the buffer.
quint8 itsGnGeoUnicastForwardingAlgorithm() const
itsGnGeoUnicastForwardingAlgorithm GUC forwarding algorithm getter.
quint8 itsGnGeoBroadcastForwardingAlgorithm() const
itsGnGeoBroadcastForwardingAlgorithm GBC forwarding algorithm getter.
quint64 decode_Certificate(uchar *field, Certificate_t *certificate)
decode_Certificate Decode a Certificate.
void initGeoNetErrors()
initGeoNetErrors Set the debugging print.
void remove(LocationServicePacketEntry lspe)
find Remove packet in the buffer.
DestinationArea destinationArea() const
destinationArea Destination area getter.
void flushUCFPB(GnAddr destination)
flushUCFPB Flush unicast forawarding packet buffer.
#define itsGnProtocolVersion
ParameterApplication & data()
data Returns the vehicle status.
CommonHeader::e_headerType packetTransportType
bool isDuplicateTimestamp(GBCPacket packet)
isDuplicateTimestamp Check is the packet is duplicate.
QString serverAddress() const
serverAddress ITS-C IP address getter.
e_destinationAddress_PR_present present
bool itsGnIsMobile() const
itsGnIsMobile Is the ITS-S mobile?.
UnicastForwardingPacketBuffer * m_UCFPB
bool isInteger()
isInteger Look if the ForwardingAlgorithmResponse is an integer.
ParameterNetwork * m_paramNetwork
quint8 stationType() const
stationType Station Type field getter (5 bits).
void erase(GnAddr destination)
find Remove packet in the buffer.
int gacPacketProcessing(uchar *packet, sniff_ethernet_t *eth, BasicHeader bh, CommonHeader ch)
gacPacketProcessing GAC Header decoding.
void socketError(QAbstractSocket::SocketError)
socketError Print TCP socket error.
#define itsGnDefaultMaxCommunicationRange
void execute()
execute Slot used to execute the Beacon creation and sending.
CommonHeader commonHeader() const
commonHeader Entry Common Header getter.
quint16 destinationPortInfo
FakeApplicationProvider * m_paramAppli
void utInitialize()
utInitialize Slot used to initialize the N&T layer.
void setMultiplierBase(quint8 m)
setMultiplierBase Multiplier + base setter.
int LSReplyPacketProcessing(uchar *packet, sniff_ethernet_t *eth, BasicHeader bh, CommonHeader ch)
LSReplyProcessing LSReply Header decoding.
int InitRawSocket_send()
InitRawSocket_send Set the ITS-G5 socket.
int send(gnDataRequest_t gnDR)
send Creates the BTP and then select the correct packet send option.
GnAddr destination()
destination Request GN_ADDR getter.
QByteArray toHex()
toHex Create a QByteArray containing the hexadecimal format of the GBCPacket.
union destinationAddress_s::@2 choice
The choice union is composed by a GN_ADDR or a destination area.
ForwardingAlgorithmResponse CBFUnicast(BasicHeader bh, CommonHeader ch, GACPacket packet, QByteArray packetPayload)
CBFUnicast Unicast CBF algoritm.
#define itsGnGeoBroadcastCbfMinTime
struct sockaddr_ll socket_address
void setupSecureSocket()
setupSecureSocket Set SSL socket for hybridization.
bool itsGnSecurity() const
itsGnSecurity Is the security layer used?
bool isDuplicatePacketDetectionTimestamp(quint32 lastReceivedTimestamp, quint32 nowReceivedTimestamp)
isDuplicatePacketDetectionTimestamp Calculate if the packet is a duplicate using the timestamp of the...
RepetitionPacketBuffer * m_RPB
Heading_t heading() const
heading ITS-S heading getter.
gnDataRequest_t packet() const
packet Entry GN Data Request getter.
quint16 sequenceNumber() const
sequenceNumber GUC sequence number getter.
e_gnCommunicationProfile gnCommunicationProfile
qint32 longitude() const
longitude Longitude field getter
quint16 verifyPort() const
verifyPort Port of the verification service getter.
unsigned int diameter(long begin, long end, quint64 circ)
diameter Compute the distance between two point on the same latitude.
void addPacket(BeaconPacket packet)
addPacket Add packet to the buffer.
QString interface() const
interface ITS-G5 interface name getter.
void checkUCFPB()
checkUCFPB Check to flush the unicast forawarding packet buffer.
QByteArray verifySecuredPayload(QByteArray payload, bool *success)
verifySecuredPayload Send payload to verify to the HSM.jar.
QVector< UnicastForwardingPacketEntry > ucForwardPacketBuffer() const
ucForwardPacketBuffer Buffer getter.
int LSRequestPacketProcessing(uchar *packet, sniff_ethernet_t *eth, BasicHeader bh, CommonHeader ch)
LSRequestPacketProcessing LSRequest Header decoding.
void setMacAddr(uchar *m)
setMacAddr MAC address setter.
void updateSourcePacketSoPv(LongPositionVector lpv)
updateSourcePacketSoPv Update entry SO PV.
void lpvUpdate()
lpvUpdate Slot used when a packet containing an LPV is sent.
LongPositionVector soPv() const
soPv SHB SO PV getter.
QByteArray toHex()
toHex Create a QByteArray containing the hexadecimal format of the GBCPacket.
int hybridSend(QByteArray payload)
hybridSend Send packet with the hybridization.
void format(unsigned char *msg, unsigned long v, int l)
format Format a number in byte array.
SecurityManager m_securityManager
qint32 longitude() const
longitude Longitude field getter
GnAddr gnAddr() const
gnAddr GnAddr field getter
TrafficClass trafficClass
LongPositionVector soPv() const
soPv GUC SO PV getter.
void calculAngleThreshold()
calculAngleThreshold Compute the ANGLE_TH for the advanced forwarding.
void addPacket(GnAddr destination, gnDataRequest_t packet, quint32 timestamp)
addPacket Add packet to the buffer.
QByteArray toHex()
toHex Create a QByteArray containing the hexadecimal format of the GBCPacket.
void lpvSent()
lpvSent Signal used when a packet containing an LPV is sent.
void clear()
clear Clear the buffer.
LongPositionVector soPv() const
soPv SO PV getter.
quint16 distanceA() const
geoAreaPosLatitude Distance A field getter.
GUCPacket gucPacket() const
gucPacket Entry packet getter.