d-a-v / EspGoodies

tcpdump inside esp8266/Arduino and other goodies
13 stars 2 forks source link

Add print of MDNS detail from UDP packet #2

Open hreintke opened 5 years ago

hreintke commented 5 years ago

As used in debugging of MDNS issue

hreintke commented 5 years ago

Yes, Is better and less duplication of code. But I left it like it is because I am writing a PR which would generalize the functionality of netdump and tcpdump, including easy creation of custom callbacks. Working on a Proof of concept, which I hope to show you today or tomorrow.

hreintke commented 5 years ago

@d-a-v : See the netdump_poc. It is very much work in progress but shows the way I am thinking.

All is one file for now, easier for me to develop.

Application should able to : netdump.printDump(Serial); netdump.printDump(Serial, [](NetworkPacket np){ return (np.isIPv4();} netdump.printDump(Serial, [](NetworkPacket np){ return (np.destIP() == IPAddress(10,0,0,217);}

netdump.setcallback([](NetworkPacket np){ .....}

PS : untested runtime just now, compiles OK

hreintke commented 5 years ago

Updates and first tests.

To use this version.

#include "Netdump_poc"

Netdump* Netdump::self;
Netdump np;

np.printDump(Serial);
netdump.printDump(Serial, [](NetworkPacket np){ return (np.isIPv4();}

np.fileDump works also, not very much tested and needs work for better handling of open/close/write files.

tcpDump : Need to include the code from your

I am on a short trip to France until next thursday or friday -> silence from my side :smile:

d-a-v commented 5 years ago

Where that ? :)

hreintke commented 5 years ago

https://www.vaugouard.com Nice, relaxed, good food, challenging golf course

hreintke commented 5 years ago

@d-a-v Can you take a look at the current implementation ? Not fully tested yet, but close to complete functionality

d-a-v commented 5 years ago

Thanks! I will test asap

d-a-v commented 5 years ago

@hreintke I had a look - You changed pretty everything ! - and I'm fine with that, the functional way fits nicely.

I propose several things, you tell me what you think about them:

hreintke commented 5 years ago

@d-a-v Sorry, missed this comment until now.

You changed pretty everything !

I tried to make it as easy as possible for others to use/integrate. in that way it is possible to ask issue submitters to include netdump and report without much trouble

Can we agree on a coding style

Sure, no problem. Do you have an astyle config for your preference. I have the windows version working and can pass everything through that.

My code is in src/Netdump.

I just added my code in a way to evaluate. Please provide the (directory)structure and I will update it to that.

What is your feeling about using lambdas instead of std::bind ?

I learned this week that there is a difference between the two. Did my reading and indeed think it is good to update. Will do

Can you add minimal examples Your examples/NetDumpTest.cpp is not arduino-right

Yes will do, I wanted to wait until you agreed to the implementation, I am using eclipse (sloeber) and only cpp, no ino. Think that just changing .cpp to .ino will do the job but am not 100% sure. Will make .ino examples, please test on your config if they work OK for you too.

d-a-v commented 5 years ago

Sure, no problem. Do you have an astyle config for your preference. I have the windows version working and can pass everything through that.

I took the style we want to be able to integrate in the arduino core.

I did not push its results, but you can and push them if that's OK with you.

Did my reading and indeed think it is good to update. Will do

nice. TBH I'm a less than 1y user of lambas/::bind.

Yes will do, I wanted to wait until you agreed to the implementation,

I'll have a second look (I mainly agree anyway)

Will make .ino examples, please test on your config if they work OK for you too.

I will test that today.

d-a-v commented 5 years ago

Again, this is a complete rewrite. Technically this PR cannot be accepted as is. But it is worth replacing mine because it is more complete and works differently (lambdas, filters, IPv6, mDNS, scheduled functions)

Why it can't be accepted as is:

What I propose:

What do you think ?

hreintke commented 5 years ago

It's the right way forward.,

I will make the updates as you proposed. What is your preference, update espgoodies or netdump repo ?

Will not be next week, I'll be off to France again (Jura).