|
|
|
|
@ -20,11 +20,14 @@
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
#include <boost/container_hash/hash.hpp>
|
|
|
|
|
|
|
|
|
|
#include "UDPReaderWriter.h"
|
|
|
|
|
#include "DStarDefines.h"
|
|
|
|
|
#include "HeaderData.h"
|
|
|
|
|
#include "AMBEData.h"
|
|
|
|
|
#include "NetUtils.h"
|
|
|
|
|
|
|
|
|
|
enum G2_TYPE {
|
|
|
|
|
GT_NONE,
|
|
|
|
|
@ -32,6 +35,37 @@ enum G2_TYPE {
|
|
|
|
|
GT_AMBE
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// struct sockaddr_storage_map {
|
|
|
|
|
// struct comp {
|
|
|
|
|
// bool operator() (const struct sockaddr_storage& a, const struct sockaddr_storage& b) const {
|
|
|
|
|
// return CNetUtils::match(a, b, IMT_ADDRESS_AND_PORT);
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
// struct hash {
|
|
|
|
|
// std::size_t operator() (const sockaddr_storage& a) const {
|
|
|
|
|
// switch(a.ss_family)
|
|
|
|
|
// {
|
|
|
|
|
// case AF_INET: {
|
|
|
|
|
// auto ptr4 = ((struct sockaddr_in *)&a);
|
|
|
|
|
// size_t res = AF_INET;
|
|
|
|
|
// boost::hash_combine(res, ptr4->sin_addr.s_addr);
|
|
|
|
|
// boost::hash_combine(res, ptr4->sin_port);
|
|
|
|
|
// return res;
|
|
|
|
|
// }
|
|
|
|
|
// case AF_INET6: {
|
|
|
|
|
// auto ptr6 = ((struct sockaddr_in6 *)&a);
|
|
|
|
|
// size_t res = AF_INET6;
|
|
|
|
|
// boost::hash_combine(res, ptr6->sin6_port);
|
|
|
|
|
// boost::hash_combine(res, ptr6->sin6_addr);
|
|
|
|
|
// return res;
|
|
|
|
|
// }
|
|
|
|
|
// default:
|
|
|
|
|
// return 0U;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
class CG2ProtocolHandler {
|
|
|
|
|
public:
|
|
|
|
|
CG2ProtocolHandler(unsigned int port, const std::string& addr = std::string(""));
|
|
|
|
|
|