Add some networking code

Documentation of packet structure is in root