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/session-addr.tcl,v 1.1 2003/06/03 20:06:46 aswan Exp $
29
30 #
31 # SessionAddress is a base class that may be overridden
32 # but should not be directly instantiated. Its purpose
33 # is to allow different types of networks
34 # (e.g., IPv4, IPv6, application-level multicast) to exist
35 # easily without requiring the rtp or media processing
36 # code to understand all the different types.
37 #
38 # In particular, a SessionAddress contains the logic
39 # to parse a user entered specification for a network
40 # session (e.g., the specification "224.2.2.2/2222" is
41 # shorthand for IPv4 multicast group 224.2.2.2 and UDP
42 # port 2222). A new subclass of SessionAddress should
43 # be created for any new network type and the logic in
44 # SessionAddress::parse below should be updated to
45 # recognize the new specification.
46 #
47 # A new subclass of SessionAddress must override the
48 # methods listed below and must set the instance
49 # variable network_class_ which indicates what type
50 # of network object should be created for this type
51 # of session.
52 #
53
54 Class SessionAddress
55
56 #XXX
57 # this must go after the declaration of the SessionAddress
58 # class so that SessionAddress exists when subclasses of
59 # it are declared.
60
61 import AddressBlock SessionAddress/SimpleRelay
62
63 SessionAddress instproc init {} {
64 $self next
65
66 $self instvar network_class_
67 set network_class_ UNKNOWN
68 }
69
70 SessionAddress instproc net-class {} {
71 $self instvar network_class_
72 return $network_class_
73 }
74
75 # addr, sport, rport, ttl take optional layer argument
76 foreach method [list "fmt" "nchan" "maxbw" "addr" "sport" "rport" "ttl"] {
77 SessionAddress instproc $method {args} "error \"\[\$self info class] does not implement method $method\""
78 }
79
80
81 SessionAddress proc parse { spec } {
82 if [string match "relay:*" $spec] {
83 return [new SessionAddress/SimpleRelay $spec]
84 }
85 return [new AddressBlock $spec]
86 }
87
88
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.