File Common/CommonAPIMessages.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.
//

cplusplus {{
#include <OverlayKey.h>
#include <IPvXAddress.h>
#include <NodeHandle.h>
#include <BinaryValue.h>
#include <BaseOverlayMessage_m.h>
}};

class CommonAPIMessage;
class noncobject NodeHandle;
class noncobject OverlayKey;
class noncobject IPvXAddress;
class noncobject BinaryValue;
class noncobject BaseOverlayMessage;
class noncobject BaseRpcMessage;
class noncobject BaseCallMessage;
class noncobject BaseResponseMessage;


enum CommonAPIMessageType
{
	KBR_ROUTE = 0;
	KBR_DELIVER = 1;
	KBR_FORWARD = 2;
	KBR_FORWARD_RESPONSE = 3;
	KBR_UPDATE = 4;
	DHT_PUT = 5;	
	DHT_PUT_RESPONSE = 6;	
	DHT_GET = 7;
	DHT_GET_RESPONSE = 8;	
	DHT_REMOVE = 9;
	DHT_REMOVE_RESPONSE = 10;
	COMMON_API_UNDEFINED = 99;
};

//
// @author Bernhard Heep
//
// Base class for all common API message types
//
message CommonAPIMessage
{
    fields:	
	int type enum(CommonAPIMessageType) = COMMON_API_UNDEFINED;  // message type	
};

//
// @author Bernhard Heep
//
// Message type for KBR route calls 
//
message KBRroute extends CommonAPIMessage
{
    fields:
	OverlayKey destKey; // the destination key
	NodeHandle hint;    // first hop, usually unspecified
};

//
// @author Bernhard Heep
//
// Message type for KBR forward calls
//
message KBRforward extends CommonAPIMessage
{
    fields:
	OverlayKey destKey;     // the destination key
	NodeHandle nextHopNode; // the proposed/changed next hop node
};

//
// @author Bernhard Heep
//
// Message type for information sent from the overlay to the application
//
message KBRdeliver extends CommonAPIMessage
{
    fields:
	OverlayKey destKey; // destination overlay key
};

//
// @author Bernhard Heep
//
// Message type to inform overlay nodes about new or left nodes
//
message KBRupdate extends CommonAPIMessage
{
    fields:
	NodeHandle node; // the node that has joined or left the overlay
	bool joined; // true if node has joined, false if node has left
};

//
// @author Ingmar Baumgart
//
// Message type to store value at the keys root 
//
message DHTputCAPICall extends BaseCallMessage
{
	fields:
		OverlayKey key; // overlayKey that corresponds with value
		BinaryValue value; // value that has to be stored on keys root
		int ttl; // time to life
    bool isModifiable;
};

//
// @author Ingmar Baumgart
//
// Message type to order the value corresponding to the OverlayKey key from the node responsible of key
//
message DHTgetCAPICall extends BaseCallMessage
{
	fields:
		OverlayKey key; // corresponding OverlayKey to the requested value 
};

//
// @author Ingmar Baumgart
//
// Message type to respond to a DHTput request @see DHTput
//
message DHTputCAPIResponse extends BaseResponseMessage
{
	fields:
		OverlayKey key; // 
		BinaryValue value; // the value for which this node is root now
    bool isSuccess;
};

//
// @author Ingmar Baumgart
//
// Message type to respond to a DHTget request @see DHTget
//
message DHTgetCAPIResponse extends BaseResponseMessage
{
	fields:
		OverlayKey key; // 
		BinaryValue value; // the requested value
    bool isSuccess;
};

//
// @author Ingmar Baumgart
//
message LookupCall extends BaseCallMessage {
	fields:
		OverlayKey key;
		int numSiblings;
};

//
// @author Ingmar Baumgart
//
message LookupResponse extends BaseResponseMessage {
	fields:
		OverlayKey key;
		bool isValid;		
        	NodeHandle siblings[];   // set of siblings
};


//
// @author Bernhard Heep
//
// Control info for sending/receiving data via overlay Network. Travels between
// application and overlay.
//
class OverlayCtrlInfo
{
    fields:
	IPvXAddress lastHopAddr; // IP address of last hop node
	int lastHopPort;         // UDP port of last hop node

	//NodeHandle thisNode;     // local IP/port/nodeID (DEPRECATED!!!)
	NodeHandle srcNode;      // the message's source node IP/port/nodeID

	int hopCount = 0;        // hop count
};