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 <BaseOverlayMessage_m.h>

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;
};

message PastryMessage extends BaseOverlayMessage
{
    fields:
	int pastryMsgType = PASTRY_MSG_STD;
};

message	PastryJoinMessage extends PastryMessage
{
    fields:
	TransportAddress sendStateTo = TransportAddress::UNSPECIFIED_NODE;
	int joinHopCount = 0;
};

message PastryRepairRequestMessage extends PastryMessage
{
    fields:
	TransportAddress sendStateTo = TransportAddress::UNSPECIFIED_NODE;
};

message PastryStateRequestMessage extends PastryMessage
{
    fields:
	TransportAddress sendStateTo = TransportAddress::UNSPECIFIED_NODE;
};

message PastryStateMessage extends PastryMessage
{
    fields:
	int pastryStateMsgType = PASTRY_STATE_STD;
	NodeHandle sender = NodeHandle::UNSPECIFIED_NODE;
	NodeHandle routingTable[];
	NodeHandle leafSet[];
	NodeHandle neighborhoodSet[];
	int joinHopCount = 0;
	bool lastHop = false;
	simtime_t timestamp;
};

message PastryFindNodeExtData extends cMessage
{
    fields:
        TransportAddress sendStateTo = TransportAddress::UNSPECIFIED_NODE;
	int joinHopCount = 0;
};

message PastryNewLeafsMessage extends cMessage
{
    fields:
	NodeHandle leafs[];
};

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