author | Stefan Vogel <sv@exept.de> |
Fri, 28 Nov 2003 12:18:01 +0100 | |
changeset 1366 | e01d0f6c102a |
parent 1281 | 6df4f8f211e3 |
child 1559 | 609a0707ab22 |
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 |
||
14 |
||
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
15 |
"{ Package: 'stx:libbasic2' }" |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
16 |
|
818 | 17 |
IPSocketAddress variableByteSubclass:#IPv6SocketAddress |
815 | 18 |
instanceVariableNames:'' |
19 |
classVariableNames:'' |
|
20 |
poolDictionaries:'' |
|
1167 | 21 |
category:'OS-Sockets' |
815 | 22 |
! |
23 |
||
24 |
!IPv6SocketAddress class methodsFor:'documentation'! |
|
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 1999 by eXept Software AG |
|
29 |
All Rights Reserved |
|
30 |
||
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
||
39 |
||
40 |
! |
|
41 |
||
42 |
documentation |
|
43 |
" |
|
44 |
Instances of IPv6SocketAddress represent v6 IP socket addresses. |
|
45 |
These consist of a 16byte hostId and a port number. |
|
46 |
||
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
47 |
Contains |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
48 |
2 byte domain AF_INET6 |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
49 |
2 byte port |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
50 |
4 byte flowInfo |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
51 |
16 byte address |
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
52 |
4 byte scope |
815 | 53 |
|
54 |
[author:] |
|
55 |
Claus Gittinger (cg@exept) |
|
56 |
||
57 |
[see also:] |
|
58 |
||
59 |
[instance variables:] |
|
60 |
||
61 |
[class variables:] |
|
62 |
" |
|
63 |
! ! |
|
64 |
||
1281 | 65 |
!IPv6SocketAddress class methodsFor:'addressing'! |
66 |
||
67 |
anyAddress |
|
68 |
"return the anonymous addresses bytes" |
|
69 |
||
70 |
^ #[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] |
|
1366
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
71 |
! |
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
72 |
|
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
73 |
local |
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
74 |
"return the addresses bytes addressing the local host" |
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
75 |
|
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
76 |
^ #[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1] |
1281 | 77 |
! ! |
78 |
||
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
79 |
!IPv6SocketAddress class methodsFor:'queries'! |
818 | 80 |
|
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
81 |
domainSymbol |
818 | 82 |
|
1226
0114bd044aa9
vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
83 |
^ #'AF_INET6' |
0114bd044aa9
vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
84 |
! |
0114bd044aa9
vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
85 |
|
0114bd044aa9
vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
86 |
obsoleteDomainSymbol |
1162
c8ba14f81f13
Prepare new socketb implementation
Stefan Vogel <sv@exept.de>
parents:
818
diff
changeset
|
87 |
^ #inet6 |
815 | 88 |
! ! |
89 |
||
1231 | 90 |
!IPv6SocketAddress methodsFor:'accessing'! |
91 |
||
92 |
hostAddress |
|
93 |
"/ struct sockaddr_in6 { |
|
94 |
"/ unsigned short int sin6_family; /* AF_INET6 */ |
|
95 |
"/ __u16 sin6_port; /* Transport layer port # */ |
|
96 |
"/ __u32 sin6_flowinfo; /* IPv6 flow information */ |
|
97 |
"/ struct in6_addr sin6_addr; /* IPv6 address */ |
|
98 |
"/ __u32 sin6_scope_id; /* scope id (new in RFC2553) */ |
|
99 |
"/ }; |
|
100 |
^ (ByteArray new:16) replaceFrom:1 with:self startingAt:9 |
|
101 |
! |
|
102 |
||
103 |
hostAddress:aByteArray |
|
104 |
^ self replaceFrom:9 to:9+16-1 with:aByteArray startingAt:1 |
|
105 |
! ! |
|
106 |
||
107 |
!IPv6SocketAddress methodsFor:'private'! |
|
108 |
||
109 |
adrBytesStart |
|
110 |
^ 9 |
|
111 |
! |
|
112 |
||
113 |
numAdrBytes |
|
114 |
^ 16 |
|
115 |
! ! |
|
116 |
||
1366
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
117 |
!IPv6SocketAddress methodsFor:'testing'! |
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
118 |
|
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
119 |
isLocal |
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
120 |
"answer true, if this address adresses a peer on the same host" |
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
121 |
|
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
122 |
^ self hostAddress = self class local |
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
123 |
! ! |
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
124 |
|
815 | 125 |
!IPv6SocketAddress class methodsFor:'documentation'! |
126 |
||
127 |
version |
|
1366
e01d0f6c102a
New method #isLocal returning true for local addresses
Stefan Vogel <sv@exept.de>
parents:
1281
diff
changeset
|
128 |
^ '$Header: /cvs/stx/stx/libbasic2/IPv6SocketAddress.st,v 1.12 2003-11-28 11:17:38 stefan Exp $' |
815 | 129 |
! ! |