#pragma once
class CIPBridgeImpl;

class _Adapter
{
public:
	_Adapter();
	virtual ~_Adapter();
	void Open(const char *sName,DWORD dwIPFilter,bool bTargetSide);
	void Close();
	bool SendPacket(BYTE *pData,DWORD dwSize);
	bool Process(CIPBridgeImpl *pParent);
	operator ADAPTER *()const {return m_pAdapter;}
	operator const ADAPTER *()const {return m_pAdapter;}
private:
    ADAPTER *m_pAdapter;
	std::string m_sName;
	BYTE *m_pPacketBuf;
	LPPACKET m_pInPacket;
	bool m_bDone;
	DWORD m_dwIPFilter;
	DWORD m_dwIPOffSet;
	DWORD m_dwARPOffSet;
	static bpf_insn m_TargetTamplate[];
	static bpf_insn m_SourceTamplate[];
	bpf_insn *m_pBPFCode;
	bpf_program m_bpfProgram;
	bool m_bTarget;
	DWORD m_dwLastMulticast;
};
