From: marko Date: Mon, 4 Jul 2005 21:27:47 +0000 (+0000) Subject: Initial import X-Git-Tag: initial~4 X-Git-Url: https://git.entuzijast.net/?a=commitdiff_plain;h=a2fd6aefa71ae79fde027e5cd3e65446897895dd;p=imunes.git Initial import --- diff --git a/lanswitch.tcl b/lanswitch.tcl new file mode 100755 index 0000000..e5f8c98 --- /dev/null +++ b/lanswitch.tcl @@ -0,0 +1,53 @@ +# +# Copyright 2005 University of Zagreb, Croatia. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by the University of Zagreb, +# Croatia and its contributors. +# 4. Neither the name of the University nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# This work was supported in part by Croatian Ministry of Science +# and Technology through the research contract #IP-2003-143. +# + + +proc lanswitch.instantiate { eid node } { + catch {exec ngctl mkpeer bridge anchor anchor | tail -1} resp + foreach elem [split [lindex [split $resp "\{\}"] 1]] { + if {[string equal -length 5 $elem "id=0x"]} { + set id [string range $elem 5 end] + catch {exec ngctl name \[$id\]: "$eid\_$node"} + } + } + return +} + + +proc lanswitch.nghook { eid node ifc } { + set ifunit [string range $ifc 1 end] + return [list $eid\_$node link$ifunit] +} +