UDSocketAddress.st
author Claus Gittinger <cg@exept.de>
Wed, 21 May 2003 20:03:18 +0200
changeset 1228 b766b9873ba6
parent 1226 0114bd044aa9
child 1259 0a557e59ea4a
permissions -rw-r--r--
refactored & dead code eliminated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    13
"{ Package: 'stx:libbasic2' }"
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    14
818
2f8331ad12d4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
    15
SocketAddress variableByteSubclass:#UDSocketAddress
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    16
	instanceVariableNames:''
488
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 113
diff changeset
    17
	classVariableNames:''
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 113
diff changeset
    18
	poolDictionaries:''
816
489e7876ab3e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 799
diff changeset
    19
	category:'OS-Sockets'
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
!
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
!UDSocketAddress class methodsFor:'documentation'!
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
copyright
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
"
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
 COPYRIGHT (c) 1995 by Claus Gittinger
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
	      All Rights Reserved
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 This software is furnished under a license and may be used
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 hereby transferred.
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
"
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
!
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
documentation
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
111
92392ae9a0f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
    40
    Instances of UDSocketAddress represent unix-domain socket names.
92392ae9a0f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
    41
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    ST-80 compatibility class.
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    This may be required when existing code has to be ported to ST/X;
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    however, it may not be complete and more protocol may be added in the future.
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    The code here was created when public domain code (Manchester) had to
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    be ported to ST/X and missing classes/methods were encountered, and code added
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    by reasoning 'what the original class could probably do there'.
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    This is an additional goody class; therefore:
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTOR ``AS IS'' AND
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    ARE DISCLAIMED.  IN NO EVENT SHALL THE CONTRIBUTOR BE LIABLE
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
    SUCH DAMAGE.
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
"
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
! !
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
!UDSocketAddress class methodsFor:'instance creation'!
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
name: pathName
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    ^ self new name:pathName
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    "
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
     UDSocketAddress name:'/tmp/aUnixDomainSocket' 
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    "
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
! !
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    75
!UDSocketAddress class methodsFor:'queries'!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    76
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    77
domainSymbol
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
1226
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
    79
    ^ #'AF_UNIX'
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
    80
!
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
    81
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
    82
obsoleteDomainSymbol
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    83
    ^ #unix
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    84
!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    85
1226
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
    86
vwDomainSymbol
0114bd044aa9 vw compatible domainSymbols (afXXX)
Claus Gittinger <cg@exept.de>
parents: 1164
diff changeset
    87
    ^ #afUnix
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
! !
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    90
!UDSocketAddress methodsFor:'accessing'!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    91
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    92
name
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    93
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    94
    ^ self stringAt:3
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    95
!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    96
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    97
name:pathName
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    98
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
    99
    self stringAt:3 put:pathName
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   100
! !
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   101
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   102
!UDSocketAddress methodsFor:'obsolete'!
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
488
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 113
diff changeset
   104
address
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 113
diff changeset
   105
    ^ nil
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 113
diff changeset
   106
!
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 113
diff changeset
   107
111
92392ae9a0f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   108
hostName
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   109
    ^ 'local'
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   110
!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   111
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   112
hostName:hostOrPathName port:portNrOrName
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   113
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   114
    self name:hostOrPathName
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   115
!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   116
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   117
port:pathName
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   118
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   119
    self name:pathName
111
92392ae9a0f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   120
!
92392ae9a0f0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 100
diff changeset
   121
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
portOrName
1164
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   123
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   124
    ^ self name
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   125
! !
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   126
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   127
!UDSocketAddress methodsFor:'printing & storing'!
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   128
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   129
printOn:aStream
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   130
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   131
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   132
    aStream nextPutAll:self class name; 
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   133
            nextPut:$(; nextPutAll:self name; nextPut:$)
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   134
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   135
    "
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   136
     (self name:'/tmp/abcde') printString
41a2750af1fa New socket support
Stefan Vogel <sv@exept.de>
parents: 818
diff changeset
   137
    "
100
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
! !
058d9257c30d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
488
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 113
diff changeset
   140
!UDSocketAddress class methodsFor:'documentation'!
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 113
diff changeset
   141
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 113
diff changeset
   142
version
1228
b766b9873ba6 refactored & dead code eliminated
Claus Gittinger <cg@exept.de>
parents: 1226
diff changeset
   143
    ^ '$Header: /cvs/stx/stx/libbasic2/UDSocketAddress.st,v 1.10 2003-05-21 18:02:40 cg Exp $'
488
b0c17a5ff8ea checkin from browser
Claus Gittinger <cg@exept.de>
parents: 113
diff changeset
   144
! !