📄 equeue.c
字号:
}
else
{
tmoflag = 0;
tqe_wait = (tqe_t *)NU_NULL;
}
/* Determine if the message was received successfully. */
if (status == NU_SUCCESS)
{
if (!tmoflag)
{
msg_class = (int16)(Receive_Message[0] >> 8);
event = (Receive_Message[0] & 0xFF);
dat = (uint16)Receive_Message[2];
}
sw = (msg_class << 8) | event; /* msg_class and event combination */
/* switch on the msg_class/event combination */
switch (sw)
{
default:
break;
case CONCLASS*256+CONNULL:
break;
/*********** CONNECTION CLASS **********************/
case CONCLASS*256+CONFAIL: /* connection attempt failed */
case CONCLASS*256+CONOPEN: /* successful connect attempt */
// for debug only.
if (sw == CONCLASS*256+CONOPEN )
{
sprintf(buffer,"que checked:%u-%u",syntimes,++syntimes_add);
// __TextOut(10,160,12,buffer);
}
/* get a pointer into the port list table at the
entry pointed to by dat in the event queue */
prt=portlist[dat];
/* return control to the waiting task */
#ifdef PLUS
if (prt->TXTask != NU_NULL)
NU_Resume_Task(prt->TXTask);
#else /* !PLUS */
if (prt->TXTask != -1)
NU_Start(prt->TXTask);
#endif /* !PLUS */
break;
case CONCLASS*256+CONCLOSE: /* connection is closed */
/* see if a task was waiting on data */
prt = portlist[dat];
/* Is there an event set to transmit a partial packet.
If so clear that event. */
if (prt->xmitFlag == NU_SET)
{
Stimerunset (CONCLASS, CONTX, prt->pindex,
(int32)1);
prt->xmitFlag = NU_CLEAR;
}
#ifdef PLUS
if (prt->RXTask != NU_NULL)
{
/* restart the waiting task */
NU_Resume_Task(prt->RXTask);
}
if (prt->TXTask != NU_NULL)
{
/* restart the waiting task */
sprintf(buffer,"Reclosed:%u-%u",syntimes,++syntimes_add);
// __TextOut(10,240,12,buffer);
NU_Resume_Task(prt->TXTask);
}
else
{
sprintf(buffer,"Reclosed:%u-%u",syntimes,syntimes_add);
// __TextOut(10,360,12,buffer);
}
#else /* !PLUS */
if (prt->RXTask != -1)
{
/* restart the waiting task */
NU_Start(prt->RXTask);
}
if (prt->TXTask != -1)
{
/* restart the waiting task */
NU_Start(prt->TXTask);
}
#endif /* !PLUS */
break;
case CONCLASS*256+CONDATA:
/* get a pointer into the port list table at the
entry pointed to by dat in the event queue */
prt=portlist[dat];
/* return control to the waiting task */
#ifdef PLUS
if (prt->RXTask != NU_NULL)
NU_Resume_Task(prt->RXTask);
#else /* !PLUS */
if (prt->RXTask != -1)
NU_Start(prt->RXTask);
#endif /* !PLUS */
break;
case CONCLASS*256+TCPACK:
/* An ack needs to be sent. */
/* Get a pointer to the port. */
prt = portlist[dat];
/* Clear the ACK timer flag in the port. */
prt->portFlags &= (~ACK_TIMER_SET);
/* Send the ack. */
tcp_sendack (prt, 0);
break;
case CONCLASS*256+CONTX:
/* get a pointer into the port list table at the
entry pointed to by dat in the event queue */
prt = portlist[dat];
if ( (prt->xmitFlag == NU_SET) &&
(prt->out.nextPacket != NU_NULL) )
{
prt->tcpout.t.flags |= TPUSH;
tcp_xmit(prt, prt->out.nextPacket);
prt->out.nextPacket = (BUFFER *)prt->out.nextPacket->next;
prt->xmitFlag = NU_CLEAR;
}
break;
case CONCLASS*256+WINPROBE:
/* Get a pointer to the port. */
prt = portlist[dat];
/* restart the waiting task */
#ifdef PLUS
if (prt->TXTask != NU_NULL)
{
// sprintf(buffer,"ReWinpro:%u-%u",syntimes,++syntimes_add);
// __TextOut(10,280,12,buffer);
NU_Resume_Task(prt->TXTask);
}
#else
if (prt->TXTask != -1)
NU_Start(prt->TXTask);
#endif
break;
case CONCLASS*256+SELECT:
NU_Resume_Task((NU_TASK *)dat);
#if 0
/* Get a pointer to the port. */
prt = portlist[dat];
#ifdef PLUS
if (prt->RXTask != NU_NULL)
NU_Resume_Task(prt->RXTask);
#else
if (prt->RXTask != -1)
NU_Start(prt->RXTask);
#endif
#endif
break;
case CONCLASS*256+UDPSELECT:
/* Get a pointer to the port. */
uprt = uportlist[dat];
uprt->uportFlags &= (~SELECT_SET);
#ifdef PLUS
if (uprt->RXTask != NU_NULL)
NU_Resume_Task(uprt->RXTask);
#else
if (uprt->RXTask != -1)
NU_Start(uprt->RXTask);
#endif
break;
#if RARP_INCLUDED
case CONCLASS*256+RARP_REQUEST:
ARP_Event(dat);
break;
#endif /* RARP_INCLUDED */
case CONCLASS*256+CONRX:
demux(1);
break;
/********************** USER CLASS *************************/
case USERCLASS*256+UDPDATA:
/* get a pointer into the port list table at the
entry pointed to by dat in the event queue */
uprt = uportlist[dat];
if (uprt != NU_NULL)
{
/* return control to the waiting task */
#ifdef PLUS
if (uprt->RXTask != NU_NULL)
NU_Resume_Task(uprt->RXTask);
#else /* !PLUS */
if (uprt->RXTask != -1)
NU_Start(uprt->RXTask);
#endif /* !PLUS */
}
break;
/********************** ICMP CLASS **********************/
case ICMPCLASS*256+IREDIR:
q=&portlist[0];
for(u=0; u<NPORTS; u++,q++)
{
prt=*q;
if (comparen (prt->tcpout.i.ipdest, nnicmpsave, 4))
{
pc = getdlayer (nnicmpnew);
if (pc != NU_NULL)
{
memcpy ((void *)prt->tcpout.d.dest,
(const void *)pc,
DADDLEN);
}
}
} /* end for loop */
break;
} /* end switch on msg_class/event combination */
} /* end if status is NU_SUCCESS */
/* added 11/3/92 - during ATI mods */
#ifdef PLUS
NU_Release_Semaphore(&TCP_Resource);
#else /* !PLUS */
NU_Release_Resource(TCP_Resource);
#endif /* !PLUS */
} /* end while */
} /* end NU_EventDispatcher */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -