23.
How to determine the value of an XTI address string
This information is not applicable to Win32 systems.
Most modern UNIX systems provide support for the socket network
interface.
Most people will build Distributed TETware to use the socket network
interface and so don't need to be concerned about XTI addresses.
The information presented in this article might be useful if you have to
set up Distributed TETware to use the XTI network interface for some
reason.
Where does TETware use an XTI address string?
When Distributed TETware is built to use the XTI network interface
you have to specify an XTI address string in the following places:
-
tccd
must be invoked with a
-p
option which tells it on which network end point to listen.
-
For each entry in the
systems
file you must provide a third field that specifies the XTI address
that can be used to connect to
tccd
on that system.
XTI address strings
An XTI address string consists of a sequence of 2-digit hexadecimal
values.
When TCP is the transport provider, these values often represent a dump of a
sockaddr_in
structure which describes the network address.
For example, consider the following definitions taken from
<netinet/in.h>
on a hypothetical machine:
struct in_addr {
unsigned long s_addr;
};
struct sockaddr_in {
short sin_family;
unsigned short sin_port;
struct in_addr sin_addr;
char sin_zero[8];
};
Suppose that on this machine:
-
a
short
is 16 bits wide
-
a
long
is 32 bits wide
-
structure members are aligned on 2-byte boundaries (so there will be no
padding between members in the
sockaddr_in
structure)
It can be seen that the format of an XTI address string on this machine
will be:
FFFFPPPPAAAAAAAA0000000000000000
where
FFFF
is the address family (in host byte order)
PPPP
is the port number (in network byte order)
and
AAAAAAAA
is the IP address (also in network byte order).
tccd -p option
In most cases you want
tccd
to accept connections on all network interfaces, so you need to specify
the IP address as
INADDR_ANY
(value zero on many systems).
Suppose that:
-
the byte order of the machine is high byte first (big-endian)
-
you decide to use port 7500 as the well-known port
-
the name of the transport provider is
/dev/tcp
You would invoke
tccd
as follows:
tccd -p 00021d4c000000000000000000000000 -M TCP -P /dev/tcp [ other-options . . .]
This XTI address string can be read as follows:
0002 -
The address family
(AF_INET
- value 2 on many systems)
1d4c -
The port number to listen on (7500 decimal is 0x1d4c hex)
00000000 -
The IP address to use
(INADDR_ANY
- value zero on many systems)
0000000000000000 -
Zero-filled padding
(char sin_zero[8] )
Note that the IP address and port number are in network byte order.
So on a little-endian machine the only thing that changes is the address
family.
For example:
tccd -p 02001d4c000000000000000000000000 -M TCP -P /dev/tcp [ other-options . . .]
systems file
The XTI address in a systems file entry is constructed in the same way
as for
tccd
except it is necessary to specify a real IP address instead of
INADDR_ANY .
Foe example, suppose you decide to use a machine called
fred
as system 1.
The IP address of
fred
is 89.0.173.24 and
tccd
is listening on port 7500.
The systems file entry would look like this:
001 fred 00021d4c5900ad180000000000000000
This XTI address string can be read as follows:
0002 -
The address family
(AF_INET
- value 2 on many systems)
1d4c -
The port number to listen on (7500 decimal is 0x1d4c hex)
5900ad18 -
The IP address to use
(89.0.173.24 is 0x5900ad18 hex)
0000000000000000 -
Zero-filled padding
(char sin_zero[8] )
See also
-
"Systems definitions''
in the TETware Programmers Guide.
-
The
systems
and
tccd
manual pages in the TETware User Guide.
|