[ Previous | Next | Contents | Search ]
AIXLink/X.25 1.1 for AIX: Guide and Reference

N_BIND_REQ Primitive

Purpose

Requests that NPI binds a user stream to the X.25 protocol layers for the calling application. For X.25 SVCs, this gives the details of what incoming calls should be routed to the application. For X.25 PVCs, it gives details of what logical channel number to use.

Structure

This primitive consists of one M_PROTO message block with the following structure:

typedef struct {
   ulong PRIM_type;
   ulong ADDR_length;
   ulong ADDR_offset;
   ulong CONIND_number; 
   ulong BIND_flags;
   ulong PROTOID_length;
   ulong PROTOID_offset;
} N_bind_req_t;

Description

The N_BIND_REQ primitive requests that a network address be associated with a stream. It gives the maximum number of connect indications that can be outstanding for the particular application. It also indicates if the stream is a listening stream or a non-listening stream. A listening stream only receives connect indications (N_CONN_IND), and a non-listening stream either sends connect responses (N_CONN_RES) or connect requests (N_CONN_REQ). Bind requests for listening streams should use the PROTOID field to specify the details of incoming calls that should be listened for.

If it is desired that a stream bound as a non-listening stream issue both N_CONN_REQ and N_CONN_RES primitives, it is necessary to do two binds. One bind allows N_CONN_REQ primitives to be sent; then an N_UNBIND_REQ primitive followed by an N_BIND_REQ primitive that binds the stream for sending the N_CONN_RES primitive is issued.

A sample of NPI code is included with the X.25 product.

Parameters

PRIM_type Indicates the N_BIND_REQ primitive.
ADDR_length Indicates the length, in bytes, of the network address to be bound to the stream.
ADDR_offset Specifies where the network address begins. The parameter value is an offset from the beginning of the M_PROTO block.

The following table defines specific address formats to be used used at bind time. Note that this primitive is also used for attaching PVCs.

Note: The address must be a null-terminated string, and the null character is not counted as part of the length field of the M_PROTO message.
N_BIND_REQ SVC Address Formats
Byte # Represents Value Format
1 line number 0-255 Binary
2 address prefix 0 for X.121 ASCII
3 - on address itself X.121 address ASCII
N_BIND_REQ PVC Address Formats
Byte # Represents Value Format
1 line number 0-255 Binary
2 address prefix P ASCII
3 - on logical channel # 0-4095 ASCII
Note: At a given time, not all 4096 LCNs are available. The range must be that which is configured for this X.25 port.

The line number can be obtained several ways. The lsx25 command lists the logical port number for each port, which is the line number. Another way is to use the lsattr command as follows:

lsattr -E -l portname -a port_num

The value to use for the line number is the port_num field. A third option is to use the odm_get_obj subroutine. An example of this code can be found in the sample code directory for NPI.

CONIND_number Indicates the requested number of outstanding connect indications for the specified protocol address. This number should be set to zero if a non-listening stream is desired or greater than zero if a listening stream is desired. A listening stream can also be a DEFAULT_LISTENER, which means that it will accept connect indications (N_CONN_IND) for any network address on any port with any call user data.
BIND_flags Specifies one or more of the following:
DEFAULT_LISTENER Indicates that the current stream is the default listener. This means that the stream accepts connect indications (N_CONN_IND) for any network address on any port with any call user data. There can only be one default listener per system.
TOKEN_REQUEST Indicates that a token be assigned to the stream. The token is used in the connection response (N_CONN_RES). The N_BIND_ACK primitive returns the token value to the user, and the user uses the token in subsequent N_CONN_RES primitives to identify the stream on which the connection is to be established. If a non-listening stream is used to send N_CONN_REQ primitives, this flag should NOT be set. If a non-listening stream is used to send N_CONN_RES primitives, this flag SHOULD be set.
TRANSPAC_OPT On most networks, an outgoing originated call contains both the calling and called addresses. On some networks, however, the calling address must be absent from the call packet since the network itself insets this address. When connected to such networks, this flag must be set. To set it, use a logical OR to "OR" in the value of the TRANSPAC_OPT flag with the BIND_flags field.
Note: In cases where the TRANSPAC_OPT flag is used, the following rules apply:
  • If sub-addressing is desired, the address in the N_BIND_REQ should be formatted as follows:
    • BYTE1 = line number
    • BYTE2 = 0 (X.121 address prefix)
    • BYTE 3 and on = sub-address.
  • Otherwise, the address in the N_BIND_REQ should be formatted as follows:
    • BYTE1 = line number
    • BYTE2 = 0 (X.121 address prefix).
PROTOID_length Specifies the length, in bytes, of the protocol IDs to be bound to the stream.
PROTOID_offset Specifies where the protocol ID begins. The parameter value is an offset from the beginning of the M_PROTO block.

The PROTO_id field gives a pattern to match to the call user data (CUD) of incoming X.25 packets. It must be a null-terminated ASCII string where only digits (0-9), hex digits (A-F), "?" and "*" are allowed. Note that the length of this string, including the null character, cannot exceed 34 bytes. Following are some examples of how the matching for the PROTO_id works.

1234 Only matches for the specific CUD 1234.
1234* Matches for any CUD which starts with the digits 1234. This includes the CUD 1234 itself since a * (asterisk) matches any number of characters including none.
*1234 Matches for any CUD of at least four digits.
12*34 Matches for any CUD, including 1234, which starts with 12 and ends with 34.
12?? Matches for any CUD consisting of exactly four digits and starting with the characters 12.
12??* Matches for any CUD consisting of at least four digits and starting with the characters 12.
???? Matches for any CUD consisting of any four digits.
????* Matches for any CUD consisting of at least four digits.
*1* Matches for any CUD containing the digit "1".
* Matches for any CUD including none at all.

Acknowledgments

The NS provider generates one of the following acknowledgments upon receipt of the N_BIND_REQ primitive:

Successful The NS provider sends the N_BIND_ACK primitive.
Unsuccessful Non-fatal errors are indicated by the N_ERROR_ACK primitive.

Error Codes

The applicable non-fatal errors are as follows:

NNOADDR Indicates that no local address was supplied in the N_BIND_REQ.
NOUTSTATE Indicates the primitive was issued from an invalid state.
NSYSERR Indicates a system error. The error is indicated in the N_ERROR_ACK primitive.

Implementation Specifics

The N_BIND_REQ primitive is part of X.25 licensed program.


[ Previous | Next | Contents | Search ]