HPlogo X25/9000: X.25/9000 Programmer's Guide > Chapter 2 X.25 Addressing

Addressing Options for Servers

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

A server uses the X.25 socket address information to identify which calls it will process. Each server uses the bind(2) system call to define the addressing information for calls it will process. The bind() system call is described in Chapter 3 “ Establishing and Terminating a Socket Connection” and in your HP-UX man pages.

The discussion of incoming call-matching methods includes:

  • Call-matching by interface name. An X.25 interface name is specified in the x25ifname[] field of the x25addrstr structure. Only calls arriving over that interface may be connected to the socket.

  • Call-matching by called X.121 address. The called address is stored in the x25_host field of the x25addrstr structure. Only calls with the specified called address may be connected to the socket.

  • Call-matching by called X.121 address and a subaddress. The subaddress is stored in the x25_host field of the x25addrstr structure. Only calls with the specified called address and subaddress may be connected to the socket.

  • Call-matching by protocol ID. The protocol ID is set in the x25_pid[] field of the x25addrstr structure. Only calls with the correct protocol ID can be connected.

  • Addressing conflicts in bind() calls.

When a CALL REQUEST packet arrives, three tests are performed to attempt to match the call to a listen socket:

  • The name of the interface over which the call arrived is matched against the x25ifname field specified in the bind().

  • The called address field is matched against the x25_host field specified in the bind().

  • The first bytes of the user data field in the CALL REQUEST packet are matched against the x25pid field specified in the bind().

If all of these tests succeeds, the call is connected to the socket. If the incoming call does not match with any of the specified addresses, the call is cleared.

NOTE: If any of the three tests fail, the call is cleared before reaching the socket and the server application (above the socket) will never know anything about this incoming call request.

The matching tests for incoming calls and how a server controls calls are discussed below.

Call-Matching by X.25 Interface Name

The name of an X.25 interface is assigned during configuration. Refer to the X.25/9000 User's Guide for details on the interface name.

The x25ifname[] field of the x25addrstr structure may contain an interface name to designate a particular X.25 interface to be used for call connection. It can also specify that calls be connected from any X.25 interface on the system. If your application will receive calls from a single interface, the name must be specified in the x25ifname field. If your application shall receive calls arriving over any interface, no interface name can be specified in the x25ifname[] field (set to the null string, "\0").

This field is of little importance when only one X.25 interface is in use. If more than one interface are in use, specify which interface connects to the network in the x25ifname[] field.

To accept calls from more than one X.25 interface (but not all interfaces) a separate socket must be created for each interfaces from which calls will be accepted. The resulting listen() sockets must be monitored with the select() call to determine when a matching incoming call arrives. Refer to “Using Nonblocking I/O”"Using Nonblocking I/O" in Chapter 4 “ Sending and Receiving Data” of this manual.

Call-Matching by Called X.121 Address Only

The X.121 address for an X.25 interface is assigned during initialization. When an X.25 interface is connected to a PDN, the X.121 address is assigned to the interface by the network provider. The X.121 address is a string of decimal digits (0-9). Refer to the X.25/9000 User's Guide for details on X.121 address initialization.

When an interface is connected to a PDN, only CALL REQUEST packets with a called address field equal to the X.121 address assigned to the interface will be delivered to the interface. In this case specifying an X.121 address is synonymous with specifying an interface name.

In back-to-back configurations, a CALL REQUEST packet with any valid X.121 address can be received by the interface. Any CALL REQUEST packet, regardless of its X.121 address, is processed by the interface. If a socket with a matching X.121 address is found, a connection is made.

When issuing a bind() system call, the x25_host field of the x25addrstr can contain an X.121 address or be empty. If the x25_host field is not empty, then the specified address must exactly match the called address field of the CALL REQUEST packet. The called address field must exactly match (digit-for-digit) and be of equal length to the x25_host[] field in the x25addrstr structure specified in the bind() call. See "Using Wildcard Addressing".

If the x25_host field is empty, then the x25hostlen field of the bind address is zero (no X.121 address is specified), and the x25_host field will match the called address field of any incoming CALL REQUEST packet with no subaddress.

Call-Matching by Subaddress

Call matching by subaddress is actually an extension of call matching by X.121 address. The subaddress is appended to the called address field in the CALL REQUEST packet and the x25_host[] field in the x25addrstr structure. The subaddress, like the X.121 addresses, is a string of decimal digits (0-9). Not all PDNs support subaddresses, and some support a varying number of subaddress digits. Ask your node or network manager for configuration information concerning subaddresses.

Call-matching by subaddress is one method by which several servers may service different calls over the same interface. The programmer of the client process must know the subaddress as well as the X.121 address before connection begins. The X.121 addresses and the subaddresses must exactly match in order for an incoming request to be bound to a socket.

The combined length of the X.121 address and the subaddress must be less than 16 digits. Thex25hostlen field must include the length of the X.121 address and the length of the subaddress.

Call-Matching by Protocol ID

Call-matching by protocol ID is a flexible way to allow multiple servers to service incoming calls over the same interface. First the X.121 address and subaddress is tested, and finally the protocol ID is tested for the incoming call. If the x25pidlen field is 0, the protocol ID is not used.

The protocol ID field is at the beginning of the call user data field of the CALL REQUEST packet. The server specifies the protocol ID in the x25pid field of the x25addrstr structure. The protocol ID may be from 1 to 9 bytes long. The CCITT X.244 Recommendations describes protocol ID addressing.

Client and server programmers must agree upon how many bits to specify for the protocol ID, but the length is not defined by the X.244 (1984) and X.25 (1980) Recommendations. HP suggests that you use protocol IDs to match incoming calls to sockets, because a single listen socket can be used for any number of X.25 interfaces (independent ports), and subaddresses are not always supported over PDNs.

You can also set a bit mask to specify a range of protocol IDs. The bit mask is described in "Using Wildcard Addressing". Matching by protocol ID can identify higher-level protocols, such as those specified by PAD support.