File Overlay/Pastry/Pastry.ned

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.
//

//
// The main module of the Pastry implementation
//
// @author Felix Palmen
//
simple Pastry

    parameters:
        keyLength: numeric,             // length of Overlay Key
        localPort: numeric,             // UDP port for Pastry messages
        debugOutput: bool,              // enable debug output
        measureNetwInitPhase: bool,     // gather statistics when bootstrapping
        hopCountMax: numeric,           // maximum number of overlay hops
        joinOnApplicationRequest: bool, // only join the overlay on application
                                        // request
        drawOverlayTopology: bool,      // draw arrow to successor node?
        iterativeLookup: bool,          // do iterative instead of recursive
                                        // lookups
        collectPerHopDelay : bool,      // delay statistics for single hops
        lookupRedundantNodes : numeric, // number of next hops in each step
        lookupParallelPaths : numeric,  // number of parallel paths
        lookupParallelRpcs : numeric,   // number of nodes to ask in parallel
        lookupSecure : bool,            // true, if all nodes should be
                                        // identified with a ping
        lookupMerge : bool,             // true, if parallel Rpc results should
                                        // be merged
        lookupFailedNodeRpcs : bool,    // communicate failed nodes
	    enableNewLeafs : bool,		    // enable Pastry API call newLeafs()
        useCommonAPIforward : bool,     // enable forwarding of routeMessages to
                                        // app before routing them
        useNextHopRpc : bool,           // use RPCs for route messages                                
	    optimizeLookup : bool,		    // whether to search the closest node
					                    // in findCloserNode() calls
	    optimisticForward : bool,	    // forward message immediately in
					                    // recursive mode, otherwise ping first
	    avoidDuplicates : bool,		    // when node seems unreachable but msg
					                    // already sent, do not retry
	    partialJoinPath : bool,		    // allow join even with missing state
					                    // message along the routing path
	    bitsPerDigit: numeric,		    // bits per Pastry digit
	    numberOfLeaves: numeric,	    // number of entries in leaf set
	    numberOfNeighbors: numeric,	    // number of entries in neighborhoot set
	    joinTimeout: numeric,		    // seconds to wait for STATE message
					                    // from closest node
	    readyWait: numeric,		        // seconds to wait for missing state
					                    // messages in JOIN phase
	    secondStageWait: numeric,	    // how long to wait before starting
					                    // second stage of init phase
	    pingCacheExpireTime: numeric,	// maximum number of seconds rtt for
					                    // a node is cached
	    repairTimeout: numeric,		    // how long to wait for repair messages
	    ringCheckInterval: numeric,	    // check direct neighbors on the ring
					                    // every x seconds (0 to disable)
	    sendStateWaitAmount: numeric,	// how long to wait when sending state
					                    // tables delayed (should be very small)
	    pingTimeout: numeric,		    // how long to wait for PING reply
	    pingRetries: numeric,		    // how often to retry PING after
					                    // timeout
        useRegularNextHop: bool,
        alwaysSendUpdate: bool,
        coordBasedRouting: bool,        // use coord-based routing
        numCoordDigits: numeric,        // numbner of digits used for
                                        // coord-based routing
        CBRstartAtDigit: numeric,       // start at this digit using CBR 
        CBRstopAtDigit: numeric;        // stop at this digit using CBR

    gates:
        in: from_udp[];                 // gate from the UDP layer
        out: to_udp[];                  // gate to the UDP layer
        in: from_app;                   // gate from the application
        out: to_app;                    // gate to the application
        in: direct_in;                  // gate for sendDirect
endsimple

//
// This module contains the routing table of the Pastry implementation.
//
// @author Felix Palmen
//
simple PastryRoutingTable
endsimple

//
// This module contains the leaf set of the Pastry implementation.
//
// @author Felix Palmen
//
simple PastryLeafSet
endsimple

//
// This module contains the neighborhood set of the Pastry implementation.
//
// @author Felix Palmen
//
simple PastryNeighborhoodSet
endsimple

//
// Implementation of the Pastry KBR overlay as described in
// "Pastry: Scalable, Decentralized Object Location, and 
// Routing for Large-Scale Peer-to-Peer Systems" 
// by Antony Rowstron and Peter Druschel, published in 
// Lecture Notes in Computer Science, volume 2218.
//
// @author Felix Palmen
//
module PastryModules

    parameters:
        keyLength: numeric,              // length of Overlay Key
        localPort: numeric,              // UDP port for Pastry messages
        debugOutput: bool,               // enable debug output
        // only join the overlay on application request
        joinOnApplicationRequest: bool,
        useNextHopRpc : bool,
        iterativeLookup: bool,          // do iterative instead of recursive
                                        // lookups
        useCommonAPIforward : bool,     // enable forwarding of routeMessages to
                                        // app before routing them                                
         
        lookupRedundantNodes: numeric,   // number of next hops in each step
        lookupParallelPaths: numeric,    // number of parallel paths
        lookupParallelRpcs: numeric,     // number of nodes to ask in parallel
        // true, if all nodes should be identified with a ping
        lookupSecure: bool,
        // true, if parallel Rpc results should be merged    
        lookupMerge: bool,    
        lookupFailedNodeRpcs: bool,      // communicate failed nodes

        measureNetwInitPhase: bool,      // gather statistics when bootstrapping
        collectPerHopDelay : bool,       // delay statistics for single hops
        hopCountMax: numeric,            // maximum number of overlay hops
        drawOverlayTopology: bool;       // draw arrow to successor node?

    gates:
        in: from_udp;   // gate from the UDP layer
        out: to_udp;    // gate to the UDP layer
        in: from_app;   // gate from the application
        out: to_app;    // gate to the application

    submodules:
        pastry: Pastry;
            parameters:
                keyLength = keyLength,     // length of Overlay Key
                localPort = localPort,     // UDP port for Pastry messages
                debugOutput = debugOutput, // enable debug output
                // only join the overlay on application request
                joinOnApplicationRequest = joinOnApplicationRequest, 
                useNextHopRpc = useNextHopRpc,
                // do iterative instead of recursive lookups
                iterativeLookup = iterativeLookup,
                // enable forwarding of routeMessages to app before routing them     
                useCommonAPIforward = useCommonAPIforward,   
                // number of next hops in each step  
                lookupRedundantNodes = lookupRedundantNodes,    
                // number of parallel paths
                lookupParallelPaths = lookupParallelPaths,  
                // number of nodes to ask in parallel  
                lookupParallelRpcs = lookupParallelRpcs,
                // true, if all nodes should be identified with a ping    
                lookupSecure = lookupSecure,  
                // true, if parallel Rpc results should be merged  
                lookupMerge = lookupMerge,    
                // communicate failed nodes
                lookupFailedNodeRpcs = lookupFailedNodeRpcs,    
                // gather statistics when bootstrapping
                measureNetwInitPhase = measureNetwInitPhase,
                // delay statistics for single hops    
                collectPerHopDelay = collectPerHopDelay,
                // maximum number of overlay hops    
                hopCountMax = hopCountMax,    
                // draw arrow to successor node?
                drawOverlayTopology = drawOverlayTopology;    
            display: "p=60,52;i=block/circle";
    pastryRoutingTable: PastryRoutingTable;
        display: "p=140,68;i=block/table";
    pastryLeafSet: PastryLeafSet;
        display: "p=220,52;i=block/table";
    pastryNeighborhoodSet: PastryNeighborhoodSet;
        display: "p=300,68;i=block/table";

    connections nocheck:
        from_udp --> pastry.from_udp++;
        to_udp <-- pastry.to_udp++;
        from_app --> pastry.from_app;
        to_app <-- pastry.to_app;

endmodule