⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ssmmcast.tcl

📁 ssm multicast extension for ns-2
💻 TCL
字号:
## tcl/ssm-mcast/SSMMcast.tcl## Copyright (C) 1997 by USC/ISI# All rights reserved.## Redistribution and use in source and binary forms are permitted# provided that the above copyright notice and this paragraph are# duplicated in all such forms and that any documentation, advertising# materials, and other materials related to such distribution and use# acknowledge that the software was developed by the University of# Southern California, Information Sciences Institute.  The name of the# University may not be used to endorse or promote products derived from# this software without specific prior written permission.## THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.## Contributed by Polly Huang (USC/ISI), http://www-scf.usc.edu/~bhuang## Contributed by Tiago Camilo (DEI/UC)Class SSMMcast -superclass McastProtocolSSMMcast instproc init { sim node } {	$self next $sim $node	$self instvar ns_ node_	$self instvar agent_ defaultTree_ decapagent_	set agent_ [$ns_ set MrtHandle_]	set defaultTree_ "SPT"	set decapagent_ [new Agent/Decapsulator]	$ns_ attach-agent $node_ $decapagent_}#desejo de um nó pertencer a um determinado grupoSSMMcast instproc join-group  { group src } {	if { $src == "" } {		puts "Warning in SSM Protocol you need to specifie the Source"		puts "i.e: node(1) join-group Rcvr Group Source"		$src "asdasd"#TODO: colocar aki um return de forma a não realizar o join	}	$self next $group	$self instvar node_ ns_ agent_	$self instvar defaultTree_	if { [$agent_ new-source-group? $src $group] == "" } {		$agent_ treetype $group $defaultTree_		$agent_ add-new-source-group $group $src	}	$agent_ add-new-member $group $node_ $src	$agent_ compute-branch $src $group $node_}SSMMcast instproc leave-group  { group src } {	$self next $group	$self instvar node_ ns_ agent_ defaultTree_	if { $src == "" } {		puts "Warning in SSM Protocol you need to specifie the Source"		puts "i.e: node(1) leave-group Rcvr Group Source"	}	$agent_ remove-member $group $node_ $src		$agent_ prune-branch $src $group $node_}SSMMcast instproc handle-cache-miss { srcID group iface } {	$self instvar ns_ agent_ node_	$self instvar defaultTree_		set src [$ns_ get-node-by-id $srcID]	if { [$agent_ new-source-group? $src $group] == "" } {		$agent_ treetype $group $defaultTree_	}	if { [$node_ id] == $srcID } {		if [$agent_ new-source? $group $node_ $srcID] {			$agent_ compute-tree $node_ $group		}	} elseif [SessionSim set MixMode_] {	    set srcnode [$ns_ get-node-by-id $srcID]	    if [$agent_ new-source? $group $srcnode $srcID] {		$agent_ compute-tree $srcnode $group	    }	}	return 1 ;#call again}SSMMcast instproc drop  { replicator src group iface } {	#packets got dropped only due to null oiflist}SSMMcast instproc handle-wrong-iif { srcID group iface } {	warn "$self: $proc for <S: $srcID, G: $group, if: $iface>?"	return 0 ;#call once}SSMMcast instproc notify { dummy } {}##################### MultiNode: add-mfc-reg ################Node instproc add-mfc-reg { src group iif oiflist } {	$self instvar multiclassifier_ Regreplicator_	#XXX node addr is in upper 24 bits	if [info exists Regreplicator_($group)] {		foreach oif $oiflist {			$Regreplicator_($group) insert $oif		}		return 1	}	set r [new Classifier/Replicator/Demuxer]	$r set node_ $self	$r set srcID_ $src	set Regreplicator_($group) $r	foreach oif $oiflist {		$r insert $oif	}	# Install the replicator.  We do this only once and leave	# it forever.  Since prunes are data driven, we want to	# leave the replicator in place even when it's empty since	# the replicator::drop callback triggers the prune.	#	$multiclassifier_ add-rep $r $src $group $iif}Node instproc getRegreplicator group {	$self instvar Regreplicator_	if [info exists Regreplicator_($group)] {		return $Regreplicator_($group)	} else {		return -1	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -