The user may set one of three types of Closed User Group facility: CUG_REQ (no outgoing access), CUG_REQ_ACS (with outgoing access), and CUG_BI (bilateral CUG). For CUG_REQ and CUG_REQ_ACS, the CUG is a decimal integer in the range 0-9999 (for 1980 X.25 interfaces, the valid range is 0-99). The extended form of the facility is used for CUG indices in the range 100-9999. This facility is set as follows:
u_short cug_index; /* set cug_index to appropriate value */ f.type = T_CUG; f.f_cug_req = CUG_REQ; /* could be CUG_REQ_ACS or CUG_BI */ f.f_cug_index = cug_index; error = ioctl(s, X25_SET_FACILITY, &f);
To read this facility:
f.type = T_CUG; error = ioctl(s, X25_GET_FACILITY, &f); cug_req = f.f_cug_req; cug_index = f.f_cug_index;