⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test-timod.c

📁 This a separate release of the OpenSS7 X/Open XTI/TLI library, TLI modules (timod, tirdwr) and the I
💻 C
📖 第 1 页 / 共 5 页
字号:
			break;		case __TEST_CAPABILITY_REQ:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--T_CAPABILITY_REQ->|  |                               |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ctrl->len = sizeof(p->capability_req);			p->capability_req.PRIM_type = T_CAPABILITY_REQ;			p->capability_req.CAP_bits1 = TC1_INFO | TC1_ACCEPTOR_ID;			data = NULL;			flags = MSG_HIPRI;			band = 0;			break;		case __TEST_O_TI_GETINFO:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  O_TI_GETINFO                 |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = O_TI_GETINFO;			ic.ic_len = sizeof(p->info_ack);			p->info_req.PRIM_type = T_INFO_REQ;			goto do_ioctl;		case __TEST_O_TI_OPTMGMT:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  O_TI_OPTMGMT                 |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = O_TI_OPTMGMT;			ic.ic_len = sizeof(p->optmgmt_ack);			p->optmgmt_req.PRIM_type = T_OPTMGMT_REQ;			p->optmgmt_req.OPT_length = 0;			p->optmgmt_req.OPT_offset = 0;			p->optmgmt_req.MGMT_flags = T_NEGOTIATE;			goto do_ioctl;		case __TEST_O_TI_BIND:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  O_TI_BIND                    |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = O_TI_BIND;			ic.ic_len = sizeof(p->bind_ack);			p->bind_req.PRIM_type = T_BIND_REQ;			p->bind_req.ADDR_length = 0;			p->bind_req.ADDR_offset = 0;			p->bind_req.CONIND_number = 0;			goto do_ioctl;		case __TEST_O_TI_UNBIND:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  O_TI_UNBIND                  |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = O_TI_UNBIND;			ic.ic_len = sizeof(p->ok_ack);			p->unbind_req.PRIM_type = T_UNBIND_REQ;			goto do_ioctl;		case __TEST__O_TI_GETINFO:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  _O_TI_GETINFO                |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = _O_TI_GETINFO;			ic.ic_len = sizeof(p->info_ack);			p->info_req.PRIM_type = T_INFO_REQ;			goto do_ioctl;		case __TEST__O_TI_OPTMGMT:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  _O_TI_OPTMGMT                |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = _O_TI_OPTMGMT;			ic.ic_len = sizeof(p->optmgmt_ack);			p->optmgmt_req.PRIM_type = T_OPTMGMT_REQ;			p->optmgmt_req.OPT_length = 0;			p->optmgmt_req.OPT_offset = 0;			p->optmgmt_req.MGMT_flags = T_NEGOTIATE;			goto do_ioctl;		case __TEST__O_TI_BIND:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  _O_TI_BIND                   |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = _O_TI_BIND;			ic.ic_len = sizeof(p->bind_ack);			p->bind_req.PRIM_type = T_BIND_REQ;			p->bind_req.ADDR_length = 0;			p->bind_req.ADDR_offset = 0;			p->bind_req.CONIND_number = 0;			goto do_ioctl;		case __TEST__O_TI_UNBIND:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  _O_TI_UNBIND                 |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = _O_TI_UNBIND;			ic.ic_len = sizeof(p->ok_ack);			p->unbind_req.PRIM_type = T_UNBIND_REQ;			goto do_ioctl;		case __TEST__O_TI_GETMYNAME:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  _O_TI_GETMYNAME              |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = _O_TI_GETMYNAME;			ic.ic_len = sizeof(p->addr_ack);			p->addr_req.PRIM_type = T_ADDR_REQ;			goto do_ioctl;		case __TEST__O_TI_GETPEERNAME:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  _O_TI_GETPEERNAME            |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = _O_TI_GETPEERNAME;			ic.ic_len = sizeof(p->addr_ack);			p->addr_req.PRIM_type = T_ADDR_REQ;			goto do_ioctl;		case __TEST__O_TI_XTI_HELLO:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  _O_TI_XTI_HELLO              |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = _O_TI_XTI_HELLO;			ic.ic_len = 0;			goto do_ioctl;		case __TEST__O_TI_XTI_GET_STATE:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  _O_TI_XTI_GET_STATE          |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = _O_TI_XTI_GET_STATE;			ic.ic_len = 0;			goto do_ioctl;		case __TEST__O_TI_XTI_CLEAR_EVENT:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  _O_TI_XTI_CLEAR_EVENT        |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = _O_TI_XTI_CLEAR_EVENT;			ic.ic_len = 0;			goto do_ioctl;		case __TEST__O_TI_XTI_MODE:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  _O_TI_XTI_MODE               |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = _O_TI_XTI_MODE;			ic.ic_len = 0;			goto do_ioctl;		case __TEST__O_TI_TLI_MODE:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  _O_TI_TLI_MODE               |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = _O_TI_TLI_MODE;			ic.ic_len = 0;			goto do_ioctl;		case __TEST_TI_GETINFO:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_GETINFO                   |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_GETINFO;			ic.ic_len = sizeof(p->info_ack);			p->info_req.PRIM_type = T_INFO_REQ;			goto do_ioctl;		case __TEST_TI_OPTMGMT:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_OPTMGMT                   |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_OPTMGMT;			ic.ic_len = sizeof(p->optmgmt_ack);			p->optmgmt_req.PRIM_type = T_OPTMGMT_REQ;			p->optmgmt_req.OPT_length = 0;			p->optmgmt_req.OPT_offset = 0;			p->optmgmt_req.MGMT_flags = T_NEGOTIATE;			goto do_ioctl;		case __TEST_TI_BIND:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_BIND                      |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_BIND;			ic.ic_len = sizeof(p->bind_ack);			p->bind_req.PRIM_type = T_BIND_REQ;			p->bind_req.ADDR_length = 0;			p->bind_req.ADDR_offset = 0;			p->bind_req.CONIND_number = 0;			goto do_ioctl;		case __TEST_TI_UNBIND:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_UNBIND                    |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_UNBIND;			ic.ic_len = sizeof(p->ok_ack);			p->unbind_req.PRIM_type = T_UNBIND_REQ;			goto do_ioctl;		case __TEST_TI_GETMYNAME:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_GETMYNAME                 |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_GETMYNAME;			ic.ic_len = sizeof(p->addr_ack);			p->addr_req.PRIM_type = T_ADDR_REQ;			goto do_ioctl;		case __TEST_TI_GETPEERNAME:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_GETPEERNAME               |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_GETPEERNAME;			ic.ic_len = sizeof(p->addr_ack);			p->addr_req.PRIM_type = T_ADDR_REQ;			goto do_ioctl;		case __TEST_TI_SETMYNAME:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_SETMYNAME                 |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_SETMYNAME;			ic.ic_len = sizeof(p->conn_res);			p->conn_res.PRIM_type = T_CONN_RES;			p->conn_res.ACCEPTOR_id = 0;			p->conn_res.OPT_length = 0;			p->conn_res.OPT_offset = 0;			p->conn_res.SEQ_number = 0;			goto do_ioctl;		case __TEST_TI_SETPEERNAME:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_SETPEERNAME               |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_SETPEERNAME;			ic.ic_len = sizeof(p->conn_req);			p->conn_req.PRIM_type = T_CONN_REQ;			p->conn_req.DEST_length = 0;			p->conn_req.DEST_offset = 0;			p->conn_req.OPT_length = 0;			p->conn_req.OPT_offset = 0;			goto do_ioctl;		case __TEST_TI_SETMYNAME_DISC:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_SETMYNAME                 |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_SETMYNAME;			ic.ic_len = sizeof(p->discon_req);			p->discon_req.PRIM_type = T_DISCON_REQ;			p->discon_req.SEQ_number = 0;			goto do_ioctl;		case __TEST_TI_SETPEERNAME_DISC:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_SETPEERNAME               |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_SETPEERNAME;			ic.ic_len = sizeof(p->discon_req);			p->discon_req.PRIM_type = T_DISCON_REQ;			p->discon_req.SEQ_number = 0;			goto do_ioctl;		case __TEST_TI_SETMYNAME_DATA:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_SETMYNAME w/DATA          |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_SETMYNAME;			ic.ic_len = sizeof(p->conn_res) + sprintf(cbuf + sizeof(p->conn_res), "IO control test data.");			p->conn_res.PRIM_type = T_CONN_RES;			p->conn_res.ACCEPTOR_id = 0;			p->conn_res.OPT_length = 0;			p->conn_res.OPT_offset = 0;			p->conn_res.SEQ_number = 0;			goto do_ioctl;		case __TEST_TI_SETPEERNAME_DATA:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_SETPEERNAME w/DATA        |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_SETPEERNAME;			ic.ic_len = sizeof(p->conn_req) + sprintf(cbuf + sizeof(p->conn_res), "IO control test data.");			p->conn_req.PRIM_type = T_CONN_REQ;			p->conn_req.DEST_length = 0;			p->conn_req.DEST_offset = 0;			p->conn_req.OPT_length = 0;			p->conn_req.OPT_offset = 0;			goto do_ioctl;		case __TEST_TI_SETMYNAME_DISC_DATA:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_SETMYNAME w/DATA          |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_SETMYNAME;			ic.ic_len = sizeof(p->discon_req) + sprintf(cbuf + sizeof(p->conn_res), "IO control test data.");			p->discon_req.PRIM_type = T_DISCON_REQ;			p->discon_req.SEQ_number = 0;			goto do_ioctl;		case __TEST_TI_SETPEERNAME_DISC_DATA:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_SETPEERNAME w/DATA        |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_SETPEERNAME;			ic.ic_len = sizeof(p->discon_req) + sprintf(cbuf + sizeof(p->conn_res), "IO control test data.");			p->discon_req.PRIM_type = T_DISCON_REQ;			p->discon_req.SEQ_number = 0;			goto do_ioctl;		case __TEST_TI_SYNC:		{			union {				struct ti_sync_req req;				struct ti_sync_ack ack;			} *s = (typeof(s)) p;			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_SYNC                      |                    [%d]\n", state);				fflush(stdout);				lockf(fileno(stdout), F_ULOCK, 0);			}			ic.ic_cmd = TI_SYNC;			ic.ic_len = sizeof(*s);			s->req.tsr_flags = TSRF_INFO_REQ | TSRF_IS_EXP_IN_RCVBUF | TSRF_QLEN_REQ;			goto do_ioctl;		}		case __TEST_TI_GETADDRS:			if (verbose) {				lockf(fileno(stdout), F_LOCK, 0);				fprintf(stdout, "--ioctl(2)--------->|  |  TI_GETADDRS                  |                    [%d]\n", state);				fflush(stdout);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -