1
2 # Copyright (c) 2003 The Regents of the University of California.
3 # All rights reserved.
4 #
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are met:
7 #
8 # A. Redistributions of source code must retain the above copyright notice,
9 # this list of conditions and the following disclaimer.
10 # B. Redistributions in binary form must reproduce the above copyright notice,
11 # this list of conditions and the following disclaimer in the documentation
12 # and/or other materials provided with the distribution.
13 # C. Neither the names of the copyright holders nor the names of its
14 # contributors may be used to endorse or promote products derived from this
15 # software without specific prior written permission.
16 #
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
18 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
21 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 #
28 # @(#) $Header: /usr/mash/src/repository/mash/mash-1/tcl/net/relay-simple.tcl,v 1.1 2003/06/03 20:06:46 aswan Exp $
29
30
31 import RelayedNetwork
32
33 Class SessionAddress/SimpleRelay -superclass SessionAddress
34
35 SessionAddress/SimpleRelay instproc init spec {
36 $self next
37
38 $self instvar network_class_ spec_ peers_
39 set network_class_ RelayedNetwork/Simple
40
41 set spec_ $spec
42
43 regsub "relay:(.*)" $spec \\1 spec
44 set peers_ [split $spec ,]
45
46 # XXX make sure each peer is valid?
47 }
48
49 # XXX
50 SessionAddress/SimpleRelay instproc fmt {} { return "" }
51 SessionAddress/SimpleRelay instproc nchan {} { return 1 }
52 SessionAddress/SimpleRelay instproc maxbw {} { return 10000000 }
53 SessionAddress/SimpleRelay instproc addr { {k ""} } { return "XXX" }
54 SessionAddress/SimpleRelay instproc sport { {k ""} } { return "XXX" }
55 SessionAddress/SimpleRelay instproc rport { {k ""} } { return "XXX" }
56 SessionAddress/SimpleRelay instproc ttl { {k ""} } { return "XXX" }
57
58
59 Class RelayedNetwork/Simple -superclass RelayedNetwork
60
61 RelayedNetwork/Simple instproc init args {
62 eval $self next $args
63 }
64
65 RelayedNetwork/Simple instproc reset { ab } {
66 $self close
67
68 foreach peer [$ab set peers_] {
69 puts "adding peer $peer..."
70
71 set L [split $peer /]
72 set addr [lindex $L 0]
73 set port [lindex $L 1]
74
75 if [in_multicast $addr] {
76 puts "no mcast support yet; ignoring $peer"
77 } else {
78 $self add_unicast_peer $addr $port
79 }
80 }
81 }
82
83
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.