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.tcl,v 1.1 2003/06/03 20:06:46 aswan Exp $
29
30
31 #
32 # RelayedNetwork and RelayedNetPort are split classes
33 # defined mostly in C++. They provide a simple way to
34 # implement application-level (or peer-to-peer) multicast.
35 # The RelayedNetwork class can be used in exactly the
36 # same way as the NetworkManager class that joins an
37 # rtp (or ssm, etc.) session via regular IPv4 UDP sockets.
38 #
39 # These classes provide the basic packet forwarding
40 # services needed for application-level multicast but
41 # no particular policy for constructing an
42 # application-level multicast tree. Such logic must
43 # be implemented in a subclass of RelayedNetwork.
44 # For an example, see the RelayedNetwork/Simple class
45 # in which the multicast tree is statically specified
46 # by the user when the application is run.
47 #
48 # XXX caveat hacker
49 # This code is likely to change dramatically so don't
50 # make any assumptions about the packet formats or
51 # programming interfaces remaining as they are now...
52 #
53
54 RelayedNetPort instproc init { network portno } {
55 $self next
56 $self setup $network $portno
57 }
58
59 RelayedNetwork instproc init { spec session agent } {
60 $self instvar session_ agent_ nchan_ data_port_ ctrl_port_
61
62 $self next
63 set session_ $session
64 set agent_ $agent
65
66 #XXX
67 set nchan_ 1
68 $agent_ set_maxchannel 1
69
70 $self reset $spec
71
72 for { set i 0 } { $i < $nchan_ } { incr i } {
73 set p [new RelayedNetPort $self [expr 2*$i]]
74 set data_port_($i) $p
75 $session_ data-net $p $i
76
77 set p [new RelayedNetPort $self [expr 2*$i + 1]]
78 set ctrl_port_($i) $p
79 $session_ ctrl-net $p $i
80 }
81 }
82
83 RelayedNetwork instproc data-net args {
84 if { $args == "" } {
85 set k 0
86 } else {
87 set k $args
88 }
89
90 $self instvar data_port_
91 return $data_port_($k)
92 }
93
94 RelayedNetwork instproc ctrl-net args {
95 if { $args == "" } {
96 set k 0
97 } else {
98 set k $args
99 }
100
101 $self instvar ctrl_port_
102 return $ctrl_port_($k)
103 }
104
105 RelayedNetwork instproc set-subscription-level args {
106 #XXX
107 }
108
109 RelayedNetwork instproc install-key key {
110 #XXX
111 }
112
113
114 RelayedNetwork instproc usingRLM {} {
115 return 0
116 }
117
118 RelayedNetwork instproc nchan {} {
119 return [$self set nchan_]
120 }
121
122 RelayedNetwork instproc ismulticast {} {
123 return 1
124 }
125
126
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.