File Overlay/Broose/BrooseMessage.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 Jochen Schenk
//

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

// constants for message length in bit
static const int FAILEDREPONSES_L = 8;
static const int RTT_L = 8;
static const int LASTSEEN_L = 8;
static const int INDEX_L = 8;
static const int BUCKETTYPE_L = 2;
static const int PROTOSTATE_L = 2;
static const int STEP_L = 8;
static const int RIGHTSHIFTING_L = 1;
static const int NODENUM_L = 8;

//todo add Broose message length
#define BROOSEHANDLE_L (NODEHANDLE_L + FAILEDRESPONSES_L + RTT_L + LASTSEEN_L)

#define BUCKETCALL_L(msg) (BASECALL_L(msg) + INDEX_L + BUCKETTYPE_L + PROTOSTATE_L)
#define BUCKETRESPONSE_L(msg) (BASERESPONSE_L(msg) + INDEX_L + BUCKETTYPE_L + PROTOSTATE_L \
	                       + NODENUM_L + msg->getNodesArraySize() * NODEHANDLE_L)

#define BROOSEPINGCALL_L(msg) PINGCALL_L(msg)
#define BROOSEPINGRESPONSE_L(msg) PINGRESPONSE_L(msg)

#define BROOSEFINDNODEEXTMESSAGE_L (KEY_L + STEP_L + RIGHTSHIFTING_L + NODEHANDLE_L)

}};

class noncobject IPvXAddress;
class noncobject NodeHandle;
class BaseOverlayMessage;
class noncobject OverlayKey;
class BaseCallMessage;
class BaseResponseMessage;	
class PingCall;
class PingResponse;

enum ServiceType
{
    REQUEST = 0;
    RESPONSE = 1;
};

enum BucketType
{
    RIGHT = 0;
    LEFT = 1;
    BROTHER = 2;
};

enum ProState
{
    PINIT = 0;
    PRSET = 1;
    PBSET = 2;
    PREADY = 3;
};

//
// requests a bucket from the destination node
//
message BucketCall extends BaseCallMessage
{
   fields:
        int bucketType enum(BucketType);    // identifies the type of the bucket
        int bucketIndex;    // the index of the bucket
        int proState enum(ProState);    // the protocol overlay state
};

//
// response message to a BucketCall 
//
message BucketResponse extends BaseResponseMessage
{
   fields:
       int bucketType enum(BucketType);    // identifies the type of the bucket
       int bucketIndex;    // the index of the bucket
       int nodeNum;    // number of nodes in the bucket
       NodeHandle nodes[];    // array of nodes in the bucket
       int proState enum(ProState);    // the protocol overlay state

};
//
// a ping message to check if destination node is answering
//
message BroosePingCall extends BaseCallMessage
{
};

//
// response message to a BroosePingCall
//
message BroosePingResponse extends BaseResponseMessage
{
};

//
// message to lookup up an overlay node
//
message BrooseFindNodeExtMessage
{
    fields:
        OverlayKey routeKey;    // overlay node to route the message to 
        int step;    
        bool rightShifting;    // true if message belongs to a rightshift lookup
        NodeHandle lastNode;    // last node that handled this message
        int length;    // message length
};