AppletalkSocketAddress.st
author Claus Gittinger <cg@exept.de>
Tue, 21 Sep 1999 01:53:08 +0200
changeset 815 cb36489446b2
child 818 2f8331ad12d4
permissions -rw-r--r--
initial checkin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
815
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1999 by eXept Software AG
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
SocketAddress subclass:#AppletalkSocketAddress
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:'port address'
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'OS-Sockets'
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!AppletalkSocketAddress class methodsFor:'documentation'!
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
copyright
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
"
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
 COPYRIGHT (c) 1999 by eXept Software AG
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
              All Rights Reserved
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 This software is furnished under a license and may be used
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 hereby transferred.
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
"
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
!
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
documentation
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
    Instances of AppletalkSocketAddress represent appletalk socket addresses.
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    These consist of a network (2 bytes), a node (1 byte) and a port number.
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    [author:]
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
        Claus Gittinger (cg@exept)
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    [see also:]
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    [instance variables:]
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    [class variables:]
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
"
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
! !
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
!AppletalkSocketAddress class methodsFor:'queries'!
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
hostAddressByName: hostName
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    ^ Socket appletalkAddressOfHost:hostName
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    "
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
     AppletalkSocketAddress hostAddressByName:'clam'   
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
     AppletalkSocketAddress hostAddressByName:'foobar' 
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    "
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
!
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
hostNameByAddress:anAddress
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    ^ Socket hostWithAppletalkAddress:anAddress
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    "
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
     AppletalkSocketAddress hostNameByAddress:#[1 2 3].
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    "
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
! !
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
!AppletalkSocketAddress methodsFor:'queries'!
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
hostAddress:anAddress
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    address := anAddress
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
!
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
hostName
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
    ^ Socket hostWithAppletalkAddress:address
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
!
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
net
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
    ^ address wordAt:1 MSB:true
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
!
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
net:aNodeAddress
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
    address isNil ifTrue:[
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
        address := ByteArray new:3
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    ].
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    address at:3 put:aNodeAddress
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
!
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
node
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
    ^ address at:3
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
!
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
port
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    ^ port
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
!
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
portOrName
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    ^ port
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
! !
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
!AppletalkSocketAddress class methodsFor:'documentation'!
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
version
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
    ^ '$Header: /cvs/stx/stx/libbasic2/AppletalkSocketAddress.st,v 1.1 1999-09-20 23:53:08 cg Exp $'
cb36489446b2 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
! !