mirror of
https://github.com/overte-org/overte.git
synced 2025-04-07 12:53:44 +02:00
replace PacketType declarations with PacketType::Value
This commit is contained in:
parent
5ed332ea2c
commit
0d64e82fe2
36 changed files with 57 additions and 57 deletions
|
@ -56,7 +56,7 @@ void Agent::readPendingDatagrams() {
|
|||
|
||||
while (readAvailableDatagram(receivedPacket, senderSockAddr)) {
|
||||
if (nodeList->packetVersionAndHashMatch(receivedPacket)) {
|
||||
PacketType datagramPacketType = packetTypeForPacket(receivedPacket);
|
||||
PacketType::Value datagramPacketType = packetTypeForPacket(receivedPacket);
|
||||
|
||||
if (datagramPacketType == PacketTypeJurisdiction) {
|
||||
int headerBytes = numBytesForPacketHeader(receivedPacket);
|
||||
|
|
|
@ -535,7 +535,7 @@ void AudioMixer::readPendingDatagram(const QByteArray& receivedPacket, const Hif
|
|||
|
||||
if (nodeList->packetVersionAndHashMatch(receivedPacket)) {
|
||||
// pull any new audio data from nodes off of the network stack
|
||||
PacketType mixerPacketType = packetTypeForPacket(receivedPacket);
|
||||
PacketType::Value mixerPacketType = packetTypeForPacket(receivedPacket);
|
||||
if (mixerPacketType == PacketTypeMicrophoneAudioNoEcho
|
||||
|| mixerPacketType == PacketTypeMicrophoneAudioWithEcho
|
||||
|| mixerPacketType == PacketTypeInjectAudio
|
||||
|
|
|
@ -50,7 +50,7 @@ AvatarAudioStream* AudioMixerClientData::getAvatarAudioStream() const {
|
|||
}
|
||||
|
||||
int AudioMixerClientData::parseData(const QByteArray& packet) {
|
||||
PacketType packetType = packetTypeForPacket(packet);
|
||||
PacketType::Value packetType = packetTypeForPacket(packet);
|
||||
if (packetType == PacketTypeAudioStreamStats) {
|
||||
|
||||
const char* dataAt = packet.data();
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
OctreeQueryNode(),
|
||||
_lastDeletedEntitiesSentAt(0) { }
|
||||
|
||||
virtual PacketType getMyPacketType() const { return PacketTypeEntityData; }
|
||||
virtual PacketType::Value getMyPacketType() const { return PacketTypeEntityData; }
|
||||
|
||||
quint64 getLastDeletedEntitiesSentAt() const { return _lastDeletedEntitiesSentAt; }
|
||||
void setLastDeletedEntitiesSentAt(quint64 sentAt) { _lastDeletedEntitiesSentAt = sentAt; }
|
||||
|
|
|
@ -28,11 +28,11 @@ public:
|
|||
// Subclasses must implement these methods
|
||||
virtual OctreeQueryNode* createOctreeQueryNode();
|
||||
virtual char getMyNodeType() const { return NodeType::EntityServer; }
|
||||
virtual PacketType getMyQueryMessageType() const { return PacketTypeEntityQuery; }
|
||||
virtual PacketType::Value getMyQueryMessageType() const { return PacketTypeEntityQuery; }
|
||||
virtual const char* getMyServerName() const { return MODEL_SERVER_NAME; }
|
||||
virtual const char* getMyLoggingServerTargetName() const { return MODEL_SERVER_LOGGING_TARGET_NAME; }
|
||||
virtual const char* getMyDefaultPersistFilename() const { return LOCAL_MODELS_PERSIST_FILE; }
|
||||
virtual PacketType getMyEditNackType() const { return PacketTypeEntityEditNack; }
|
||||
virtual PacketType::Value getMyEditNackType() const { return PacketTypeEntityEditNack; }
|
||||
virtual QString getMyDomainSettingsKey() const { return QString("entity_server_settings"); }
|
||||
|
||||
// subclass may implement these method
|
||||
|
|
|
@ -90,7 +90,7 @@ void OctreeInboundPacketProcessor::processPacket(const SharedNodePointer& sendin
|
|||
|
||||
|
||||
// Ask our tree subclass if it can handle the incoming packet...
|
||||
PacketType packetType = packetTypeForPacket(packet);
|
||||
PacketType::Value packetType = packetTypeForPacket(packet);
|
||||
if (_myServer->getOctree()->handlesEditPacketType(packetType)) {
|
||||
PerformanceWarning warn(debugProcessPacket, "processPacket KNOWN TYPE",debugProcessPacket);
|
||||
_receivedPacketCount++;
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
virtual ~OctreeQueryNode();
|
||||
|
||||
void init(); // called after creation to set up some virtual items
|
||||
virtual PacketType getMyPacketType() const = 0;
|
||||
virtual PacketType::Value getMyPacketType() const = 0;
|
||||
|
||||
void resetOctreePacket(); // resets octree packet to after "V" header
|
||||
|
||||
|
@ -155,7 +155,7 @@ private:
|
|||
|
||||
quint64 _lastRootTimestamp;
|
||||
|
||||
PacketType _myPacketType;
|
||||
PacketType::Value _myPacketType;
|
||||
bool _isShuttingDown;
|
||||
|
||||
SentPacketHistory _sentPacketHistory;
|
||||
|
|
|
@ -862,7 +862,7 @@ void OctreeServer::readPendingDatagram(const QByteArray& receivedPacket, const H
|
|||
|
||||
if (!_isShuttingDown) {
|
||||
if (nodeList->packetVersionAndHashMatch(receivedPacket)) {
|
||||
PacketType packetType = packetTypeForPacket(receivedPacket);
|
||||
PacketType::Value packetType = packetTypeForPacket(receivedPacket);
|
||||
SharedNodePointer matchingNode = nodeList->sendingNodeForPacket(receivedPacket);
|
||||
if (packetType == getMyQueryMessageType()) {
|
||||
// If we got a query packet, then we're talking to an agent, and we
|
||||
|
|
|
@ -63,11 +63,11 @@ public:
|
|||
// Subclasses must implement these methods
|
||||
virtual OctreeQueryNode* createOctreeQueryNode() = 0;
|
||||
virtual char getMyNodeType() const = 0;
|
||||
virtual PacketType getMyQueryMessageType() const = 0;
|
||||
virtual PacketType::Value getMyQueryMessageType() const = 0;
|
||||
virtual const char* getMyServerName() const = 0;
|
||||
virtual const char* getMyLoggingServerTargetName() const = 0;
|
||||
virtual const char* getMyDefaultPersistFilename() const = 0;
|
||||
virtual PacketType getMyEditNackType() const = 0;
|
||||
virtual PacketType::Value getMyEditNackType() const = 0;
|
||||
virtual QString getMyDomainSettingsKey() const { return QString("octree_server_settings"); }
|
||||
|
||||
// subclass may implement these method
|
||||
|
|
|
@ -43,7 +43,7 @@ void OctreeServerDatagramProcessor::readPendingDatagrams() {
|
|||
_nodeSocket.readDatagram(incomingPacket.data(), incomingPacket.size(),
|
||||
senderSockAddr.getAddressPointer(), senderSockAddr.getPortPointer());
|
||||
|
||||
PacketType packetType = packetTypeForPacket(incomingPacket);
|
||||
PacketType::Value packetType = packetTypeForPacket(incomingPacket);
|
||||
if (packetType == PacketTypePing) {
|
||||
DependencyManager::get<NodeList>()->processNodeData(senderSockAddr, incomingPacket);
|
||||
return; // don't emit
|
||||
|
|
|
@ -1390,7 +1390,7 @@ void DomainServer::processDatagram(const QByteArray& receivedPacket, const HifiS
|
|||
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
||||
|
||||
if (nodeList->packetVersionAndHashMatch(receivedPacket)) {
|
||||
PacketType requestType = packetTypeForPacket(receivedPacket);
|
||||
PacketType::Value requestType = packetTypeForPacket(receivedPacket);
|
||||
switch (requestType) {
|
||||
case PacketTypeDomainConnectRequest:
|
||||
handleConnectRequest(receivedPacket, senderSockAddr);
|
||||
|
|
|
@ -54,7 +54,7 @@ void IceServer::processDatagrams() {
|
|||
_serverSocket.readDatagram(incomingPacket.data(), incomingPacket.size(),
|
||||
sendingSockAddr.getAddressPointer(), sendingSockAddr.getPortPointer());
|
||||
|
||||
PacketType packetType = packetTypeForPacket(incomingPacket);
|
||||
PacketType::Value packetType = packetTypeForPacket(incomingPacket);
|
||||
|
||||
if (packetType == PacketTypeIceServerHeartbeat) {
|
||||
SharedNetworkPeer peer = addOrUpdateHeartbeatingPeer(incomingPacket);
|
||||
|
|
|
@ -2729,7 +2729,7 @@ int Application::sendNackPackets() {
|
|||
return packetsSent;
|
||||
}
|
||||
|
||||
void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
|
||||
void Application::queryOctree(NodeType_t serverType, PacketType::Value packetType, NodeToJurisdictionMap& jurisdictions) {
|
||||
|
||||
//qCDebug(interfaceapp) << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView();
|
||||
bool wantExtraDebugging = getLogger()->extraDebugging();
|
||||
|
|
|
@ -511,7 +511,7 @@ private:
|
|||
|
||||
void renderLookatIndicator(glm::vec3 pointOfInterest);
|
||||
|
||||
void queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions);
|
||||
void queryOctree(NodeType_t serverType, PacketType::Value packetType, NodeToJurisdictionMap& jurisdictions);
|
||||
void loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum);
|
||||
|
||||
glm::vec3 getSunDirection();
|
||||
|
|
|
@ -52,7 +52,7 @@ void DatagramProcessor::processDatagrams() {
|
|||
|
||||
if (nodeList->packetVersionAndHashMatch(incomingPacket)) {
|
||||
|
||||
PacketType incomingType = packetTypeForPacket(incomingPacket);
|
||||
PacketType::Value incomingType = packetTypeForPacket(incomingPacket);
|
||||
// only process this packet if we have a match on the packet version
|
||||
switch (incomingType) {
|
||||
case PacketTypeAudioEnvironment:
|
||||
|
|
|
@ -33,7 +33,7 @@ void OctreePacketProcessor::processPacket(const SharedNodePointer& sendingNode,
|
|||
bool wasStatsPacket = false;
|
||||
|
||||
|
||||
PacketType voxelPacketType = packetTypeForPacket(mutablePacket);
|
||||
PacketType::Value voxelPacketType = packetTypeForPacket(mutablePacket);
|
||||
|
||||
// note: PacketType_OCTREE_STATS can have PacketType_VOXEL_DATA
|
||||
// immediately following them inside the same packet. So, we process the PacketType_OCTREE_STATS first
|
||||
|
|
|
@ -844,7 +844,7 @@ void AudioClient::handleAudioInput() {
|
|||
glm::quat headOrientation = _orientationGetter();
|
||||
quint8 isStereo = _isStereoInput ? 1 : 0;
|
||||
|
||||
PacketType packetType;
|
||||
PacketType::Value packetType;
|
||||
if (_lastInputLoudness == 0) {
|
||||
packetType = PacketTypeSilentAudioFrame;
|
||||
} else {
|
||||
|
|
|
@ -98,7 +98,7 @@ void InboundAudioStream::perSecondCallbackForUpdatingStats() {
|
|||
|
||||
int InboundAudioStream::parseData(const QByteArray& packet) {
|
||||
|
||||
PacketType packetType = packetTypeForPacket(packet);
|
||||
PacketType::Value packetType = packetTypeForPacket(packet);
|
||||
QUuid senderUUID = uuidFromPacketHeader(packet);
|
||||
|
||||
// parse header
|
||||
|
|
|
@ -43,8 +43,8 @@ public:
|
|||
virtual ~EntityTreeRenderer();
|
||||
|
||||
virtual char getMyNodeType() const { return NodeType::EntityServer; }
|
||||
virtual PacketType getMyQueryMessageType() const { return PacketTypeEntityQuery; }
|
||||
virtual PacketType getExpectedPacketType() const { return PacketTypeEntityData; }
|
||||
virtual PacketType::Value getMyQueryMessageType() const { return PacketTypeEntityQuery; }
|
||||
virtual PacketType::Value getExpectedPacketType() const { return PacketTypeEntityData; }
|
||||
virtual void renderElement(OctreeElement* element, RenderArgs* args);
|
||||
virtual float getSizeScale() const;
|
||||
virtual int getBoundaryLevelAdjust() const;
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
// These methods will allow the OctreeServer to send your tree inbound edit packets of your
|
||||
// own definition. Implement these to allow your octree based server to support editing
|
||||
virtual bool getWantSVOfileVersions() const { return true; }
|
||||
virtual PacketType expectedDataPacketType() const { return PacketTypeEntityData; }
|
||||
virtual PacketType::Value expectedDataPacketType() const { return PacketTypeEntityData; }
|
||||
virtual bool canProcessVersion(PacketVersion thisVersion) const
|
||||
{ return thisVersion >= VERSION_ENTITIES_USE_METERS_AND_RADIANS; }
|
||||
virtual bool handlesEditPacketType(PacketType packetType) const;
|
||||
|
|
|
@ -31,8 +31,8 @@ public:
|
|||
virtual ~EntityTreeHeadlessViewer();
|
||||
|
||||
virtual char getMyNodeType() const { return NodeType::EntityServer; }
|
||||
virtual PacketType getMyQueryMessageType() const { return PacketTypeEntityQuery; }
|
||||
virtual PacketType getExpectedPacketType() const { return PacketTypeEntityData; }
|
||||
virtual PacketType::Value getMyQueryMessageType() const { return PacketTypeEntityQuery; }
|
||||
virtual PacketType::Value getExpectedPacketType() const { return PacketTypeEntityData; }
|
||||
|
||||
void update();
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ Assignment::Assignment(const QByteArray& packet) :
|
|||
_payload(),
|
||||
_walletUUID()
|
||||
{
|
||||
PacketType packetType = packetTypeForPacket(packet);
|
||||
PacketType::Value packetType = packetTypeForPacket(packet);
|
||||
|
||||
if (packetType == PacketTypeRequestAssignment) {
|
||||
_command = Assignment::RequestCommand;
|
||||
|
|
|
@ -164,12 +164,12 @@ void LimitedNodeList::changeSocketBufferSizes(int numBytes) {
|
|||
}
|
||||
|
||||
bool LimitedNodeList::packetVersionAndHashMatch(const QByteArray& packet) {
|
||||
PacketType checkType = packetTypeForPacket(packet);
|
||||
PacketType::Value checkType = packetTypeForPacket(packet);
|
||||
int numPacketTypeBytes = numBytesArithmeticCodingFromBuffer(packet.data());
|
||||
|
||||
if (packet[numPacketTypeBytes] != versionForPacketType(checkType)
|
||||
&& checkType != PacketTypeStunResponse) {
|
||||
PacketType mismatchType = packetTypeForPacket(packet);
|
||||
PacketType::Value mismatchType = packetTypeForPacket(packet);
|
||||
|
||||
static QMultiMap<QUuid, PacketType> versionDebugSuppressMap;
|
||||
|
||||
|
@ -254,7 +254,7 @@ qint64 LimitedNodeList::writeDatagram(const QByteArray& datagram,
|
|||
const SharedNodePointer& destinationNode,
|
||||
const HifiSockAddr& overridenSockAddr) {
|
||||
if (destinationNode) {
|
||||
PacketType packetType = packetTypeForPacket(datagram);
|
||||
PacketType::Value packetType = packetTypeForPacket(datagram);
|
||||
|
||||
if (NON_VERIFIED_PACKETS.contains(packetType)) {
|
||||
return writeUnverifiedDatagram(datagram, destinationNode, overridenSockAddr);
|
||||
|
@ -316,7 +316,7 @@ qint64 LimitedNodeList::writeUnverifiedDatagram(const QByteArray& datagram, cons
|
|||
}
|
||||
}
|
||||
|
||||
PacketType packetType = packetTypeForPacket(datagram);
|
||||
PacketType::Value packetType = packetTypeForPacket(datagram);
|
||||
|
||||
// optionally peform sequence number replacement in the header
|
||||
if (SEQUENCE_NUMBERED_PACKETS.contains(packetType)) {
|
||||
|
@ -351,7 +351,7 @@ qint64 LimitedNodeList::writeUnverifiedDatagram(const char* data, qint64 size, c
|
|||
return writeUnverifiedDatagram(QByteArray(data, size), destinationNode, overridenSockAddr);
|
||||
}
|
||||
|
||||
PacketSequenceNumber LimitedNodeList::getNextSequenceNumberForPacket(const QUuid& nodeUUID, PacketType packetType) {
|
||||
PacketSequenceNumber LimitedNodeList::getNextSequenceNumberForPacket(const QUuid& nodeUUID, PacketType::Value packetType) {
|
||||
// Thanks to std::map and std::unordered_map this line either default constructs the
|
||||
// PacketTypeSequenceMap and the PacketSequenceNumber or returns the existing value.
|
||||
// We use the postfix increment so that the stored value is incremented and the next
|
||||
|
@ -376,7 +376,7 @@ int LimitedNodeList::updateNodeWithDataFromPacket(const SharedNodePointer& match
|
|||
|
||||
// if this was a sequence numbered packet we should store the last seq number for
|
||||
// a packet of this type for this node
|
||||
PacketType packetType = packetTypeForPacket(packet);
|
||||
PacketType::Value packetType = packetTypeForPacket(packet);
|
||||
if (SEQUENCE_NUMBERED_PACKETS.contains(packetType)) {
|
||||
matchingNode->setLastSequenceNumberForPacketType(sequenceNumberFromHeader(packet, packetType), packetType);
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ QByteArray LimitedNodeList::constructPingReplyPacket(const QByteArray& pingPacke
|
|||
quint64 timeFromOriginalPing;
|
||||
pingPacketStream >> timeFromOriginalPing;
|
||||
|
||||
PacketType replyType = (packetTypeForPacket(pingPacket) == PacketTypePing)
|
||||
PacketType::Value replyType = (packetTypeForPacket(pingPacket) == PacketTypePing)
|
||||
? PacketTypePingReply : PacketTypeUnverifiedPingReply;
|
||||
|
||||
QUuid packetUUID = packetHeaderID.isNull() ? _sessionUUID : packetHeaderID;
|
||||
|
|
|
@ -120,9 +120,9 @@ public:
|
|||
|
||||
// QByteArray byteArrayWithPopulatedHeader(PacketType packetType)
|
||||
// { return byteArrayWithUUIDPopulatedHeader(packetType, _sessionUUID); }
|
||||
// int populatePacketHeader(QByteArray& packet, PacketType packetType)
|
||||
// int populatePacketHeader(QByteArray& packet, PacketType::Value packetType)
|
||||
// { return populatePacketHeaderWithUUID(packet, packetType, _sessionUUID); }
|
||||
// int populatePacketHeader(char* packet, PacketType packetType)
|
||||
// int populatePacketHeader(char* packet, PacketType::Value packetType)
|
||||
// { return populatePacketHeaderWithUUID(packet, packetType, _sessionUUID); }
|
||||
|
||||
qint64 readDatagram(QByteArray& incomingPacket, QHostAddress* address, quint16 * port);
|
||||
|
@ -266,7 +266,7 @@ protected:
|
|||
|
||||
qint64 writeDatagram(const QByteArray& datagram, const HifiSockAddr& destinationSockAddr);
|
||||
|
||||
PacketSequenceNumber getNextSequenceNumberForPacket(const QUuid& nodeUUID, PacketType packetType);
|
||||
PacketSequenceNumber getNextSequenceNumberForPacket(const QUuid& nodeUUID, PacketType::Value packetType);
|
||||
|
||||
void changeSocketBufferSizes(int numBytes);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
void setCanRez(bool canRez) { _canRez = canRez; }
|
||||
bool getCanRez() { return _canRez; }
|
||||
|
||||
void setLastSequenceNumberForPacketType(PacketSequenceNumber sequenceNumber, PacketType packetType)
|
||||
void setLastSequenceNumberForPacketType(PacketSequenceNumber sequenceNumber, PacketType::Value packetType)
|
||||
{ _lastSequenceNumbers[packetType] = sequenceNumber; }
|
||||
PacketSequenceNumber getLastSequenceNumberForPacketType(PacketType packetType) const;
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ void NodeList::timePingReply(const QByteArray& packet, const SharedNodePointer&
|
|||
}
|
||||
|
||||
void NodeList::processNodeData(const HifiSockAddr& senderSockAddr, const QByteArray& packet) {
|
||||
PacketType packetType = packetTypeForPacket(packet);
|
||||
PacketType::Value packetType = packetTypeForPacket(packet);
|
||||
switch (packetType) {
|
||||
case PacketTypeDomainList:
|
||||
case PacketTypeDomainServerAddedNode: {
|
||||
|
@ -309,7 +309,7 @@ void NodeList::sendDomainServerCheckIn() {
|
|||
} else if (!_domainHandler.getIP().isNull()) {
|
||||
bool isUsingDTLS = false;
|
||||
|
||||
PacketType domainPacketType = !_domainHandler.isConnected()
|
||||
PacketType::Value domainPacketType = !_domainHandler.isConnected()
|
||||
? PacketTypeDomainConnectRequest : PacketTypeDomainListRequest;
|
||||
|
||||
if (!_domainHandler.isConnected()) {
|
||||
|
@ -600,7 +600,7 @@ void NodeList::parseNodeFromPacketStream(QDataStream& packetStream) {
|
|||
|
||||
void NodeList::sendAssignment(Assignment& assignment) {
|
||||
|
||||
PacketType assignmentPacketType = assignment.getCommand() == Assignment::CreateCommand
|
||||
PacketType::Value assignmentPacketType = assignment.getCommand() == Assignment::CreateCommand
|
||||
? PacketTypeCreateAssignment
|
||||
: PacketTypeRequestAssignment;
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
// NOTE: if adding a new packet packetType, you can replace one marked usable or add at the end
|
||||
// NOTE: if you want the name of the packet packetType to be available for debugging or logging, update nameForPacketType() as well
|
||||
|
||||
namespace PacketType {
|
||||
namespace PacketType::Value {
|
||||
enum Value {
|
||||
Unknown, // 0
|
||||
StunResponse,
|
||||
|
@ -126,7 +126,7 @@ int sequenceNumberOffsetForPacketType(PacketType::Value packetType);
|
|||
QByteArray hashFromPacketHeader(const QByteArray& packet);
|
||||
QByteArray hashForPacketAndConnectionUUID(const QByteArray& packet, const QUuid& connectionUUID);
|
||||
|
||||
// NOTE: The following four methods accept a PacketType which defaults to PacketType::Unknown.
|
||||
// NOTE: The following four methods accept a PacketType::Value which defaults to PacketType::Unknown.
|
||||
// If the caller has already looked at the packet type and can provide it then the methods below won't have to look it up.
|
||||
|
||||
PacketSequenceNumber sequenceNumberFromHeader(const QByteArray& packet, PacketType::Value packetType = PacketType::Unknown);
|
||||
|
|
|
@ -25,7 +25,7 @@ public:
|
|||
qint64 satoshiCost = 0, const QUuid nodeUUID = QUuid());
|
||||
|
||||
QUuid _nodeUUID;
|
||||
PacketType _currentType;
|
||||
PacketType::Value _currentType;
|
||||
unsigned char _currentBuffer[MAX_PACKET_SIZE];
|
||||
size_t _currentSize;
|
||||
qint64 _satoshiCost;
|
||||
|
|
|
@ -1936,7 +1936,7 @@ bool Octree::readSVOFromStream(unsigned long streamLength, QDataStream& inputStr
|
|||
|
||||
bool wantImportProgress = true;
|
||||
|
||||
PacketType expectedType = expectedDataPacketType();
|
||||
PacketType::Value expectedType = expectedDataPacketType();
|
||||
PacketVersion expectedVersion = versionForPacketType(expectedType);
|
||||
bool hasBufferBreaks = versionHasSVOfileBreaks(expectedVersion);
|
||||
|
||||
|
@ -1954,7 +1954,7 @@ bool Octree::readSVOFromStream(unsigned long streamLength, QDataStream& inputStr
|
|||
unsigned long dataLength = HEADER_LENGTH;
|
||||
|
||||
// if so, read the first byte of the file and see if it matches the expected version code
|
||||
PacketType gotType;
|
||||
PacketType::Value gotType;
|
||||
memcpy(&gotType, dataAt, sizeof(gotType));
|
||||
|
||||
dataAt += sizeof(expectedType);
|
||||
|
@ -2097,7 +2097,7 @@ void Octree::writeToJSONFile(const char* fileName, OctreeElement* element) {
|
|||
}
|
||||
|
||||
// include the "bitstream" version
|
||||
PacketType expectedType = expectedDataPacketType();
|
||||
PacketType::Value expectedType = expectedDataPacketType();
|
||||
PacketVersion expectedVersion = versionForPacketType(expectedType);
|
||||
entityDescription["Version"] = (int) expectedVersion;
|
||||
|
||||
|
@ -2118,7 +2118,7 @@ void Octree::writeToSVOFile(const char* fileName, OctreeElement* element) {
|
|||
if(file.is_open()) {
|
||||
qCDebug(octree, "Saving binary SVO to file %s...", fileName);
|
||||
|
||||
PacketType expectedType = expectedDataPacketType();
|
||||
PacketType::Value expectedType = expectedDataPacketType();
|
||||
PacketVersion expectedVersion = versionForPacketType(expectedType);
|
||||
bool hasBufferBreaks = versionHasSVOfileBreaks(expectedVersion);
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ public:
|
|||
// These methods will allow the OctreeServer to send your tree inbound edit packets of your
|
||||
// own definition. Implement these to allow your octree based server to support editing
|
||||
virtual bool getWantSVOfileVersions() const { return false; }
|
||||
virtual PacketType expectedDataPacketType() const { return PacketTypeUnknown; }
|
||||
virtual PacketType::Value expectedDataPacketType() const { return PacketTypeUnknown; }
|
||||
virtual bool canProcessVersion(PacketVersion thisVersion) const {
|
||||
return thisVersion == versionForPacketType(expectedDataPacketType()); }
|
||||
virtual PacketVersion expectedVersion() const { return versionForPacketType(expectedDataPacketType()); }
|
||||
|
|
|
@ -327,7 +327,7 @@ void OctreeEditPacketSender::releaseQueuedPacket(EditPacketBuffer& packetBuffer)
|
|||
_releaseQueuedPacketMutex.unlock();
|
||||
}
|
||||
|
||||
void OctreeEditPacketSender::initializePacket(EditPacketBuffer& packetBuffer, PacketType type, int nodeClockSkew) {
|
||||
void OctreeEditPacketSender::initializePacket(EditPacketBuffer& packetBuffer, PacketType::Value type, int nodeClockSkew) {
|
||||
packetBuffer._currentSize =
|
||||
DependencyManager::get<NodeList>()->populatePacketHeader(reinterpret_cast<char*>(&packetBuffer._currentBuffer[0]), type);
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ protected:
|
|||
void queuePacketToNode(const QUuid& nodeID, unsigned char* buffer, size_t length, qint64 satoshiCost = 0);
|
||||
void queuePendingPacketToNodes(PacketType type, unsigned char* buffer, size_t length, qint64 satoshiCost = 0);
|
||||
void queuePacketToNodes(unsigned char* buffer, size_t length, qint64 satoshiCost = 0);
|
||||
void initializePacket(EditPacketBuffer& packetBuffer, PacketType type, int nodeClockSkew);
|
||||
void initializePacket(EditPacketBuffer& packetBuffer, PacketType::Value type, int nodeClockSkew);
|
||||
void releaseQueuedPacket(EditPacketBuffer& packetBuffer); // releases specific queued packet
|
||||
|
||||
void processPreServerExistsPackets();
|
||||
|
|
|
@ -33,7 +33,7 @@ void OctreeHeadlessViewer::init() {
|
|||
|
||||
void OctreeHeadlessViewer::queryOctree() {
|
||||
char serverType = getMyNodeType();
|
||||
PacketType packetType = getMyQueryMessageType();
|
||||
PacketType::Value packetType = getMyQueryMessageType();
|
||||
NodeToJurisdictionMap& jurisdictions = *_jurisdictionListener->getJurisdictions();
|
||||
|
||||
bool wantExtraDebugging = false;
|
||||
|
|
|
@ -42,7 +42,7 @@ typedef quint64 OCTREE_PACKET_SENT_TIME;
|
|||
typedef uint16_t OCTREE_PACKET_INTERNAL_SECTION_SIZE;
|
||||
const int MAX_OCTREE_PACKET_SIZE = MAX_PACKET_SIZE;
|
||||
|
||||
// this is overly conservative - sizeof(PacketType) is 8 bytes but a packed PacketType could be as small as one byte
|
||||
// this is overly conservative - sizeof(PacketType) is 8 bytes but a packed PacketType::Value could be as small as one byte
|
||||
const unsigned int OCTREE_PACKET_EXTRA_HEADERS_SIZE = sizeof(OCTREE_PACKET_FLAGS)
|
||||
+ sizeof(OCTREE_PACKET_SEQUENCE) + sizeof(OCTREE_PACKET_SENT_TIME);
|
||||
|
||||
|
|
|
@ -62,10 +62,10 @@ void OctreeRenderer::processDatagram(const QByteArray& dataByteArray, const Shar
|
|||
PerformanceWarning warn(showTimingDetails, "OctreeRenderer::processDatagram()",showTimingDetails);
|
||||
|
||||
unsigned int packetLength = dataByteArray.size();
|
||||
PacketType command = packetTypeForPacket(dataByteArray);
|
||||
PacketType::Value command = packetTypeForPacket(dataByteArray);
|
||||
unsigned int numBytesPacketHeader = numBytesForPacketHeader(dataByteArray);
|
||||
QUuid sourceUUID = uuidFromPacketHeader(dataByteArray);
|
||||
PacketType expectedType = getExpectedPacketType();
|
||||
PacketType::Value expectedType = getExpectedPacketType();
|
||||
// packetVersion is the second byte
|
||||
PacketVersion packetVersion = dataByteArray[1];
|
||||
|
||||
|
|
|
@ -36,8 +36,8 @@ public:
|
|||
virtual ~OctreeRenderer();
|
||||
|
||||
virtual char getMyNodeType() const = 0;
|
||||
virtual PacketType getMyQueryMessageType() const = 0;
|
||||
virtual PacketType getExpectedPacketType() const = 0;
|
||||
virtual PacketType::Value getMyQueryMessageType() const = 0;
|
||||
virtual PacketType::Value getExpectedPacketType() const = 0;
|
||||
virtual void renderElement(OctreeElement* element, RenderArgs* args) = 0;
|
||||
virtual float getSizeScale() const { return DEFAULT_OCTREE_SIZE_SCALE; }
|
||||
virtual int getBoundaryLevelAdjust() const { return 0; }
|
||||
|
|
Loading…
Reference in a new issue