private synchronized void dequeue(PacketScheduler sched)
    {
        Packet np = sched.deque();

        // process ping() packet
        if (np instanceof InfoPacket) {
            ((InfoPacket) np).addExitTime( GridSim.clock() );
        }

        if (super.reportWriter_ != null) {
            super.write("dequeuing, " + np); 
        }

        // must distinguish between normal and junk packet
        int tag = GridSimTags.PKT_FORWARD;
        if (np.getTag() == GridSimTags.JUNK_PKT) {
            tag = GridSimTags.JUNK_PKT;
        }

        // sends the packet via the link
        String linkName = getLinkName( np.getDestID() );
        super.sim_schedule(GridSim.getEntityId(linkName),
                           GridSimTags.SCHEDULE_NOW, tag, np);

        // process the next packet in the scheduler
        if ( !sched.isEmpty() )
        {
            double nextTime = (np.getSize() * NetIO.BITS) / sched.getBaudRate();
            sendInternalEvent(nextTime, sched);
        }
    }