Solstice X.25 9.2 Developer's Guide

12.7.6 Accessing the Link (X.25) Address

The X.25 client can set the local link X.121 (X.25) address through an X.25 socket owned by the superuser. (The default value is established in the Interface Configuration window in x25tool, as described in Solstice X.25 9.2 Administration Guide):

typedef struct link_adr_s {
    int      linkid;  /* id of link */
    u_char   hostlen; /* length of BCDs */
    u_char   host[(MAXHOSTADR+1)/2];
 } LINK_ADR;
 LINK_ADR addr;
 int so, error;
 error = ioctl(so, X25_WR_LINKADR, &addr);

Set linkid to the identifier of the desired link.

The local link X.121 address can be read at any time with:

LINK_ADR addr;
 int s;
 error = ioctl(s, X25_RD_LINKADR, &addr);

The returned addr is actually the link address specified in x25tool (for the link specified in the linkid field of the LINK_ADR structure) unless a new address has been assigned to the link.

The X25_WR_LINKADR ioctl can be used to assign new X.25 addresses to a link.