« Reply #3 on: July 07, 2011, 02:46:14 am »
also working on DHCP and DNS myself. ran into some issues with the 0021 and 0022 libraries (basically the same). Found an older implementation for DHCP that was completely incompatible with the w5100 support class, and the use of PRIVATE members and functions became too irritating so I went off and cloned it with 'My' prepended on file names so I could fix a few shortcomings.
The one feature missing from the ethernet library that really needs to be there is the ability to EASILY read or write a 'packet chunk'. The OSs I've dealt with (Linux, for example) have the ability to generate packets in 'chunks'. Typically you'll build a portion of the packet then let some other part of the stack finish up its layer, etc. so the packet can essentially be built up by a series of calls to write to the buffer. In the case of the Wiznet 5100 chip, it's got MUCH more buffer space than the 2k or so of RAM the AVR chip has available. So why require building an entire packet in RAM, then copy it into the Wiznet chip? Why not build it in 'chunks'? This works really well, FYI, when dealing with things like DHCP, where you have 200 or so bytes of completely wasted space within the packet. RAM waste on an AVR isn't an option.
I basically added 3 functions that break out the W5100Class::recv_data_processing and W5100Class::send_data_processing functions into a 'begin' 'middle' and 'end' function, where the 'middle' function can be called multiple times. The 'ptr' is preserved by the caller and passed by reference. Implementation is pretty trivial, so no need to clip code. In any case, this SHOULD be added to the W5100Class . And while at it, change 'private' to 'protected' since then you could use a derived class to access 'private' things. ('private' is lame anyway - use 'protected' as a reminder NOT to do things, but don't tie programmer hands, that's just BAD).
Anyway, I've got a version of DHCP working at the moment, cleaning up semi-sloppy code I derived it from, will probably turn it into a superclass of 'EthernetClass' with its own 'begin' method, similar to the one mentioned here in fact. but smaller.