File Overlay/Vast/Vast.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.
//

// @file Vast.msg
// @author Helge Backhaus
//

cplusplus {{
#include <NodeHandle.h>
#include <OverlayKey.h>
#include <BaseOverlayMessage_m.h>

// constants for message length in bit
static const int VASTCOMMAND_L = 8;
static const int POSITION_L = 128;
static const int ENTRYCOUNT_L = 32;
static const int FLAG_L = 8;

static const int SIMPLECLIENTCOMMAND_L = 8;

#define VAST_L(msg) (BASEOVERLAY_L(msg) + VASTCOMMAND_L + NODEHANDLE_L + KEY_L + POSITION_L)
#define VASTLIST_L(msg) (VAST_L(msg) + ENTRYCOUNT_L + msg->getEntry_count() * (NODEHANDLE_L + POSITION_L))
#define VASTMOVE_L(msg) (VAST_L(msg) + POSITION_L + FLAG_L)
#define VASTDISCARD_L(msg) (VAST_L(msg) + NODEHANDLE_L)

#define SIMPLECLIENT_L(msg) (BASEOVERLAY_L(msg) + SIMPLECLIENTCOMMAND_L)
#define SIMPLECLIENTLIST_L(msg) (SIMPLECLIENT_L(msg) + 2 * ENTRYCOUNT_L + msg->getRemove_entry_count() * NODEHANDLE_L + msg->getAdd_entry_count * (NODEHANDLE_L + POSITION_L))
#define SIMPLECLIENTMOVE_L(msg) (SIMPLECLIENT_L(msg) + POSITION_L)
}};

class noncobject NodeHandle;
class noncobject OverlayKey;
class BaseOverlayMessage;

enum VASTCommand
{
    JOIN_REQUEST = 0;
    JOIN_ACKNOWLEDGE = 1;
    NODE_MOVE = 2;
    NEW_NEIGHBORS = 3;
    NODE_LEAVE = 4;
    ENCLOSING_NEIGHBORS_REQUEST = 5;
    PING = 6;
    PONG = 7;
    DISCARD_NODE = 8;
};

enum SimpleClientCommand
{
    MOVE_INDICATION = 0;
    MOVE_REQUEST = 1;
    UPDATE_NEIGHBORS = 2;
    OVERLAY_READY = 3;
};

message VastMessage extends BaseOverlayMessage // JOIN_REQUEST, ENCLOSING_NEIGHBORS_REQUEST, PING, PONG
{
    fields:
        int command enum(VASTCommand);
        NodeHandle sourceNode;
        OverlayKey destKey;
        double posX;
        double posY;
};

message VastListMessage extends VastMessage // JOIN_ACKNOWLEDGE, NEW_NEIGHBORS, NODE_LEAVE
{
    fields:
        int entry_count;
        NodeHandle neighborNode[];
        double neighbor_posX[];
        double neighbor_posY[];
};

message VastMoveMessage extends VastMessage // NODE_MOVE
{
    fields:
        double new_posX;
        double new_posY;
        bool is_boundary;
};

message VastDiscardMessage extends VastMessage // DISCARD_NODE
{
    fields:
        NodeHandle discardNode;
}


message SimpleClientMessage extends BaseOverlayMessage // MOVE_REQUEST, OVERLAY_READY
{
    fields:
        int command enum(SimpleClientCommand);
};

message SimpleClientListMessage extends SimpleClientMessage // UPDATE_NEIGHBORS
{
    fields:
        int remove_entry_count;
        NodeHandle remove_neighbor[];
        int add_entry_count;
        NodeHandle add_neighbor[];
        double add_neighbor_posX[];
        double add_neighbor_posY[];
};

message SimpleClientMoveMessage extends SimpleClientMessage // MOVE_INDICATION
{
    fields:
        double posX;
        double posY;
};