SocketAddress.st
author Claus Gittinger <cg@exept.de>
Tue, 21 Sep 1999 01:53:10 +0200
changeset 816 489e7876ab3e
parent 799 b109b39813b4
child 818 2f8331ad12d4
permissions -rw-r--r--
checkin from browser

"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

Object subclass:#SocketAddress
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'OS-Sockets'
!

!SocketAddress class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    Abstract superclass for subclasses implementing various IPC addressing schemes.
    See concrete examples IPSocketAddress and UDSocketAddress.

    ST-80 compatibility class.
    This may be required when existing code has to be ported to ST/X;
    however, it may not be complete and more protocol may be added in the future.
    The code here was created when public domain code (Manchester) had to
    be ported to ST/X and missing classes/methods were encountered, and code added
    by reasoning 'what the original class could probably do there'.

    This is an additional goody class; therefore:

    THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTOR ``AS IS'' AND
    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    ARE DISCLAIMED.  IN NO EVENT SHALL THE CONTRIBUTOR BE LIABLE
    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    SUCH DAMAGE.
"
! !

!SocketAddress class methodsFor:'instance creation'!

hostAddress:addr port:portNr
    ^ self basicNew hostAddress:addr port:portNr
!

hostName:name port:portNr
    ^ self basicNew hostName:name port:portNr
! !

!SocketAddress class methodsFor:'queries'!

domainCodeFromName:aNameSymbol
    "this is a compatibility method;
     VW returns the internal unix codes here - however, in ST/X,
     symbols are returned, which are translated later (in Socket)"

    aNameSymbol == #afUnix      ifTrue:[^ #unix].
    aNameSymbol == #afInet      ifTrue:[^ #inet].    
    aNameSymbol == #afIpV6      ifTrue:[^ #inet6].    
    aNameSymbol == #afAppletalk ifTrue:[^ #appletalk].    
    aNameSymbol == #afDecnet    ifTrue:[^ #DECnet].    
    aNameSymbol == #afSna       ifTrue:[^ #sna].    
    aNameSymbol == #afNs        ifTrue:[^ #xns].    
    aNameSymbol == #afCcitt     ifTrue:[^ #ccitt].    

    "/
    "/ could someone tell me which symbols are used in ST-80's SocketAddress class ?
    "/
    self error:'no more mimicri implemented yet ...'

    "Modified: / 9.1.1998 / 10:03:56 / stefan"
!

domainNameFromCode:code
    "this is a compatibility method;
     VW expects the internal unix codes here - however, in ST/X,
     symbols are expected - keeping the numeric values secret (in Socket)"

    code == #unix      ifTrue:[^ #afUnix].
    code == #inet      ifTrue:[^ #afInet].
    code == #inet6     ifTrue:[^ #afIpV6].
    code == #appletalk ifTrue:[^ #afAppletalk].
    code == #DECnet    ifTrue:[^ #afDecnet].
    code == #sna       ifTrue:[^ #afSna].
    code == #xns       ifTrue:[^ #afNs].
    code == #ccitt     ifTrue:[^ #afCcitt].

    "/
    "/ could someone tell me which symbols are used in ST-80's SocketAddress class ?
    "/
    self error:'no more mimicri implemented yet ...'

!

knownClassFromCode:code
    "this is a compatibility method;
     VW expects the internal unix codes here - however, in ST/X,
     symbols are expected - keeping the numeric values secret (in Socket)"

    code == #unix      ifTrue:[^ #UDSocketAddress].
    code == #inet      ifTrue:[^ #IPSocketAddress].
    code == #inet6     ifTrue:[^ #IPv6SocketAddress].
    code == #appletalk ifTrue:[^ #AppletalkSocketAddress].
    code == #DECnet    ifTrue:[^ #DECNetSocketAddress].
    code == #sna       ifTrue:[^ #SNASocketAddress].
    code == #xns       ifTrue:[^ #XNSSocketAddress].
    code == #ccitt     ifTrue:[^ #CCITTSocketAddress].

    "/
    "/ could someone tell me which symbols are used in ST-80's SocketAddress class ?
    "/
    self error:'no more mimicri implemented yet ...'.
    ^ #SocketAddress

! !

!SocketAddress methodsFor:'queries'!

address
    ^ self subclassResponsibility
!

hostName
    ^ self subclassResponsibility

    "Created: 2.11.1995 / 11:17:51 / cg"
!

portOrName
    ^ self subclassResponsibility
! !

!SocketAddress class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic2/SocketAddress.st,v 1.8 1999-09-20 23:53:02 cg Exp $'
! !