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