diff --git a/p2p/DestinationId.cxx b/p2p/DestinationId.cxx index 2781f590a..afe79d681 100644 --- a/p2p/DestinationId.cxx +++ b/p2p/DestinationId.cxx @@ -89,6 +89,13 @@ DestinationId::operator==(const DestinationId& nid) const return false; } +s2c::DestinationStruct* +DestinationId::copyDestinationStruct() const +{ + return new s2c::DestinationStruct(*this); +} + + /* ====================================================================== diff --git a/p2p/DestinationId.hxx b/p2p/DestinationId.hxx index 9c1899cfa..aa3ee84d3 100644 --- a/p2p/DestinationId.hxx +++ b/p2p/DestinationId.hxx @@ -27,6 +27,8 @@ class DestinationId : private s2c::DestinationStruct bool operator==(const NodeId& nid) const; bool operator==(const DestinationId& nid) const; + + s2c::DestinationStruct* copyDestinationStruct() const; }; } diff --git a/p2p/Message.cxx b/p2p/Message.cxx index d8e7bed94..465e4769c 100644 --- a/p2p/Message.cxx +++ b/p2p/Message.cxx @@ -252,11 +252,19 @@ Message::parse(const resip::Data &message) void Message::copyForwardingData(const Message &header) { - mPDU.mHeader->mOverlay = header.mPDU.mHeader->mOverlay; - mPDU.mHeader->mTransactionId = header.mPDU.mHeader->mTransactionId; + assert(header.isRequest()); + mPDU.mHeader->mOverlay = header.mPDU.mHeader->mOverlay; + mPDU.mHeader->mTransactionId = header.mPDU.mHeader->mTransactionId; + + assert(mPDU.mHeader->mDestinationList.empty()); + std::vector::reverse_iterator i; + for (i=header.mPDU.mHeader->mViaList.rbegin(); i!=header.mPDU.mHeader->mViaList.rend(); ++i) + { + DestinationStruct* ds = new DestinationStruct(**i); + mPDU.mHeader->mDestinationList.push_back(ds); + } } - void Message::decrementTTL() { @@ -442,11 +450,19 @@ Message::event() } void -Message::pushVia(NodeId id) +Message::pushVia(const DestinationId& did) { - assert(0); + assert(!did.isResourceId()); + mPDU.mHeader->mViaList.push_back(did.copyDestinationStruct()); } +void +Message::pushDestinationId(const DestinationId& did) +{ + mPDU.mHeader->mDestinationList.push_back(did.copyDestinationStruct()); +} + + /* ====================================================================== * Copyright (c) 2008, Various contributors to the Resiprocate project * All rights reserved. diff --git a/p2p/Message.hxx b/p2p/Message.hxx index 2b816eda8..73008a227 100644 --- a/p2p/Message.hxx +++ b/p2p/Message.hxx @@ -107,7 +107,8 @@ class Message : public Signable UInt32 getOverlay() const; UInt64 getTransactionId() const; UInt16 getFlags() const; - void pushVia(NodeId node); + void pushVia(const DestinationId& node); + void pushDestinationId(const DestinationId& did); NodeId getResponseNodeId() const; // pull this from the via list