Solstice X.25 9.2 Developer's Guide

12.2 AF_X25 Domain Addresses

Addresses in the AF_X25 domain consist of two parts: a DTE address of up to 15 BCD digits and Call User Data of up to 16 bytes. (The leading bytes of the Call User Data is often a protocol identifier [PID] used to identify a specific application using X.25.) You can use either subaddressing (part of 15-digit DTE address) or both subaddressing and Call User Data as part of the binding mechanism to match Incoming Call packets with a server process.

An AF_X25 domain address is described by a CONN_DB structure:

typedef struct conn_db_s {
    u_char   hostlen;         /*address length in BCD digits */
    u_char   host[(MAXHOSTADR+1)/2];   /* DTE address */
    u_char   datalen;         /* user data length in bytes */
    u_char   data[MAXDATA];   /* user data */
 } CONN_DB; 

The constants MAXHOSTADR and MAXDATA are defined in the include file x25_pk.h. Currently, MAXHOSTADR is 15, so the length of the host field is 8, and MAXDATA is 102. Use these constants, whenever possible, instead of hard-coded values.

The 15-digit DTE address comprises three components: a Data Network Identification Code (DNIC), a Network Terminal Number (NTN), and a subaddress. A full X.121 address is the concatenation of a DNIC, NTN, and subaddress, in that order. For example, if the DNIC is 4042, the NTN is 3831, and subaddress is 06, the full X.121 address is 4042383106.

Note that only eight bytes are provided for the X.121 address, which could be up to 15 digits in length. This is because each byte holds two BCD digits in packed format (it takes only four bits to represent a BCD digit). Thus the address 4042383106 will be stored as five bytes, with hexadecimal values 0x40, 0x42, 0x38, 0x31, and 0x06, in that order.

The necessary include files are listed in Chapter 13, Sockets Programming Example. For more information on address binding, see "12.3.4 Address Binding ".