packet serializer/unserializer for ruby