181 lines
4.8 KiB
C++
181 lines
4.8 KiB
C++
|
|
#include "JoinConfirm.h"
|
|
|
|
#include "Dispatcher.h"
|
|
#include "common/validator/MessageValidator.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
/**
|
|
* @brief Constructor
|
|
*/
|
|
JoinConfirm::JoinConfirm() : ExteriorMessage("JC", JC) { }
|
|
|
|
/**
|
|
* @brief Copy constructor
|
|
* @param other The instance to copy.
|
|
*/
|
|
JoinConfirm::JoinConfirm(const JoinConfirm& other) : ExteriorMessage(other) {
|
|
operator=(other);
|
|
}
|
|
|
|
/**
|
|
* @brief Destructor.
|
|
*/
|
|
JoinConfirm::~JoinConfirm() { }
|
|
|
|
/**
|
|
* @brief Assignment operator
|
|
* @param other The instance to assign
|
|
* @return a reference to this instance
|
|
*/
|
|
JoinConfirm& JoinConfirm::operator=( const JoinConfirm& other) {
|
|
|
|
if (this == &other) return *this;
|
|
ExteriorMessage::operator=(other);
|
|
|
|
inviterTa = other.inviterTa;
|
|
invitationID = other.invitationID;
|
|
jcMessage = other.jcMessage;
|
|
peerDescription = other.peerDescription;
|
|
resources = other. resources;
|
|
|
|
return *this;
|
|
}
|
|
|
|
/**
|
|
* @brief Copy operation. Creates a copy of the current instance.
|
|
* @return A reference to the local instance.
|
|
*/
|
|
JoinConfirm *
|
|
JoinConfirm::dup() const {
|
|
return new JoinConfirm(*this);
|
|
}
|
|
|
|
/**
|
|
* @brief Handles this message. To handle a message, it has first successfully validated.
|
|
* @param dis A reference to the dispatcher, used to forward this message to the handling modules.
|
|
*/
|
|
void
|
|
JoinConfirm::handleReceive( Dispatcher& dis) {
|
|
// @TODO whuuuuut?
|
|
#if ! OMNETPP
|
|
setSource(from());
|
|
#endif
|
|
if( dis.getMessageValidator()->isValid( *this)) {
|
|
dis.getMembershipService().handleJoinConfirm(this);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @brief Gets the invitationID
|
|
* @return the InvitationID
|
|
*/
|
|
const InvitationID &
|
|
JoinConfirm::getInvitationID() const {
|
|
return invitationID;
|
|
}
|
|
|
|
/**
|
|
* @brief Sets the invitationID
|
|
* @param invitationID The invitationId to be set
|
|
*/
|
|
void
|
|
JoinConfirm::setInvitationID( const InvitationID& invitationID) {
|
|
this->invitationID = invitationID;
|
|
}
|
|
|
|
/**
|
|
* @brief Gets the JoinConfirm message
|
|
* @return the message
|
|
*/
|
|
const std::string&
|
|
JoinConfirm::getJcMessage() const {
|
|
return jcMessage;
|
|
}
|
|
|
|
/**
|
|
* @brief Sets the Joinconfirm message
|
|
* @param jcMessage The message to be set
|
|
*/
|
|
void
|
|
JoinConfirm::setJcMessage( const std::string& jcMessage) {
|
|
this->jcMessage = jcMessage;
|
|
}
|
|
|
|
/**
|
|
* @brief Gets the PeerDescription
|
|
* @return the peerdescription
|
|
*/
|
|
const PeerDescription&
|
|
JoinConfirm::getPeerDescription() const {
|
|
return peerDescription;
|
|
}
|
|
|
|
/**
|
|
* @brief Sets the PeerDescription
|
|
* @param peerDescription The peerdescription to be set
|
|
*/
|
|
void
|
|
JoinConfirm::setPeerDescription(const PeerDescription& peerDescription) {
|
|
this->peerDescription = peerDescription;
|
|
}
|
|
|
|
/**
|
|
* @brief Gets the inviter transport address.
|
|
* @returns The inviter transport address
|
|
*/
|
|
const TransportAddress &
|
|
JoinConfirm::getInviterTa() const {
|
|
return inviterTa;
|
|
}
|
|
|
|
/**
|
|
* @brief Sets the transport address of the inviter
|
|
* @param ta The transport address to set
|
|
*/
|
|
void
|
|
JoinConfirm::setInviterTa(const TransportAddress & ta) {
|
|
inviterTa = ta;
|
|
}
|
|
|
|
/**
|
|
* @brief Permits access to the resource value of the peer.
|
|
* @return The resource value of the peer.
|
|
*/
|
|
const PeerResources &
|
|
JoinConfirm::getPeerResources() const {
|
|
return resources;
|
|
}
|
|
|
|
/**
|
|
* @brief Sets the resources of the peer.
|
|
* @param resources A generic representation of the peer resources.
|
|
*/
|
|
void
|
|
JoinConfirm::setResources(const PeerResources & resources) {
|
|
this->resources = resources;
|
|
}
|
|
|
|
/**
|
|
* @brief Archive method
|
|
* @param archive The archive to which the attributes are to add
|
|
*/
|
|
void
|
|
JoinConfirm::set(Archive & archive) {
|
|
|
|
ExteriorMessage::set(archive);
|
|
|
|
archive(inviterTa);
|
|
archive(invitationID);
|
|
archive(jcMessage);
|
|
archive(invitationID);
|
|
archive(resources);
|
|
|
|
archive(peerDescription);
|
|
}
|
|
}
|
|
}
|
|
|