亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mnpintrf.c

?? 根據(jù)MICROCOM網(wǎng)絡(luò)協(xié)議進(jìn)行網(wǎng)絡(luò)開發(fā)的C語言程序庫
?? C
字號:
/*==========================================================================

       		        The Microcom MNP Library
					(Microsoft C Version)

----------------------------------------------------------------------------

	            MNPINTRF - MNP Link Interface Routines

----------------------------------------------------------------------------

	Modification History

	3/30/87 - Compuserve V1.0

==========================================================================*/

/* Header files
*/
#include <dos.h>
#include <mnpdat.h>

/* Local definitions
*/
#define NOWAIT		0
#define BIT3SET(bit)		(lcb.status_3 & bit)
#define BIT1SET(bit)		(lcb.status_1 & bit)
#define SETBIT1(bit)		lcb.status_1 |= bit;
#define SETBIT3(bit)		lcb.status_3 |= bit;

USIGN_8 get_sbuf();
void mnpdisconnect();
SIGN_16 ia_send();

/* Link status block
*/
struct link_stat_blk
	{
	USIGN_16 p_status;
	USIGN_16 l_status;
	USIGN_16 s_count;
	USIGN_16 r_count;
	USIGN_16 all_sent;
	};

/* External references
*/
extern struct BUFFER ftb;
extern struct link_ctl_blk lcb;	/* link control block */
extern struct TIMERS tmr;

extern USIGN_16 sf_busy,				/* 'send framer busy' flag */
	sf_lt,					/* 'LT in progress' flag */
	sf_len,					/* send framer length */
	tbcnt;					/* unacked transmit buf count */
extern USIGN_8 chan_no;			/* hardware channel no. */

/* Data declarations
*/
struct MNP_CB mnpcb;			/* MNP control block */

USIGN_8 rbuf[RBUF_LEN];			/* receive buffer */
USIGN_8 *rb_iptr,				/* rcv insert ptr */
	*rb_rptr; 				/* rcv remove ptrs */
USIGN_16 rb_cnt;				/* rcv count */

USIGN_8 sbuf[SBUF_LEN];			/* send buffer */
USIGN_8 *sb_iptr,				/* snd insert ptr */
	*sb_rptr;					/* snd remove ptr */
USIGN_16 sb_cnt;				/* snd count */

USIGN_8 *iatbiptr;				/* rcv temp insert ptr */
struct BLST *iatb_struct;		/* transmit buffers */

USIGN_8 baudrate;				/* line speed */

/*GLOBAL***********************************************************************

	mnpconnect - establish an MNP link-connection

	synopsis:	retcode = mnpconnect(rate,format,port,mode);

	input:	int rate,		physical-connection speed 
			    format, 	character format
			    port,		comm port
			    mode;		originator/answerer

	output:	int retcode;	establishment result

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

SIGN_16 mnpconnect(rate,format,port,mode)

USIGN_16 rate,
    format,
    port,
    mode;
{

/* Initialize send, receive counts and buffer pointers.
*/
rb_cnt = sb_cnt = 0;
rb_iptr = rb_rptr = rbuf;
sb_iptr = sb_rptr = sbuf;

/* Initialize physical-connection variables
*/
baudrate = rate;
chan_no = port-1;
mnpcb.parity = format;

/* Attempt link establishment and exit.  as_connect return code is
** returned as function value.
*/
return(as_connect(&mnpcb,mode));

}

/*GLOBAL***********************************************************************

	mnpdisconnect - terminate an MNP link-connection

	synopsis:	mnpdisconnect();

	input:	none

	output:	none
		       ******************************************************************************/
void mnpdisconnect()
{

/* Just call mnpllvl routine, signalling link-user initiated termination.
*/
as_disconnect(255,0);

}


/*GLOBAL***********************************************************************

	mnpreceive - receive data on an MNP link-connection

	synopsis:	retcode = mnpreceive(&buffer,buflen);

	input:	unsigned char *buffer;	pointer to user buffer
			int buflen;			length of user buffer

	output:	int retcode;	if positive, the number of data bytes
						copied into the user data buffer;
						if negative, link error code

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

SIGN_16 mnpreceive(bufptr,buflen)

USIGN_8 *bufptr;
USIGN_16 buflen;
{

SIGN_16 retcode;
register USIGN_16 count;
register USIGN_8 c;

/* Maintain the link-connection.  On link error, return with the 
** error code as the function value.
*/
if (retcode = as_link())
	return(retcode);
if (retcode = ia_send(&mnpcb))
	return(retcode);

/* Initialize
*/
count = 0;

/* If there is receive data, copy as much as possible into the
** user's buffer.  Note that if a 7-bit character format has been
** selected for the link, then the high-order bit of the data octet
** is set to 0.
*/
while ((rb_cnt > 0) && (buflen > 0))
	{
     buflen--;
     count++;
     rb_cnt--;
     c = *rb_rptr++;
     if (mnpcb.parity) c &= 0x7f;
     *bufptr++ = c;
     if (rb_rptr >= (rbuf + RBUF_LEN))
		rb_rptr = rbuf;
     }

/* Maintain the link-connection.  On link error, return with error
** code as function value.
*/
if (retcode = as_link())
	return(retcode);
if (retcode = ia_send(&mnpcb))
	return (retcode);

/* Exit.  Function value is the number of octets moved into the user
** buffer.
*/
return(count);
}

/*GLOBAL***********************************************************************

	mnpsend - send data on an MNP link-connection

	synposis:	retcode = mnpsend(&buffer,buflen);

	input:	unsigned char *buffer; 	pointer to user data buffer
	     	int buflen;			length of user data buffer

	output:   int retcode - if positive, the number of data bytes
		                   copied from the user data buffer; 
                             if negative, link error code

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

SIGN_16 mnpsend(bufptr,buflen)

USIGN_8 *bufptr;
USIGN_16 buflen;
{

SIGN_16 retcode;
register USIGN_16 count;

/* Maintain the link-connection.
*/
if (retcode = as_link())
	return(retcode);

/* Initialize
*/
count = 0;

/* Copy as much user data as possible into the send ring buffer.
*/
while ((sb_cnt < SBUF_LEN) && (buflen > 0))
	{
	count++;
	sb_cnt++;
	buflen--;
	*sb_iptr++ = (unsigned char) setpar(*bufptr++,mnpcb.parity);
	if (sb_iptr >= sbuf + SBUF_LEN)
		sb_iptr = sbuf;
	}

/* Try to send an LT LPDU or continue one in progress and maintain
** the link once again.
*/
if (retcode = ia_send(&mnpcb))
	return(retcode);
if (retcode = as_link())
	return(retcode);

/* Exit
*/
return(count);
}

/*GLOBAL***********************************************************************

	mnpstatus - get link-connection status information

	synopsis:	mnpstatus(&lstat_blk);

	input:	struct link_stat_blk *lstat_blk;	pointer to status block

	output:	none

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

mnpstatus(lsb)

struct link_stat_blk *lsb;
{

/* Maintain the link-connection.  Here ignore any link errors as these
** will be reflected in status values.
*/
as_link();
ia_send(&mnpcb);

/* Build link status block.
*/
if (lne_stat())
    lsb->p_status = FALSE;
else
    lsb->p_status = TRUE;

if (BIT1SET(LINK_EST))
    lsb->l_status = TRUE;
else
    lsb->l_status = FALSE;

/* Number of bytes free in send buffer. By definition this number is 
** the size of the send buffer when the link-connection is not 
** established.
*/
if (lsb->l_status == FALSE)
	sb_cnt = 0;
lsb->s_count  = SBUF_LEN - sb_cnt;

/* Amount of data in receive buffer
*/
lsb->r_count = rb_cnt;

/* Data is 'all sent' if the user send buffer is empty and all data
** messages have been acknowledged.
*/
if ((sb_cnt == 0) && (tbcnt == 0))
	lsb->all_sent = TRUE;
else
	lsb->all_sent = FALSE;

}

/*GLOBAL********************************************************************

	mnpbreak - send a break signal (using MNP attention)

	synopsis:	retcode = mnpbreak();

	input:	none

	output:	int retcode;	link error code

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

SIGN_16 mnpbreak()

{
SIGN_16 retcode;

/* If attention service has not been negotiated for this link-connection,
** return.  Function value = attention not supported.
*/
if (lcb.prot_level != 2)
	return(-75);

/* Maintain the link.  Return link error code if link has failed.
*/
if (retcode = as_link())
	return(retcode);

/* If an attention has already been sent and not yet acknowledged, just
** return.  Funtion value = attention in progress.  
*/
if (BIT3SET(LN_SENT))
	return(-76);

/* Ok to send a destructive break using the MNP attention mechanism.
*/
clr_int();
rb_iptr = rb_rptr = rbuf;
sb_iptr = sb_rptr = sbuf;
rb_cnt = sb_cnt = NULL;

SETBIT3(LN_SENT)

link_reset();
dphase_init();

SETBIT3(LN_TIMER)
tmr.ln = lcb.lt_tmr;

++lcb.ln_ssn;
lcb.ln_stype=1;
set_int();
return(lpdu_send(LN,NOWAIT));
}

/*LOCAL------------------------------------------------------------------------

	ia_send - build an LT or add data to one in progress

-----------------------------------------------------------------------------*/

SIGN_16 ia_send(mnpcb)

struct MNP_CB *mnpcb;
{

SIGN_16 retcode;

/* Just exit if there is nothing to send.
*/
if (sb_cnt == 0)
	return(SUCCESS);

/* Also just return if an attention is in progress.
*/
if (BIT3SET(LN_RECEIVED) || BIT3SET(LN_SENT))
	return(SUCCESS);

/* If the send framer is not busy and there is remote credit,
** start an LT LPDU.
*/
clr_int();
if (!sf_busy)
	{
	set_int();
	if (lcb.rem_credit == 0)
		return(SUCCESS);
	if (get_b(mnpcb->ftb, &iatb_struct) == FAILURE)
		return(SUCCESS);

	iatb_struct->len = 5;
	iatbiptr = iatb_struct->bptr;
	*iatbiptr++ = 4;
	*iatbiptr++ = LT;
	*iatbiptr++ = 1;
	*iatbiptr++ = 1;
	*iatbiptr++ = ++lcb.lt_ssn;

/* Copy bytes out of the send buffer as long as there are any and there
** is space in the LT LPDU (max is 64 + header of 5 = 69 for Class 3)
*/
	while ((iatb_struct->len < 69) && (sb_cnt > 0))
		{
		iatb_struct->len++;
		*iatbiptr++ = get_sbuf();
		}

/* Adjust remote credit.
*/
	clr_int();
	if (--lcb.rem_credit < 0)
		 lcb.rem_credit = 0;
	tbcnt++;
	set_int();

/* Now start sending an LT LPDU.  Initiate the LT retransmission timer
** if it is not already active.
*/
	if (retcode = send_pdu(LT, NOWAIT, iatb_struct))
		return(retcode);
	sf_lt = 1;

	if (!BIT1SET(RET_TIMER))
		{
		SETBIT1(RET_TIMER)
		tmr.lt = lcb.lt_tmr;
		}

	if (ftb.used == 1)
		ftb.used_lst = iatb_struct;
	}

/* If the send framer is busy and it is busy with an LT LPDU, try to add
** as much send buffer data as possible to the current LT.
*/
else
	{
	if (sf_lt == 1)
		{
		while ((iatb_struct->len < 69) && (sb_cnt > 0))
			{
			iatb_struct->len++;
			sf_len++;
			*iatbiptr++ = get_sbuf();
			}
		}
	}

/* Be sure that interrupts are re-enabled.
*/
set_int();

/* Exit
*/
return(SUCCESS);
}

/*LOCAL------------------------------------------------------------------------

	get_sbuf - get a data octet from the send buffer

-----------------------------------------------------------------------------*/

USIGN_8 get_sbuf()
{

register USIGN_8 c;

/* Remove an octet from the send buffer and return as function value.
** This routine handles the buffer count and pointer into the circular
** buffer.
*/
sb_cnt--;	
c = *sb_rptr++;
if (sb_rptr >= sbuf + SBUF_LEN)
	sb_rptr = sbuf;

/* Exit
*/
return(c);
}


?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久国产一区二区三区四区| 91蜜桃婷婷狠狠久久综合9色| 亚洲激情网站免费观看| 久久亚洲欧美国产精品乐播| 26uuu久久天堂性欧美| 精品久久久久久综合日本欧美| 欧美一区在线视频| 精品国产乱码久久久久久免费| 欧美一二三区在线| 日韩一区二区免费电影| 精品日韩欧美在线| 亚洲成av人片www| 亚洲国产精品人人做人人爽| 亚洲综合网站在线观看| 日韩黄色一级片| 国产自产v一区二区三区c| 高清国产一区二区| 91在线精品秘密一区二区| 欧美在线小视频| 日韩欧美亚洲国产另类| 久久久久久久综合狠狠综合| 国产精品福利一区| 午夜久久福利影院| 激情成人综合网| 97精品久久久久中文字幕| 欧美理论电影在线| 久久伊人蜜桃av一区二区| 中文字幕一区免费在线观看| 亚洲一区二区欧美日韩| 久久成人久久鬼色| 色综合久久六月婷婷中文字幕| 欧美精品在线观看播放| 久久在线观看免费| 亚洲综合视频在线| 国产传媒一区在线| 欧美精品xxxxbbbb| 久久久久97国产精华液好用吗| 亚洲美女视频在线观看| 精品在线你懂的| 欧美亚洲一区二区在线| 久久精品欧美日韩| 五月综合激情网| 不卡影院免费观看| 欧美tk—视频vk| 亚洲国产一区二区三区| 粉嫩高潮美女一区二区三区| 欧美日韩一区二区三区高清| 国产亚洲婷婷免费| 蜜桃精品视频在线| 欧美亚洲高清一区| 国产精品国产精品国产专区不片 | 韩国成人精品a∨在线观看| 91麻豆swag| 国产精品视频第一区| 欧美aaaaa成人免费观看视频| 色婷婷国产精品| 国产精品美女视频| 国产乱子轮精品视频| 国产一区啦啦啦在线观看| 一本大道av伊人久久综合| 久久久久亚洲蜜桃| 美腿丝袜亚洲综合| 欧美日韩不卡一区二区| 亚洲免费视频中文字幕| 99在线热播精品免费| 26uuu精品一区二区| 青青草国产成人99久久| 欧美一级理论片| 日韩制服丝袜先锋影音| 欧美日韩五月天| 亚洲国产精品久久久男人的天堂 | 国产精品久久影院| 盗摄精品av一区二区三区| 久久综合国产精品| 韩日精品视频一区| 欧美精品一区二区精品网| 久久99日本精品| 久久午夜色播影院免费高清 | 中文字幕免费不卡在线| 国产一区二区在线视频| 久久在线观看免费| 国产不卡视频一区二区三区| 久久久久久影视| 99久久久精品| 亚洲免费观看视频| 欧美日韩国产在线观看| 免费在线看一区| 久久免费看少妇高潮| 高清beeg欧美| 亚洲精品视频免费看| 欧美日韩国产高清一区二区 | 99精品欧美一区二区三区小说| 亚洲桃色在线一区| 欧美三级视频在线播放| 久久精品久久综合| 国产精品美女一区二区| 欧美亚洲自拍偷拍| 韩国精品久久久| 中文字幕亚洲精品在线观看| 久久久精品国产99久久精品芒果| 国产成人综合视频| 亚洲精品国产视频| 日韩女优av电影| 99久久久久久99| 蜜桃av一区二区在线观看| 国产免费成人在线视频| 欧美无砖砖区免费| 国产美女在线精品| 亚洲v精品v日韩v欧美v专区| 久久久亚洲国产美女国产盗摄| 99久久精品国产观看| 免费久久99精品国产| 欧美极品aⅴ影院| 8x福利精品第一导航| 国产v综合v亚洲欧| 视频一区欧美精品| **性色生活片久久毛片| 日韩欧美一级片| 欧美综合一区二区三区| 麻豆精品久久久| 一区二区三区在线视频免费观看 | 韩国女主播一区| 夜夜爽夜夜爽精品视频| 久久久高清一区二区三区| 欧美性猛交一区二区三区精品| 国产精品一区二区三区99| 亚洲成人tv网| 日韩美女久久久| 精品国产电影一区二区| 欧美日韩国产欧美日美国产精品| 菠萝蜜视频在线观看一区| 久久精品国产亚洲一区二区三区| 亚洲精品日韩综合观看成人91| 国产日韩在线不卡| 精品日本一线二线三线不卡| 91视频在线观看| 精品久久久久香蕉网| 3atv在线一区二区三区| 欧美性生活大片视频| 99精品久久免费看蜜臀剧情介绍| 国产精品一二三四区| 精品综合免费视频观看| 蜜臀av亚洲一区中文字幕| 婷婷亚洲久悠悠色悠在线播放| 亚洲精品乱码久久久久久| 椎名由奈av一区二区三区| 国产精品久线在线观看| 国产精品女同一区二区三区| 久久久99精品免费观看| 久久精品日韩一区二区三区| 精品国一区二区三区| 精品少妇一区二区三区在线视频| 日韩一区二区三区四区五区六区| 欧美人动与zoxxxx乱| 欧美精三区欧美精三区| 欧美乱妇15p| 日韩一区二区在线看| 精品久久久久久综合日本欧美| 精品欧美黑人一区二区三区| 日韩女优视频免费观看| 2017欧美狠狠色| 欧美国产日韩在线观看| 国产精品久久久爽爽爽麻豆色哟哟| 日本一二三四高清不卡| 免费的国产精品| 国产一区在线不卡| 成人黄动漫网站免费app| 91在线高清观看| 欧美日韩国产a| 精品国产伦理网| 欧美高清在线视频| 亚洲男人天堂av网| 奇米影视一区二区三区小说| 国产自产v一区二区三区c| 不卡欧美aaaaa| 欧美日本一区二区在线观看| 日韩精品一区二区三区中文精品| www一区二区| 一区二区三区精品| 日本亚洲欧美天堂免费| 国产一区二区在线观看免费| 99精品久久99久久久久| 欧美一级生活片| 国产精品你懂的在线| 亚洲不卡一区二区三区| 国产精品99久久不卡二区| 91成人免费在线| 久久久精品天堂| 亚洲国产aⅴ天堂久久| 国产成人av电影在线| 欧美亚洲综合一区| 亚洲国产精品成人综合| 亚洲国产一区二区a毛片| 国产成人精品免费在线| 欧美日韩精品福利| 国产精品美女一区二区三区| 免费观看在线色综合| 在线视频国产一区| 国产欧美精品一区| 乱一区二区av|