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

📄 iucv.c

📁 linux-2.6.15.6
💻 C
📖 第 1 页 / 共 5 页
字号:
 *        flags1_out: Options for path. *          IPNORPY - 0x10 specifies whether a reply is required *          IPPRTY - 0x20 specifies if you want to send priority message *         IPRMDATA - 0x80 specifies the data is contained in the parameter list *       residual_buffer - address points to the current list entry IUCV *                         is working on. *       residual_length - *              Contains one of the following values, if the receive buffer is: *               The same length as the message, this field is zero. *               Longer than the message, this field contains the number of *                bytes remaining in the buffer. *               Shorter than the message, this field contains the residual *                count (that is, the number of bytes remaining in the *                message that does not fit into the buffer. In this case *		  b2f0_result = 5. * Return: b2f0_result - return code from CP *         (-EINVAL) - buffer address is NULL */intiucv_receive_array (__u16 pathid,		    __u32 msgid, __u32 trgcls,		    iucv_array_t * buffer, ulong buflen,		    int *flags1_out,		    ulong * residual_buffer, ulong * residual_length){	iparml_db *parm;	ulong b2f0_result;	int i = 0, moved = 0, need_to_move = 8, dyn_len;	iucv_debug(2, "entering");	if (!buffer)		return -EINVAL;	parm = (iparml_db *)grab_param();	parm->ipbfadr1 = (__u32) ((ulong) buffer);	parm->ipbfln1f = (__u32) buflen;	parm->ipmsgid = msgid;	parm->ippathid = pathid;	parm->iptrgcls = trgcls;	parm->ipflags1 = (IPBUFLST | IPFGPID | IPFGMID | IPFGMCL);	b2f0_result = b2f0(RECEIVE, parm);	if (!b2f0_result || b2f0_result == 5) {		if (flags1_out) {			iucv_debug(2, "*flags1_out = %d", *flags1_out);			*flags1_out = (parm->ipflags1 & (~0x07));			iucv_debug(2, "*flags1_out = %d", *flags1_out);		}		if (!(parm->ipflags1 & IPRMDATA)) {	/*msg not in parmlist */			if (residual_length)				*residual_length = parm->ipbfln1f;			if (residual_buffer)				*residual_buffer = parm->ipbfadr1;		} else {			/* copy msg from parmlist to users array. */			while ((moved < 8) && (moved < buflen)) {				dyn_len =				    min_t (unsigned int,					 (buffer + i)->length, need_to_move);				memcpy ((char *)((ulong)((buffer + i)->address)),					((char *) &parm->ipbfadr1) + moved,					dyn_len);				moved += dyn_len;				need_to_move -= dyn_len;				(buffer + i)->address =				    	(__u32)				((ulong)(__u8 *) ((ulong)(buffer + i)->address)						+ dyn_len);				(buffer + i)->length -= dyn_len;				i++;			}			if (need_to_move)	/* buflen < 8 bytes */				b2f0_result = 5;			if (residual_length)				*residual_length = abs (buflen - 8);			if (residual_buffer) {				if (!moved)					*residual_buffer = (ulong) buffer;				else					*residual_buffer =					    (ulong) (buffer + (i - 1));			}		}	}	release_param(parm);	iucv_debug(2, "exiting");	return b2f0_result;}/** * iucv_reject: * @pathid: Path identification number. * @msgid:  Message ID of the message to reject. * @trgcls: Target class of the message to reject. * Returns: return code from CP * * Refuses a specified message. Between the time you are notified of a * message and the time that you complete the message, the message may * be rejected. */intiucv_reject (__u16 pathid, __u32 msgid, __u32 trgcls){	iparml_db *parm;	ulong b2f0_result = 0;	iucv_debug(1, "entering");	iucv_debug(1, "pathid = %d", pathid);	parm = (iparml_db *)grab_param();	parm->ippathid = pathid;	parm->ipmsgid = msgid;	parm->iptrgcls = trgcls;	parm->ipflags1 = (IPFGMCL | IPFGMID | IPFGPID);	b2f0_result = b2f0(REJECT, parm);	release_param(parm);	iucv_debug(1, "b2f0_result = %ld", b2f0_result);	iucv_debug(1, "exiting");	return b2f0_result;}/* * Name: iucv_reply * Purpose: This function responds to the two-way messages that you *          receive. You must identify completely the message to *          which you wish to reply. ie, pathid, msgid, and trgcls. * Input: pathid - path identification number *        msgid - specifies the message ID. *        trgcls - specifies target class *        flags1 - option for path *                 IPPRTY- 0x20 - specifies if you want to send priority message *        buffer - address of reply buffer *        buflen - length of reply buffer * Output: ipbfadr2 - Address of buffer updated by the number *                    of bytes you have moved. *         ipbfln2f - Contains one of the following values: *              If the answer buffer is the same length as the reply, this field *               contains zero. *              If the answer buffer is longer than the reply, this field contains *               the number of bytes remaining in the buffer. *              If the answer buffer is shorter than the reply, this field contains *               a residual count (that is, the number of bytes remianing in the *               reply that does not fit into the buffer. In this *                case b2f0_result = 5. * Return: b2f0_result - return code from CP *         (-EINVAL) - buffer address is NULL */intiucv_reply (__u16 pathid,	    __u32 msgid, __u32 trgcls,	    int flags1,	    void *buffer, ulong buflen, ulong * ipbfadr2, ulong * ipbfln2f){	iparml_db *parm;	ulong b2f0_result;	iucv_debug(2, "entering");	if (!buffer)		return -EINVAL;	parm = (iparml_db *)grab_param();	parm->ipbfadr2 = (__u32) ((ulong) buffer);	parm->ipbfln2f = (__u32) buflen;	/* length of message */	parm->ippathid = pathid;	parm->ipmsgid = msgid;	parm->iptrgcls = trgcls;	parm->ipflags1 = (__u8) flags1;	/* priority message */	b2f0_result = b2f0(REPLY, parm);	if ((!b2f0_result) || (b2f0_result == 5)) {		if (ipbfadr2)			*ipbfadr2 = parm->ipbfadr2;		if (ipbfln2f)			*ipbfln2f = parm->ipbfln2f;	}	release_param(parm);	iucv_debug(2, "exiting");	return b2f0_result;}/* * Name: iucv_reply_array * Purpose: This function responds to the two-way messages that you *          receive. You must identify completely the message to *          which you wish to reply. ie, pathid, msgid, and trgcls. *          The array identifies a list of addresses and lengths of *          discontiguous buffers that contains the reply data. * Input: pathid - path identification number *        msgid - specifies the message ID. *        trgcls - specifies target class *        flags1 - option for path *                 IPPRTY- specifies if you want to send priority message *        buffer - address of array of reply buffers *        buflen - total length of reply buffers * Output: ipbfadr2 - Address of buffer which IUCV is currently working on. *         ipbfln2f - Contains one of the following values: *              If the answer buffer is the same length as the reply, this field *               contains zero. *              If the answer buffer is longer than the reply, this field contains *               the number of bytes remaining in the buffer. *              If the answer buffer is shorter than the reply, this field contains *               a residual count (that is, the number of bytes remianing in the *               reply that does not fit into the buffer. In this *               case b2f0_result = 5. * Return: b2f0_result - return code from CP *             (-EINVAL) - buffer address is NULL*/intiucv_reply_array (__u16 pathid,		  __u32 msgid, __u32 trgcls,		  int flags1,		  iucv_array_t * buffer,		  ulong buflen, ulong * ipbfadr2, ulong * ipbfln2f){	iparml_db *parm;	ulong b2f0_result;	iucv_debug(2, "entering");	if (!buffer)		return -EINVAL;	parm = (iparml_db *)grab_param();	parm->ipbfadr2 = (__u32) ((ulong) buffer);	parm->ipbfln2f = buflen;	/* length of message */	parm->ippathid = pathid;	parm->ipmsgid = msgid;	parm->iptrgcls = trgcls;	parm->ipflags1 = (IPANSLST | flags1);	b2f0_result = b2f0(REPLY, parm);	if ((!b2f0_result) || (b2f0_result == 5)) {		if (ipbfadr2)			*ipbfadr2 = parm->ipbfadr2;		if (ipbfln2f)			*ipbfln2f = parm->ipbfln2f;	}	release_param(parm);	iucv_debug(2, "exiting");	return b2f0_result;}/* * Name: iucv_reply_prmmsg * Purpose: This function responds to the two-way messages that you *          receive. You must identify completely the message to *          which you wish to reply. ie, pathid, msgid, and trgcls. *          Prmmsg signifies the data is moved into the *          parameter list. * Input: pathid - path identification number *        msgid - specifies the message ID. *        trgcls - specifies target class *        flags1 - option for path *                 IPPRTY- specifies if you want to send priority message *        prmmsg - 8-bytes of data to be placed into the parameter *                 list. * Output: NA * Return: b2f0_result - return code from CP*/intiucv_reply_prmmsg (__u16 pathid,		   __u32 msgid, __u32 trgcls, int flags1, __u8 prmmsg[8]){	iparml_dpl *parm;	ulong b2f0_result;	iucv_debug(2, "entering");	parm = (iparml_dpl *)grab_param();	parm->ippathid = pathid;	parm->ipmsgid = msgid;	parm->iptrgcls = trgcls;	memcpy(parm->iprmmsg, prmmsg, sizeof (parm->iprmmsg));	parm->ipflags1 = (IPRMDATA | flags1);	b2f0_result = b2f0(REPLY, parm);	release_param(parm);	iucv_debug(2, "exiting");	return b2f0_result;}/** * iucv_resume: * @pathid:    Path identification number * @user_data: 16-byte of user data * * This function restores communication over a quiesced path. * Returns: return code from CP */intiucv_resume (__u16 pathid, __u8 user_data[16]){	iparml_control *parm;	ulong b2f0_result = 0;	iucv_debug(1, "entering");	iucv_debug(1, "pathid = %d", pathid);	parm = (iparml_control *)grab_param();	memcpy (parm->ipuser, user_data, sizeof (*user_data));	parm->ippathid = pathid;	b2f0_result = b2f0(RESUME, parm);	release_param(parm);	iucv_debug(1, "exiting");	return b2f0_result;}/* * Name: iucv_send * Purpose: sends messages * Input: pathid - ushort, pathid *        msgid  - ulong *, id of message returned to caller *        trgcls - ulong, target message class *        srccls - ulong, source message class *        msgtag - ulong, message tag *	  flags1  - Contains options for this path. *		IPPRTY - Ox20 - specifies if you want to send a priority message. *        buffer - pointer to buffer *        buflen - ulong, length of buffer * Output: b2f0_result - return code from b2f0 call *         msgid - returns message id */intiucv_send (__u16 pathid, __u32 * msgid,	   __u32 trgcls, __u32 srccls,	   __u32 msgtag, int flags1, void *buffer, ulong buflen){	iparml_db *parm;	ulong b2f0_result;	iucv_debug(2, "entering");	if (!buffer)		return -EINVAL;	parm = (iparml_db *)grab_param();	parm->ipbfadr1 = (__u32) ((ulong) buffer);	parm->ippathid = pathid;	parm->iptrgcls = trgcls;	parm->ipbfln1f = (__u32) buflen;	/* length of message */	parm->ipsrccls = srccls;	parm->ipmsgtag = msgtag;	parm->ipflags1 = (IPNORPY | flags1);	/* one way priority message */	b2f0_result = b2f0(SEND, parm);	if ((!b2f0_result) && (msgid))		*msgid = parm->ipmsgid;	release_param(parm);	iucv_debug(2, "exiting");	return b2f0_result;}/* * Name: iucv_send_array * Purpose: This function transmits data to another application. *          The contents of buffer is the address of the array of *          addresses and lengths of discontiguous buffers that hold *          the message text. This is a one-way message and the *          receiver will not reply to the message. * Input: pathid - path identification number *        trgcls - specifies target class *        srccls - specifies the source message class *        msgtag - specifies a tag to be associated witht the message *        flags1 - option for path *                 IPPRTY- specifies if you want to send priority message *        buffer - address of array of send buffers *        buflen - total length of send buffers * Output: msgid - specifies the message ID. * Return: b2f0_result - return code from CP *         (-EINVAL) - buffer address is NULL */intiucv_send_array (__u16 pathid,		 __u32 * msgid,		 __u32 trgcls,		 __u32 srccls,		 __u32 msgtag, int flags1, iucv_array_t * buffer, ulong buflen){	iparml_db *parm;	ulong b2f0_result;	iucv_debug(2, "entering");	if (!buffer)		return -EINVAL;	parm = (iparml_db *)grab_param();	parm->ippathid = pathid;	parm->iptrgcls = trgcls;	parm->ipbfadr1 = (__u32) ((ulong) buffer);	parm->ipbfln1f = (__u32) buflen;	/* length of message */	parm->ipsrccls = srccls;	parm->ipmsgtag = msgtag;	parm->ipflags1 = (IPNORPY | IPBUFLST | flags1);	b2f0_result = b2f0(SEND, parm);	if ((!b2f0_result) && (msgid))		*msgid = parm->ipmsgid;	release_param(parm);	iucv_debug(2, "exiting");	return b2f0_result;}/* * Name: iucv_send_prmmsg * Purpose: This function transmits data to another application. *          Prmmsg specifies that the 8-bytes of data are to be moved *          into the parameter list. This is a one-way message and the *          receiver will not reply to the message. * Input: pathid - path identification number *        trgcls - specifies target class *        srccls - specifies the source message class *        msgtag - specifies a tag to be associated with the message *        flags1 - option for path *                 IPPRTY- specifies if you want to send priority message *        prmmsg - 8-bytes of data to be placed into parameter list * Output: msgid - specifies the message ID. * Return: b2f0_result - return code from CP*/intiucv_send_prmmsg (__u16 pathid,		  __u32 * msgid,		  __u32 trgcls,		  __u32 srccls, __u32 msgtag, int flags1, __u8 prmmsg[8]){	iparml_dpl *parm;	ulong b2f0_result;	iucv_debug(2, "entering");	parm = (iparml_dpl *)grab_param();	parm->ippathid = pathid;	parm->iptrgcls = trgcls;	parm->ipsrccls = srccls;	parm->ipmsgtag = msgtag;	parm->ipflags1 = (IPRMDATA | IPNORPY | flags1);	memcpy(parm->iprmmsg, prmmsg, sizeof(parm->iprmmsg));

⌨️ 快捷键说明

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