HP UX 11i v2 Networking Software manual 152

Models: UX 11i v2 Networking Software

1 175
Download 175 pages 52.54 Kb
Page 152
Image 152

Sample Programs

Connection Mode

/* return the correlation number */ return(con_ind->dl_correlation);

}

/************************************************************************** send a connect response with a specified correlation and token; wait for the OK_ACK

**************************************************************************/

void

connect_res(fd, correlation, token)

int

fd;

/* file descriptor */

u_long

correlation;

/* correlation number of CONNECT_IND */

 

 

/* being responded to */

u_long

token;

/* token of stream to pass connection to */

{

 

 

dl_connect_res_t

*con_res = (dl_connect_res_t *)ctrl_area;

/* fill in the connect response */

con_res->dl_primitive = DL_CONNECT_RES; con_res->dl_correlation = correlation; con_res->dl_resp_token = token;

/* QOS is not supported; these fields must be set to zero */ con_res->dl_qos_length = 0;

con_res->dl_qos_offset = 0; con_res->dl_growth = 0;

put_ctrl(fd, sizeof(dl_connect_res_t), 0); get_msg(fd);

check_ctrl(DL_OK_ACK);

}

/************************************************************************** send a DISCONNECT_REQ and wait for the OK_ACK

**************************************************************************/

void

 

 

disconnect_req(fd)

 

int

fd;

/* file descriptor */

{

 

 

dl_disconnect_req_t

*disc_req = (dl_disconnect_req_t *)ctrl_area;

/* fill in the disconnect request */

disc_req->dl_primitive = DL_DISCONNECT_REQ; /* this is a normal disconnect */ disc_req->dl_reason = DL_DISC_NORMAL_CONDITION; /*

Since we are not rejecting a CONNECT_IND, we set the correlation to zero.

152

Appendix A

Page 152
Image 152
HP UX 11i v2 Networking Software manual 152