private synchronized void dropPacket(Packet pnp)
    {
        increaseDroppedPktCounter(); // increase the counter of dropped packets

        // First: check if the new incoming packet is a control packet or not.
        int src_outputPort;
        String src_outputPort_str;
        int dst;
        String dst_str;
        String dst_outputPort_str;

        // Check if it is a ping packet, or a data packet
        if (pnp instanceof InfoPacket)
        {
            // Check the source of the packet
            src_outputPort = ((InfoPacket) pnp).getSrcID();
            src_outputPort_str = GridSim.getEntityName(src_outputPort);
            // for example, src_outputPort_str = Output_SIM_0_User_0

            // Check the destination
            dst = ((InfoPacket) pnp).getDestID();
            dst_str = GridSim.getEntityName(dst);
            dst_outputPort_str = "Output_".concat(dst_str);
        }
        else
        {
            // Check the source of the packet
            src_outputPort = ((FnbNetPacket) pnp).getSrcID();
            src_outputPort_str = GridSim.getEntityName(src_outputPort);
            // for example, src_outputPort_str = Output_SIM_0_User_0

            // Check the destination
            dst = ((FnbNetPacket) pnp).getDestID();
            dst_str = GridSim.getEntityName(dst);
            dst_outputPort_str = "Output_".concat(dst_str);
        }

        /**************************
        // This works
        // If one of the ends of this packet is the broker or the GIS.
        // Also, pkts whose source or dest is a router are protected
        // (monitoring ping packets). And monitoring pkts (from the res monitor)
        if ((src_outputPort_str.indexOf("Broker") != -1) ||
            (dst_str.indexOf("Broker") != -1) ||
            (src_outputPort_str.indexOf("GIS") != -1) ||
            (dst_str.indexOf("GIS") != -1) ||
            (src_outputPort_str.indexOf("RC") != -1) ||
            (dst_str.indexOf("RC") != -1))
        ************************/

        // if the src or the dest of the packet are in the whitelist, then try not to drop the packet
        FnbWhiteList whiteList = FnbWhiteList.getInstance();
        if (whiteList.checkList(dst) || whiteList.checkList(src_outputPort))
        {

            if (makeRoomForPacket())
            {
                // If we have been able of dropping a data packet, then we have room for this control packet
                insertPacketIntoQueue(pnp);

                //return true;
            }
            else
            {
                System.out.println("\n" + super.get_name() +
                    ": 271 A control packet has been dropped.\n" +
                    "src_output: " + src_outputPort_str +
                    ". dst_inputPort: " + dst_str +
                    "\nHENCE, SIMULATION FINISHED AT SIM. TIME " + GridSim.clock());

                //fw_write("MaxBufferSizeDuringSim, " + getMaxBufferSize() + "\n",
                //         this.get_name() + "_MaxBufferSize.csv");

                System.exit(1);
                // super.shutdownUserEntity();
                // super.terminateIOEntities();
            }
        }

        // If u want more info on the progress of sims, uncomment this.
        /********************
        System.out.println(super.get_name() + ": packet dropped. Src: " +
                           src_outputPort_str + ", Dst: " + dst_str +
                           ". Pkt num: " + ((FnbNetPacket) pnp).getPacketNum());
        ********************/

        // If the packet is not a control packet, we will have to remove the packet, and
        // also, we will have to tell the user involved in the transmission about the dropping.
        // The user may be the source or the destination of the dropped packet.
        // This is done through an event, not through the network

        int entity;
        String destination_packetsDroppedEvent;
        if (src_outputPort_str.indexOf("User") != -1)
        {
            // if the src of the packet is an user, tell him what has happened

            // NOTE: this is a HACK job. "Output_" has 7 chars. So,
            // the idea is to get only the entity name by removing
            // "Output_" word in the outName string.
            String src_str = src_outputPort_str.substring(7);
            // for example, src_str = SIM_0_User_0

            entity = GridSim.getEntityId(src_str);
            destination_packetsDroppedEvent = src_outputPort_str;
        }
        else
        {
            // If the destination of the packet is the user, tell the user

            // NOTE: this is a HACK job. "Output_" has 7 chars. So,
            // the idea is to get only the entity name by removing
            // "Output_" word in the outName string.

            entity = GridSim.getEntityId(dst_str);
            destination_packetsDroppedEvent = dst_outputPort_str;
        }

        // Check if it is a ping packet, or a data packet
        int pktID;
        int tag;
        int glID;
        //String filename= null;
        //int userID;
        boolean isFile;
        if (pnp instanceof InfoPacket)
        {
            pktID = ((InfoPacket) pnp).getID();
            tag = 99999;
            glID = 99999;
            isFile = false;
        }
        else
        {
            pktID = ((FnbNetPacket) pnp).getID();
            tag = ((FnbNetPacket) pnp).getTag();

            // check the user and the gl this packet belongs to
            glID = ((FnbNetPacket) pnp).getObjectID();
            //filename = ((FnbNetPacket) pnp).getFileName();
            isFile = ((FnbNetPacket) pnp).isFile();
        }

        if (tag != GridSimTags.JUNK_PKT) // && (tag != GridSimTags.EMPTY_PKT))
        {
            // Only tell the user if this is not a junk packet (a background traffic pkt)

            // String input_src_str = "Input_" + src_str;
            // for example, input_src_str = Input_SIM_0_User_0
            // int input_src = GridSim.getEntityId(input_src_str);

            /****************
            // Uncomment this to get more info on the progress of sims
            System.out.println("\n" + name_ +
                ": A packet has been dropped.\n" +
                "src_output: " + src_outputPort_str +
                ". dst_inputPort: " + dst_str + ". Tag: " + tag + "\nTime: " +
                GridSim.clock());
            ******************/


            if (checkDroppedGlList(glID, entity) == false)
            {
                // if the gridlet has not been already dropped, then 
                // send event. Otherwise, do nothing, to safe memory

                //super.send(GridSim.getEntityId(destination_packetsDroppedEvent), //src_outputPort,
                super.sim_schedule(GridSim.getEntityId(destination_packetsDroppedEvent), //src_outputPort,
                           GridSimTags.SCHEDULE_NOW + GridSimTags.FNB_DROPPING_DELAY,
                           GridSimTags.FNB_PACKET_DROPPED,
                           new FnbDroppedUserObject(entity, glID, isFile));
                // We tell the user involved in the transmission
                // that the packet has been dropped. We do it with some delay to simulate a time out.

                //Moreover, we have to update the dropped gl list.
                FnbDroppedPacketInfo gu = new FnbDroppedPacketInfo(glID, entity);
                insertGlID_userID(gu);


                /*************************
                System.out.println("\n" + super.get_name() +
                       ": 387 A packet has been dropped, and an ACK has been sent.\n" +
                       "  src.output: " + src_outputPort_str +
                       ", dst_inputPort: " + dst_str + "\nTime: " +
                       GridSim.clock() + ". PktID: " + pnp.getID() + ". Gl: " + glID +
                       ". destination_packetsDroppedEvent: " +
                       destination_packetsDroppedEvent);
                **********************/
            }
            /**********************************
            else{
                System.out.println("\n" + super.get_name() +
                                   ": 400 A packet has been dropped.\n" +
                                   " src.output: " + src_outputPort_str +
                                   ". dst_inputPort: " + dst_str +
                                   "\n Time: " +
                                   GridSim.clock() + ". PktID: " + pnp.getID() + ". Gl: " +
                                   glID + ". destination_packetsDroppedEvent: " +
                                   destination_packetsDroppedEvent);

            }
            *********************************/
            pnp = null; // remove the packet.

        }
        else
        {
            /********************
            // Uncomment this to get more info on the progress of sims
            System.out.println("\n" + super.get_name() +
                    ": 416 A junk packet has been dropped.\n" +
                    " src.output: " + src_outputPort_str +
                    ". dst_inputPort: " + dst_str + "\nTime: " + GridSim.clock());
            ********************/
        }

    }