File Overlay/PubSubMMOG/PubSubMessage.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 PubSubMessage.msg
// @author Stephan Krause
//

cplusplus {{
#include <CommonMessages_m.h>
#include <Vector2D.h>

static const int PUBSUB_FLAG_L = 8;
static const int PUBSUB_VECTOR_L = 128;
static const int PUBSUB_RESS_L = 32;
static const int PUBSUB_SUBSPACE_L = 32;
static const int PUBSUB_CHILDPOS_L = 16;
static const int PUBSUB_TIMESTAMP_L = 32;

#define PUBSUB_JOINCALL_L(msg) (BASECALL_L(msg) + PUBSUB_VECTOR_L + PUBSUB_RESS_L)
#define PUBSUB_JOINRESPONSE_L(msg) (BASECALL_L(msg) + NODEHANDLE_L)
#define PUBSUB_RESPONSIBLENODECALL_L(msg) (BASECALL_L(msg) + PUBSUB_VECTOR_L)
#define PUBSUB_RESPONSIBLENODERESPONSE_L(msg) (BASECALL_L(msg) + NODEHANDLE_L)
#define PUBSUB_TAKEOVERSUBSPACECALL_L(msg) (BASECALL_L(msg) + PUBSUB_VECTOR_L)
#define PUBSUB_TAKEOVERSUBSPACERESPONSE_L(msg) (BASECALL_L(msg))
#define PUBSUB_SUBSCRIPTIONCALL_L(msg) (BASECALL_L(msg) + PUBSUB_SUBSPACE_L)
#define PUBSUB_SUBSCRIPTIONRESPONSE_L(msg) (BASECALL_L(msg) + PUBSUB_FLAG_L)
#define PUBSUB_UNSUBSCRIPTION_L(msg) (NODEHANDLE_L + PUBSUB_SUBSPACE_L)
#define PUBSUB_HELPCALL_L(msg) (BASECALL_L(msg) + PUBSUB_SUBSPACE_L + PUBSUB_FLAG_L)
#define PUBSUB_HELPRESPONSE_L(msg) (BASECALL_L(msg) + NODEHANDLE_L)
#define PUBSUB_INTERMEDIATECALL_L(msg) (BASECALL_L(msg) + PUBSUB_SUBSPACE_L)
#define PUBSUB_INTERMEDIATERESPONSE_L(msg) (BASECALL_L(msg))
#define PUBSUB_BACKUPCALL_L(msg) (BASECALL_L(msg) + msg->getIntermediatesArraySize()*NODEHANDLE_L + msg->getChildrenArraySize()*(NODEHANDLE_L+PUBSUB_CHILDPOS_L))
#define PUBSUB_BACKUPRESPONSE_L(msg) (BASECALL_L(msg))
#define PUBSUB_PINGCALL_L(msg) (BASECALL_L(msg) + PUBSUB_SUBSPACE_L + PUBSUB_FLAG_L)
#define PUBSUB_PINGRESPONSE_L(msg) (BASECALL_L(msg))
#define PUBSUB_REPLACEMENT_L(msg) (PUBSUB_SUBSPACE_L + NODEHANDLE_L)
#define PUBSUB_FAILEDNODE_L(msg) (IPADDR_L + UDPPORT_L)
#define PUBSUB_NODELEFT_L(msg) (PUBSUB_SUBSPACE_L + NODEHANDLE_L)
#define PUBSUB_ADOPTCHILDCALL_L(msg) (BASECALL_L(msg) + PUBSUB_SUBSPACE_L + NODEHANDLE_L)
#define PUBSUB_ADOPTCHILDRESPONSE_L(msg) (BASECALL_L(msg))
#define PUBSUB_RELEASEINTERMEDIATE_L(msg) (PUBSUB_SUBSPACE_L)
#define PUBSUB_HELPRELEASE_L(msg) (PUBSUB_SUBSPACE_L + NODEHANDLE_L)
#define PUBSUB_BACKUPSUBSCRIPTION_L(msg) (PUBSUB_SUBSPACE_L + NODEHANDLE_L*3)
#define PUBSUB_BACKUPINTERMEDIATE_L(msg) (PUBSUB_SUBSPACE_L + NODEHANDLE_L + PUBSUB_CHILDPOS_L)
#define PUBSUB_BACKUPUNSUBSCRIBE_L(msg) (PUBSUB_SUBSPACE_L + NODEHANDLE_L*2)
#define PUBSUB_MOVE_L(msg) (PUBSUB_SUBSPACE_L + NODEHANDLE_L + PUBSUB_VECTOR_L + PUBSUB_TIMESTAMP_L)
#define PUBSUB_MOVELIST_L(msg) (PUBSUB_SUBSPACE_L + PUBSUB_TIMESTAMP_L + msg->getPlayerArraySize()*(NODEHANDLE_L+PUBSUB_VECTOR_L))

}};

class noncobject NodeHandle;
class noncobject TransportAddress;
class noncobject Vector2D;
class BaseOverlayMessage;
class BaseCallMessage;
class BaseResponseMessage;

enum PubSubTimerType 
{
    PUBSUB_HEARTBEAT = 0;
    PUBSUB_CHILDPING = 1;
    PUBSUB_PARENT_TIMEOUT = 2;
    PUBSUB_TAKEOVER_GRACE_TIME = 3;
    PUBSUB_EVENTDELIVERY = 4;
}

enum PubSubHelpType
{
    PUBSUB_BACKUP = 0;
    PUBSUB_INTERMEDIATE = 1;
}

enum PubSubPingType
{
    PUBSUB_PING_BACKUP = 0;
    PUBSUB_PING_INTERMEDIATE = 1;
    PUBSUB_PING_CHILD = 2;
}

message PubSubTimer {
    fields:
        int type enum(PubSubTimerType);
        int subspaceId;
}

message PubSubJoinCall extends BaseCallMessage {
    fields:
        Vector2D position;
        int ressources;
}

message PubSubJoinResponse extends BaseResponseMessage {
    fields:
        NodeHandle responsibleNode;
        // FIXME: Position's missing
}

message PubSubResponsibleNodeCall extends BaseCallMessage {
    fields:
        Vector2D subspacePos; //FIXME: send subspaceId as int
}

message PubSubResponsibleNodeResponse extends BaseResponseMessage {
    fields:
        int subspaceId; // Not counted in length: could easily be stored locally!
        NodeHandle responsibleNode;
}

message PubSubTakeOverSubspaceCall extends BaseCallMessage {
    fields:
        Vector2D subspacePos; //FIXME: send subspaceId as int
}

message PubSubTakeOverSubspaceResponse extends BaseResponseMessage {
    fields:
        Vector2D subspacePos; //FIXME: send subspaceId as int // Not counted in length: could easily be stored locally!
}

message PubSubSubscriptionCall extends BaseCallMessage {
    fields:
        int subspaceId;
}

message PubSubSubscriptionResponse extends BaseResponseMessage {
    fields:
        bool failed = false;
}

message PubSubUnsubscriptionMessage extends BaseOverlayMessage {
    fields:
        int subspaceId;
        NodeHandle src;
}

message PubSubHelpCall extends BaseCallMessage {
    fields:
        int subspaceId; // Not counted in length: could easily be stored locally!
        int helpType enum(PubSubHelpType);
}

message PubSubHelpResponse extends BaseResponseMessage {
    fields:
        int subspaceId; // Not counted in length: could easily be stored locally!
        int helpType enum(PubSubHelpType); // Not counted in length: could easily be stored locally!
        NodeHandle node;
}

message PubSubIntermediateCall extends BaseCallMessage {
    fields:
        int subspaceId;
}

message PubSubIntermediateResponse extends BaseResponseMessage {
    fields:
        int subspaceId; // Not counted in length: could easily be stored locally!
}

message PubSubBackupCall extends BaseCallMessage {
    fields:
        int subspaceId;
        NodeHandle intermediates[];
        NodeHandle children[];
        int childrenPos[];
}

message PubSubBackupResponse extends BaseResponseMessage {
    fields:
        int subspaceId; // Not counted in length: could easily be stored locally!
}

message PubSubPingCall  extends BaseCallMessage {
    fields:
        int subspaceId;
        int pingType enum(PubSubPingType);
}

message PubSubPingResponse extends BaseResponseMessage {
    fields:
        int subspaceId; // Not counted in length: could easily be stored locally!
}

message PubSubReplacementMessage extends BaseOverlayMessage {
    fields:
        int subspaceId;
        NodeHandle newResponsibleNode;
}

message PubSubFailedNodeMessage extends BaseOverlayMessage {
    fields:
        TransportAddress failedNode;
}

message PubSubNodeLeftMessage extends BaseOverlayMessage {
    fields:
        int subspaceId;
        NodeHandle node;
}

message PubSubAdoptChildCall  extends BaseCallMessage {
    fields:
        int subspaceId;
        NodeHandle child;
}

message PubSubAdoptChildResponse extends BaseResponseMessage {
    fields:
        int subspaceId; // Not counted in length: could easily be stored locally!
        NodeHandle child; // Not counted in length: could easily be stored locally!
}

message PubSubReleaseIntermediateMessage extends BaseOverlayMessage {
    fields:
        int subspaceId;
}

message PubSubHelpReleaseMessage extends BaseOverlayMessage {
    fields:
        int subspaceId;
        NodeHandle node;
}

message PubSubBackupSubscriptionMessage extends BaseOverlayMessage {
    fields:
        int subspaceId;
        NodeHandle child;
        NodeHandle parent;
        NodeHandle oldParent;
}

message PubSubBackupIntermediateMessage extends BaseOverlayMessage {
    fields:
        int subspaceId;
        NodeHandle node;
        int pos;
}

message PubSubBackupUnsubscribeMessage extends BaseOverlayMessage {
    fields:
        int subspaceId;
        NodeHandle child;
        NodeHandle intermediate;
}

message PubSubMoveMessage extends BaseOverlayMessage {
    fields:
        int subspaceId;
        simtime_t timestamp;
        NodeHandle player;
        Vector2D position;
}

message PubSubMoveListMessage extends BaseOverlayMessage {
    fields:
        int subspaceId;
        simtime_t timestamp;
        NodeHandle player[];
        Vector2D position[];
}