Solstice X.25 9.2 Developer's Guide

12.3.6 Masking Incoming Protocol Ids at Bit Level

The user data in an Incoming Call may be masked (that is, bitwise ANDed), using a specified mask value, before it is matched with the protocol identifier specified in a bind call. The mask is specified in a MASK_DATA_DB structure using the X25_WR_MASK_DATA ioctl. Here is an example:

typedef struct mask_data_bd_s {
    u_char   masklen;
    u_char   mask[MAXMASK];
 } MASK_DATA_DB;

 MASK_DATA_DB m;
 int s, error;

 m.masklen = 3;
 m.mask[0] = 0xff;
 m.mask[1] = 0x00;
 m.mask[2] = 0xff;

 error = ioctl(s, X25_WR_MASK_DATA, &m);

MAXMASK is currently 16. masklen holds the length of the mask data in bytes, and mask is the actual mask value. In the above example, the first three bytes of user data in an Incoming Call will be masked: the first byte with 0xff, the second with 0x00, and the third with 0xff. The masked user data will then be matched with the specified protocol identifier. Note that the specified protocol identifier will not be masked before matching occurs, so in the above example, the second byte of the specified protocol identifier must be zero if any match is to succeed.