Commit a01fec5d authored by berge's avatar berge
Browse files

Fixed issue in Filters

parent e020154f
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -101,8 +101,10 @@ bool FilterSet::Match(const ProtocolInfoElement * pProtocolInfo)
	bool bSenderMatch = false;
	bool bRcvMatch = false;
	iterator it = begin();
	bool bEmptyFilterSet = true;
	while (it != end())
	{
	  bEmptyFilterSet = false;
		if (!(*it)->Match(pProtocolInfo)) // remove filter element
		{
		  	delete (*it);
@@ -116,7 +118,7 @@ bool FilterSet::Match(const ProtocolInfoElement * pProtocolInfo)
			++it;
		}
	}
	return bSenderMatch || bRcvMatch || (begin() == end()); //TODO... refine this (was &&)
	return (bSenderMatch && bRcvMatch) || bEmptyFilterSet; 
}

void FilterSet::MoveToNextLayer()
+10 −2
Original line number Diff line number Diff line
@@ -14,6 +14,14 @@ namespace t3devlib
#include <t3devlib/t3devlib.h>
#endif

#ifdef WIN32
#include <WinSock2.h>
#define socklen_t int
#else
#include <netinet/in.h>
#endif


enum EProtocolType 
{ 
	EProtocolType_None,
@@ -77,8 +85,8 @@ public:
	virtual bool Match(const ProtocolInfoElement & toCompare) const;
	unsigned short GetSourcePort() const { return m_nSrcPort; }
	unsigned short GetDestinationPort() const { return m_nDstPort; }
	void SetSourcePort(unsigned short nPort) { m_nSrcPort = nPort; }
	void SetDestinationPort(unsigned short nPort) { m_nDstPort = nPort; }
	void SetSourcePort(unsigned short nPort) { m_nSrcPort = ntohs(nPort); }
	void SetDestinationPort(unsigned short nPort) { m_nDstPort = ntohs(nPort); }
 };

class TcpInfo : public TransportLayerInfo
+8 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
#include "Ports/DataPort.h"
#include "Ports/AdapterConfigPort.h"
#include "Ports/EquipmentAccessPort.h"
#include <fstream>

namespace t3devlib {
  
@@ -52,6 +53,13 @@ namespace t3devlib {
  
  void SAInit()
  {
    static std::ofstream log_file ("mmagic_adapter_log.txt");
    
    // replace the buffer in cout, cerr and clog
    std::cout.rdbuf (log_file.rdbuf());
    std::cerr.rdbuf (log_file.rdbuf());		
    std::clog.rdbuf (log_file.rdbuf());		

    // Do not forget to check for TTCN-3 modele name!!
    Port::RegisterType("AtsImsIot_TestSystem", "DataPort", &createPort<DataPort>);
    Port::RegisterType("LibIot_TestInterface", "EquipmentAccessPort", &createPort<EquipmentAccessPort>);