Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

register_allocator new protocol #370

Open
taegyo opened this issue Oct 2, 2019 · 0 comments
Open

register_allocator new protocol #370

taegyo opened this issue Oct 2, 2019 · 0 comments

Comments

@taegyo
Copy link

taegyo commented Oct 2, 2019

i attemp to add new protocol for capture goose packet. (tutorial part. 7)
but not recoginize pdu. / Windows 10 , 64bit

test code.
i used dummypdu template class on tutorial.

int main()
{
Allocators::register_allocator<EthernetII, DummyPDU>(0x88b8);

Packet packet;
NetworkInterface iface = NetworkInterface::default_interface();
Sniffer sniffer(iface.name());
while (1)
{
	packet = sniffer.next_packet();
	if (packet)
	{
		if (packet.pdu()->find_pdu<DummyPDU>())
		{
			const DummyPDU &dummy = packet.pdu()->rfind_pdu<DummyPDU>(); // non-const works as well
			std::string payload(dummy.get_buffer().begin(), dummy.get_buffer().end());
			std::cout << "Payload: " << payload << std::endl;
		}

	}
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant