uucp using TLI

Marco S Hyman marc at dumbcat.sf.ca.us
Sun Nov 18 06:31:24 AEST 1990


In article <1861 at ssbn.WLK.COM> bill at ssbn.WLK.COM (Bill Kennedy) writes:
    Now you have to work up your network address.  We'd have _never_ figured
    this out without ISC's help!  This is a hex string that is composed of
    address family (AF_INET), port number, IP address, and padding zeroes.
    Here is the format and an example:

    \x02000100c0fafa010000000000000000    mapped as
      aaaappppiiiiiiiizzzzzzzzzzzzzzzz
      |   |   |       +------------------ sixteen padding zeroes
      |   |   +-------------------------- IP address 192.250.250.1 co.fa.fa.01
      |   +------------------------------ port address fm /etc/services (256)
      +---------------------------------- address family, socket address

Not too suprising. One of the disadvantages of TLI (IMHO) is that the
format of the addr field in the t_{bind,call,unitdata,uderr} structures is
implementation dependent, e.g. "The responsibility of the transport
provider."  Since a socket interface library usually (always?) comes with
TCP-IP, even when a TLI is used, the address format used is that of a
struct sockaddr.  Saves having to support multiple address formats, I guess.
Anyroad, the format is

    struct sockaddr {
	u_short	sa_family;		/* address family */
	char	sa_data[14];		/* up to 14 bytes of direct address */
    };

in its most generic form.  The internet style definition (when sa_family ==
AF_INET) is:

    struct sockaddr_in {
	short	sin_family;
	u_short	sin_port;
	struct	in_addr sin_addr;
	char	sin_zero[8];
    };

This should look familiar -- it's what you entered above.  Isn't it nice to
know that when writing code using TLI you have to know who implemented the
transport providor protocols to know the address formats to use.


// marc
-- 
// marc at dumbcat.sf.ca.us
// {ames,decwrl,sun}!pacbell!dumbcat!marc



More information about the Comp.unix.sysv386 mailing list