00001 #include "action_drop.h" 00002 #include "../packets/packet.h" 00003 #include "../engine/session.h" 00004 #include <stdio.h> 00005 00006 //#define DEBUG 00007 00008 extern GlobalVars Globals; 00009 00010 /******************************** 00011 * Drop this packet 00012 ********************************/ 00013 int DropAction(int RuleNum, int PacketSlot, void* Data){ 00014 PacketRec* p; 00015 00016 00017 #ifdef DEBUGPATH 00018 printf("In DropAction\n"); 00019 #endif 00020 00021 #ifdef DEBUG 00022 printf("Dropping\n"); 00023 #endif 00024 p=&Globals.Packets[PacketSlot]; 00025 p->PassRawPacket=FALSE; 00026 if (p->Status == PACKET_STATUS_BLOCKED) 00027 TCPRemount_unblock(PacketSlot, TRUE); 00028 00029 return TRUE; 00030 } 00031 00032 /******************************** 00033 * Set up the dropping mechanism 00034 ********************************/ 00035 int InitActionDrop(){ 00036 int ActionID; 00037 00038 #ifdef DEBUGPATH 00039 printf("In InitActionDrop\n"); 00040 #endif 00041 00042 ActionID=CreateAction("drop"); 00043 if (ActionID==ACTION_NONE){ 00044 #ifdef DEBUG 00045 printf("Couldn't allocation action drop\n"); 00046 #endif 00047 return FALSE; 00048 } 00049 00050 Globals.ActionItems[ActionID].ActionFunc=DropAction; 00051 00052 return TRUE; 00053 }