• Welcome to Valhalla Legends Archive.
 

Reading packets

Started by MoNksBaNe_Agahnim, February 01, 2004, 06:37 PM

Previous topic - Next topic

iago

Quote from: Kp on February 03, 2004, 08:54 AM
Quote from: TheMinistered on February 02, 2004, 10:36 PM
whereas, in c++ you have polymorphism (which is very nice)

I agree, but even in C++, not everyone uses that for packetbuffers.  I find the extra casting more annoying than just modifying the names slightly -- insertdw, insertw, insertb, etc.  It can go either way, but it's usually made clear by context.

I actually do both, and use whichever suits the situation better.  If I am doing a constant, I do this:
.insertByte(0xFF);
.insertByte(0x0F);
.insertWord(0x20);
..etc.
But when I have variable, I tend to just use insert:
.insertByte(0xFF);
.insert(bCode);
.insert(wLength);
..etc.


It's really personal taste, though.  I have a Java and a C++ packetbuffer on my computer, and I'm pretty sure I posted them somewheres.  If you want a link, let me know :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


clamothe

That'd be great :)  I searched on these fourms, but couldn't find anything.

Twin_One1

Just overload the += operator too :P