Enhancements for cplusplus based protocol handlers.

I think these would be useful for everyone.
I made these changes to enable cpp to be used as a protocol handler.
I have some cpp classes that I'll look at sharing once they are more fleshed out, if your interested.