Open hreintke opened 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.
@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
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:
Where that ? :)
https://www.vaugouard.com Nice, relaxed, good food, challenging golf course
@d-a-v Can you take a look at the current implementation ? Not fully tested yet, but close to complete functionality
Thanks! I will test asap
@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:
src/Netdump.h
(renamed to NetDumpDAV.h
) and src/utility
Yours in src/Netdump
Can you properly separate your work
std::bind
?examples/NetDumpTest.cpp
is not arduino-right. examples/Netdump2/Netdump2.ino
would be a good one@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.
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.
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:
you are not working with arduino, so you can't see the directory structure is not arduino compliant:
utility/
utility/
): move files to src/
examples/sketchname/sketchname.ino
(not in examples/theExample.cpp
)macOS FS lets you mix caps letters, linux makes a difference
also:
const type&
when passing complex data structures in parameters (like IPAddress
, NetDumpAddress
, or String
) otherwise they will be copied each time they are passedWhat I propose:
What do you think ?
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).
As used in debugging of MDNS issue