next up previous contents index
Next: 29.1.1.0.2 Application Data Handling Up: 29.1.1 Trivial Configuration Previous: 29.1.1 Trivial Configuration

29.1.1.0.1 Creating the Agent

        set ns [new Simulator]          # preamble initialization;
        $ns enableMcast
        set node [$ns node]                # agent to reside on this node;
        set group [$ns allocaddr]           # multicast group for this agent;

        {\bfseries{}set srm [new Agent/SRM]}
        $srm  set dst_ $group            # configure the SRM agent;
        {\bfseries{}$ns attach-agent $node $srm}

        $srm set fid_ 1                # optional configuration;
        $srm log [open srmStats.tr w]   # log statistics in this file;
        $srm trace [open srmEvents.tr w]  # trace events for this agent;
The key steps in configuring a virgin SRM agent are to assign its multicast group, and attach it to a node.

Other useful configuration parameters are to assign a separate flow id to traffic originating from this agent, to open a log file for statistics, and a trace file for trace data 29.1.

The file tcl/mcast/srm-nam.tcl../ns-2/srm-nam.tclAgent/SRM::send contains definitions that overload the agent's send methods; this separates control traffic originating from the agent by type. Each type is allocated a separate flowID. The traffic is separated into session messages (flowid = 40), requests (flowid = 41), and repair messages (flowid = 42). The base flowid can be changed by setting global variable ctrlFid to one less than the desired flowid before sourcing srm-nam.tcl. To do this, the simulation script must source srm-nam.tcl before creating any SRM agents. This is useful for analysis of traffic traces, or for visualization in nam.




2000-08-24