author | Stefan Vogel <sv@exept.de> |
Thu, 27 Mar 2003 16:14:16 +0100 | |
changeset 1167 | 56c172bc5cfe |
parent 1165 | 41276f24118f |
child 1226 | 0114bd044aa9 |
permissions | -rw-r--r-- |
815 | 1 |
" |
2 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
14 |
"{ Package: 'stx:libbasic2' }" |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
15 |
|
818 | 16 |
SocketAddress variableByteSubclass:#AppletalkSocketAddress |
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
17 |
instanceVariableNames:'' |
815 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
1167 | 20 |
category:'OS-Sockets' |
815 | 21 |
! |
22 |
||
23 |
!AppletalkSocketAddress class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
28 |
All Rights Reserved |
|
29 |
||
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
||
38 |
! |
|
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
Instances of AppletalkSocketAddress represent appletalk socket addresses. |
|
43 |
These consist of a network (2 bytes), a node (1 byte) and a port number. |
|
44 |
||
45 |
||
46 |
[author:] |
|
47 |
Claus Gittinger (cg@exept) |
|
48 |
||
49 |
[see also:] |
|
50 |
||
51 |
[instance variables:] |
|
52 |
||
53 |
[class variables:] |
|
54 |
" |
|
55 |
! ! |
|
56 |
||
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
57 |
!AppletalkSocketAddress class methodsFor:'addressing'! |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
58 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
59 |
anyNet |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
60 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
61 |
^ 0 |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
62 |
! |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
63 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
64 |
anyNode |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
65 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
66 |
^ 0 |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
67 |
! |
818 | 68 |
|
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
69 |
anyPort |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
70 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
71 |
^ 0 |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
72 |
! |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
73 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
74 |
firstUnreservedPort |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
75 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
76 |
^ 128 |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
77 |
! |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
78 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
79 |
maxPort |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
80 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
81 |
^ 254 "254 is only legal on localtalk" |
818 | 82 |
! ! |
83 |
||
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
84 |
!AppletalkSocketAddress class methodsFor:'name queries'! |
815 | 85 |
|
86 |
hostAddressByName: hostName |
|
87 |
^ Socket appletalkAddressOfHost:hostName |
|
88 |
||
89 |
" |
|
90 |
AppletalkSocketAddress hostAddressByName:'clam' |
|
91 |
AppletalkSocketAddress hostAddressByName:'foobar' |
|
92 |
" |
|
93 |
||
94 |
||
95 |
! |
|
96 |
||
97 |
hostNameByAddress:anAddress |
|
98 |
^ Socket hostWithAppletalkAddress:anAddress |
|
99 |
||
100 |
" |
|
101 |
AppletalkSocketAddress hostNameByAddress:#[1 2 3]. |
|
102 |
" |
|
103 |
||
104 |
! ! |
|
105 |
||
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
106 |
!AppletalkSocketAddress class methodsFor:'queries'! |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
107 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
108 |
domainSymbol |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
109 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
110 |
^ #appletalk |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
111 |
! |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
112 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
113 |
socketAddressSize |
1165 | 114 |
^ OperatingSystem socketAccessor socketAddressSize:#appletalk |
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
115 |
! ! |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
116 |
|
818 | 117 |
!AppletalkSocketAddress methodsFor:'accessing'! |
815 | 118 |
|
119 |
net |
|
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
120 |
^ self unsignedShortAt:4 bigEndian:true |
815 | 121 |
! |
122 |
||
123 |
net:aNodeAddress |
|
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
124 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
125 |
self unsignedShortAt:4 put:aNodeAddress bigEndian:true |
818 | 126 |
|
127 |
" |
|
128 |
self new net:16r1234 |
|
129 |
" |
|
130 |
! |
|
131 |
||
132 |
net:netNr node:nodeNr port:portNr |
|
133 |
self |
|
134 |
net:netNr; |
|
135 |
node:nodeNr; |
|
136 |
port:portNr |
|
137 |
||
138 |
" |
|
139 |
AppletalkSocketAddress new net:1234 node:10 port:20 |
|
140 |
" |
|
141 |
" |
|
142 |
AppletalkSocketAddress hostAddress:#[1 2 3] port:10 |
|
143 |
" |
|
144 |
! |
|
145 |
||
146 |
node |
|
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
147 |
^ self at:6 |
815 | 148 |
! |
149 |
||
818 | 150 |
node:aNodeNr |
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
151 |
self at:6 put:aNodeNr |
815 | 152 |
! |
153 |
||
154 |
port |
|
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
155 |
^ self at:3 |
815 | 156 |
! |
157 |
||
818 | 158 |
port:aPortNr |
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
159 |
self at:3 put:aPortNr |
818 | 160 |
! ! |
161 |
||
162 |
!AppletalkSocketAddress methodsFor:'printing & storing'! |
|
163 |
||
164 |
printOn:aStream |
|
165 |
"append a user printed representation of the receiver to aStream. |
|
166 |
The format is suitable for a human - not meant to be read back." |
|
167 |
||
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
168 |
|port| |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
169 |
|
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
170 |
port := self port. |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
171 |
|
818 | 172 |
self net printOn:aStream. |
173 |
aStream nextPut:$:. |
|
174 |
self node printOn:aStream. |
|
175 |
port notNil ifTrue:[ |
|
176 |
aStream nextPut:$:. |
|
177 |
port printOn:aStream. |
|
178 |
]. |
|
179 |
! ! |
|
180 |
||
181 |
!AppletalkSocketAddress methodsFor:'queries'! |
|
182 |
||
183 |
hostName |
|
184 |
^ Socket hostWithAppletalkAddress:self |
|
185 |
||
186 |
||
187 |
! |
|
188 |
||
815 | 189 |
portOrName |
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
190 |
^ self port |
815 | 191 |
! ! |
192 |
||
193 |
!AppletalkSocketAddress class methodsFor:'documentation'! |
|
194 |
||
195 |
version |
|
1167 | 196 |
^ '$Header: /cvs/stx/stx/libbasic2/AppletalkSocketAddress.st,v 1.5 2003-03-27 15:14:02 stefan Exp $' |
815 | 197 |
! ! |