1 # dc-servicetableentry.tcl --
2 #
3 # table containing info received from the SDS services, including
4 # attributes and how to contact the services
5 #
6 # Copyright (c) 2000-2002 The Regents of the University of California.
7 # All rights reserved.
8 #
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions are met:
11 #
12 # A. Redistributions of source code must retain the above copyright notice,
13 # this list of conditions and the following disclaimer.
14 # B. Redistributions in binary form must reproduce the above copyright notice,
15 # this list of conditions and the following disclaimer in the documentation
16 # and/or other materials provided with the distribution.
17 # C. Neither the names of the copyright holders nor the names of its
18 # contributors may be used to endorse or promote products derived from this
19 # software without specific prior written permission.
20 #
21 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
22 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
25 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 #
33 # g_iUpdateTime - the initial time for an table entry. The higher this number
34 # is, the longer it takes for a device to timeout
35 #
36
37 global g_iUpdateTime
38 set g_iUpdateTime 3
39
40 #
41 # Class CServiceTableEntry
42 #
43 # Data structure for the table entry.
44 #
45 Class CServiceTableEntry
46
47 CServiceTableEntry instproc init {source iCid contactInfo serviceProperty} {
48 global g_iUpdateTime
49 $self instvar m_source m_iCid m_contactInfo m_iTime m_serviceProperty
50
51 set m_source $source
52 set m_iCid $iCid
53 set m_iTime $g_iUpdateTime
54 set m_contactInfo $contactInfo
55 set m_serviceProperty $serviceProperty
56 }
57
58 CServiceTableEntry instproc UpdateTime {} {
59 global g_iUpdateTime
60 $self instvar m_iTime
61
62 set m_iTime $g_iUpdateTime
63 }
64
65 # access function
66 CServiceTableEntry instproc Source {{source {}}} {
67 $self instvar m_source
68
69 set oldSource $m_source
70 if {$source != {}} { set m_source $source }
71 return $oldSource
72 }
73
74 CServiceTableEntry instproc Cid {{iCid {}}} {
75 $self instvar m_iCid
76
77 set oldiCid $m_iCid
78 if {$iCid != {}} { set m_iCid $iCid }
79 return $oldiCid
80 }
81
82 CServiceTableEntry instproc Time {{iTime {}}} {
83 $self instvar m_iTime
84
85 set oldiTime $m_iTime
86 if {$iTime != {}} { set m_iTime $iTime }
87 return $oldiTime
88 }
89
90 CServiceTableEntry instproc ContactInfo {{contactInfo {}}} {
91 $self instvar m_contactInfo
92
93 set oldContactInfo $m_contactInfo
94 if {$contactInfo != {}} { set m_contactInfo $contactInfo }
95 return $oldContactInfo
96 }
97
98 CServiceTableEntry instproc ServiceProperty {{serviceProperty {}}} {
99 $self instvar m_serviceProperty
100
101 set oldServiceProperty $m_serviceProperty
102 if {$serviceProperty != {}} { set m_serviceProperty $serviceProperty }
103 return $oldServiceProperty
104 }
105
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.