C++ server code

Latest master merged in. We should discuss the layout of the code.
C++ supports C switch case statements, but in this case the results being given by slre_match can't really be put into a switch case, since if you look at lines 22 and 26, the slre_match call actually uses different regexes.