File Overlay/Pastry/PastryMessage.msg

Contains:

//
// Copyright (C) 2006 Institut fuer Telematik, Universitaet Karlsruhe (TH)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//

//
// @author Felix Palmen
//

cplusplus {{
#include <IPvXAddress.h>
#include <NodeHandle.h>
#include <OverlayKey.h>
#include <CommonMessages_m.h>

// constants for message length in bit
static const int PASTRYTYPE_L = 8;
static const int PASTRYSTATETYPE_L = 8;

#define TRANSPORTADDRESS_L (IPADDR_L + UDPPORT_L)

#define PASTRY_L(msg) (BASEOVERLAY_L(msg) + PASTRYTYPE_L)
#define PASTRYJOIN_L(msg) (PASTRY_L(msg) + TRANSPORTADDRESS_L + sizeof(int))
#define PASTRYRREQ_L(msg) (PASTRY_L(msg) + TRANSPORTADDRESS_L)
#define PASTRYSREQ_L(msg) (PASTRY_L(msg) + TRANSPORTADDRESS_L)
#define PASTRYSTATE_L(msg) (PASTRY_L(msg) + TRANSPORTADDRESS_L \
		+ NODEHANDLE_L * \
		(msg->getRoutingTableArraySize() + msg->getLeafSetArraySize() \
		+ msg->getNeighborhoodSetArraySize()) + 8 * sizeof(int) + \
		8 * sizeof(bool) + 8 * sizeof(simtime_t))
static const int PASTRYFINDNODEEXTDATA_L = NODEHANDLE_L + 8 * sizeof(int);
#define PASTRYNEWLEAFS_L(msg) (msg->getLeafsArraySize() * NODEHANDLE_L)

}};

class noncobject IPvXAddress;
class noncobject TransportAddress;
class noncobject NodeHandle;
class noncobject OverlayKey;
class BaseOverlayMessage;
class BaseCallMessage;
class BaseResponseMessage;
class BaseAppDataMessage;

enum PastryMsgType
{
    PASTRY_MSG_STD = 0;
    PASTRY_MSG_JOIN = 1;
    PASTRY_MSG_STATE = 2;
    PASTRY_MSG_RREQ = 3;
    PASTRY_MSG_SREQ = 4;
};

enum PastryStateMsgType
{
    PASTRY_STATE_STD = 0;
    PASTRY_STATE_JOIN = 1;
    PASTRY_STATE_UPDATE = 2;
    PASTRY_STATE_REPAIR = 3;
};

//
// Base message for all messages used by Pastry
//
message PastryMessage extends BaseOverlayMessage
{
    fields:
        int pastryMsgType = PASTRY_MSG_STD;    // the PastryMsgType
};

//
// Message used to join a pastry overlay
//
message PastryJoinMessage extends PastryMessage
{
    fields:
        TransportAddress sendStateTo = TransportAddress::UNSPECIFIED_NODE;    // TransportAddress of the node that wants to join
        int joinHopCount = 0;    // counts the hops this message takes
};

//
// Message used to request a repair
//
message PastryRepairRequestMessage extends PastryMessage
{
    fields:
        TransportAddress sendStateTo = TransportAddress::UNSPECIFIED_NODE;    // TransportAddress of the node that requests the repair
};

//
// Message used to request a PastryState
//
message PastryStateRequestMessage extends PastryMessage
{
    fields:
        TransportAddress sendStateTo = TransportAddress::UNSPECIFIED_NODE;    // TransportAddress of the node that requests the state
};

//
// Message used to send a PastryState
//
message PastryStateMessage extends PastryMessage
{
    fields:
        int pastryStateMsgType = PASTRY_STATE_STD;    // the type of the PastryStateMessage
        NodeHandle sender = NodeHandle::UNSPECIFIED_NODE;    // NodeHandle of the node sending this message
        NodeHandle routingTable[];    // the routingTable of the sender
        NodeHandle leafSet[];    // the leafSet of the sender
        NodeHandle neighborhoodSet[];    // the neighborhoodSet of the sender
        int joinHopCount = 0;    // counts the hops this message takes
        bool lastHop = false;    // is this node the destination node?
        simtime_t timestamp;    // simTime when sending this message
};

//
// Message used to find a Pastry node
//
message PastryFindNodeExtData extends cMessage
{
    fields:
        TransportAddress sendStateTo = TransportAddress::UNSPECIFIED_NODE;    // the sender of this message
        int joinHopCount = 0;    // counts the hops this message takes
};

//
// Message used to inform about new PastryLeafs
//
message PastryNewLeafsMessage extends cMessage
{
    fields:
        NodeHandle leafs[];    // the new PastryLeafs
};


message PastrySendState extends cMessage
{
    fields:
        TransportAddress dest = TransportAddress::UNSPECIFIED_NODE;
};