📄 equeue.c
字号:
case WINPROBE:
/* Get a pointer to the socket. */
if ((sock_ptr = SCK_Sockets[dat]) != NU_NULL)
{
/* restart the waiting task */
if (sock_ptr->s_TXTask != NU_NULL)
NU_Resume_Task(sock_ptr->s_TXTask);
}
break;
#endif /* INCLUDE_TCP == NU_TRUE */
case SELECT:
NU_Resume_Task((NU_TASK *)dat);
break;
case ARPRESOLVE:
case RARP_REQUEST:
ARP_Event((UINT16)dat);
break;
/********************** USER CLASS *************************/
#if (INCLUDE_UDP == NU_TRUE)
case UDPDATA:
/* If there is a task suspended pending the reception of data
then resume him. */
if ((sock_ptr = SCK_Sockets[dat]) != NU_NULL)
{
/* return control to the waiting task */
if (sock_ptr->s_RXTask != NU_NULL)
NU_Resume_Task(sock_ptr->s_RXTask);
}
break;
#endif /* INCLUDE_UDP == NU_TRUE */
#if (INCLUDE_TCP == NU_TRUE)
case TCPCLOSETIMEOUTSFW2:
/* Get a pointer to the port. */
prt = TCP_Ports[dat];
/* Send a reset just in case the other side is *
* still up. */
prt->out.tcp_flags = TRESET;
TCP_ACK_It(prt, 1);
/* Change states. */
prt->state = SCLOSED;
TCP_Cleanup(prt);
break;
case TCPTIMEWAIT:
/* Get a pointer to the port. */
prt = TCP_Ports[dat];
if (prt->state == STWAIT)
{
/* Change states. */
prt->state = SCLOSED;
/* Close the port up and free all resources. */
TCP_Cleanup (prt);
}
break;
#endif /* INCLUDE_TCP == NU_TRUE */
#if (INCLUDE_DHCP == NU_TRUE)
case DHCP_RENEW:
case DHCP_REBIND:
case DHCP_NEW_LEASE:
DHCP_Queue_Event((DV_DEVICE_ENTRY *)dat, event);
break;
#endif /* INCLUDE_DHCP == NU_TRUE */
#if INCLUDE_IP_RAW
case IPDATA:
/* If there is a task suspended pending the reception of data
then resume him. */
if ((sock_ptr = SCK_Sockets[dat]) != NU_NULL)
{
if (sock_ptr->s_RXTask != NU_NULL)
NU_Resume_Task(sock_ptr->s_RXTask);
}
break;
#endif
#if INCLUDE_IP_MULTICASTING
case EV_IGMP_REPORT :
/* Send an IGMP multicast group membership report. */
IGMP_REPORT_EVENT(dat);
break;
#endif /* INCLUDE_IP_MULTICASTING */
#if INCLUDE_IP_REASSEMBLY
case EV_IP_REASSEMBLY :
/* Clear the fragment list. The whole datagram has not
yet been received. */
IP_Reassembly_Event((IP_QUEUE_ELEMENT *)dat);
break;
#endif /* INCLUDE_IP_REASSEMBLY */
/*********************** PPP CLASS ************************/
case LCP_RESEND :
case LCP_SEND_CONFIG :
case MDM_HANGUP :
case LCP_ECHO_REQ :
case NCP_RESEND :
case NCP_SEND_CONFIG :
case LCP_CLOSE_LINK :
case PAP_SEND_AUTH :
case CHAP_RESEND :
case CHAP_CHALL :
case PPP_STOP_NEGOTIATION :
/* Get a pointer to the device structure for this device */
dev_ptr = (DV_DEVICE_ENTRY *)dat;
/* Call the event handler for this device if there
is one. There should always be one. Otherwise
how did the code get here? */
if (dev_ptr->dev_event != NU_NULL)
dev_ptr->dev_event (dev_ptr, event);
else
NERRS_Log_Error (NERR_FATAL, __FILE__, __LINE__);
break;
/*********************** ICMP CLASS ************************/
case ICMP_ECHO_TIMEOUT:
/* Get a pointer to the entry for this timeout. */
echo_entry = (ICMP_ECHO_LIST_ENTRY *)dat;
/* Set the status to timeout. */
echo_entry->icmp_echo_status = NU_TIMEOUT;
/* Change the seq num so if the reply comes in before the
task runs a false success will not be generated. */
echo_entry->icmp_echo_seq_num++;
/* resume the waiting task */
NU_Resume_Task (echo_entry->icmp_requesting_task);
break;
#if (INCLUDE_NAT == NU_TRUE)
#if (INCLUDE_TCP == NU_TRUE)
case NAT_CLEANUP_TCP:
NAT_Cleanup_TCP();
break;
#endif
#if (INCLUDE_UDP == NU_TRUE)
case NAT_CLEANUP_UDP:
NAT_Cleanup_UDP();
break;
#endif
case NAT_CLEANUP_ICMP:
NAT_Cleanup_ICMP();
break;
#if (INCLUDE_TCP == NU_TRUE)
case NAT_TIMEOUT:
case NAT_CLOSE:
NAT_Delete_Translation_Entry(IPPROTO_TCP, dat);
break;
#endif
#endif
} /* end switch on msg_class/event combination */
} /* end if status is NU_SUCCESS */
/* added 11/3/92 - during ATI mods */
NU_Release_Semaphore(&TCP_Resource);
} /* end while */
/* Switch back to user mode. */
/* Note this instruction is commented out to remove a compiler
warning. The while loop above should never be exited and this
instruction never executed. Thus the reason for the compiler
warning and the justification to comment out this instruction.
This line is left in just for completeness and so that in the
future it is not overlooked.
NU_USER_MODE();
*/
} /* end NU_EventDispatcher */
/***********************************************************************
*
* FUNCTION
*
* EQ_Clear_Matching_Timer
*
* DESCRIPTION
*
* Remove all timer events from the queue that match the
* class/event/dat.
*
* INPUTS
* tlist
* event
* dat
* ack_num
*
* OUTPUTS
* NU_SUCCESS
*
*************************************************************************/
STATUS EQ_Clear_Matching_Timer (struct tqhdr *tlist, UNSIGNED event, UNSIGNED dat,
INT32 ack_num)
{
tqe_t *ent, /* Points to the current entry in the queue. */
*tmpent, /* Points to the item being promoted from the duplist. */
*savent; /* Preserves our position in the queue. */
/* Search the list for matching timers. */
for (ent = tlist->flink; ent; )
{
/* Does this match the entry we are looking for. */
if ( (ent->tqe_event == event) && (ent->tqe_data == dat) &&
(INT32_CMP(ack_num, ent->tqe_ext_data) >= 0) )
{
/* We have found a matching entry. Preserve a pointer to the next
* entry. */
savent = ent->flink;
/* If this entry contains a duplist we need to search it to. */
if (ent->duplist.flink)
{
/* Search the duplist for a match. */
EQ_Clear_Matching_Timer(&ent->duplist, event, dat, ack_num);
/* Pull the first item, if one exists, off the duplist. */
tmpent = (tqe_t *)DLL_Dequeue(&ent->duplist);
/* If the duplist still contained an item after we cleared it,
* we want to promote one. */
if(tmpent)
{
/* Promote this item to the position that was held by the item
* we are removing. */
tmpent->duplist.flink = ent->duplist.flink;
tmpent->duplist.blink = ent->duplist.blink;
if (tmpent)
DLL_Insert((tqe_t *)tlist, tmpent, ent);
}
/* Clear the duplist pointers in the node that is about to be
* freed. */
ent->duplist.flink = ent->duplist.blink = NU_NULL;
}
/* Remove the item. */
DLL_Remove((tqe_t *)tlist, ent);
/* Place the item back on the free list. */
DLL_Enqueue(&EQ_Event_Freelist, ent);
/* Point to the next item to be checked. */
ent = savent;
}
else
{
/* We did not find a match. Clear the duplist if it exists. */
if (ent->duplist.flink)
{
EQ_Clear_Matching_Timer(&ent->duplist, event, dat, ack_num);
}
/* Point to the next item to be checked. */
ent = ent->flink;
}
}
return (NU_SUCCESS);
} /* EQ_Clear_Matching_Timer */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -