Hello All.

I am trying to simulate the PPM schemes under NS-2, as part of my
B-Tech. Project, and am stranded in the initial phase itself.

I have written a very basic code for the simulation, and have made the
necessary modifications in the various NS-2 files, but to my
dissappointment, there are some compile errors which I am unable to
digest.

The file names of my code are ppm.cc and ppm.h, and I am encountering
the following errors when I run make:

ppm/ppm.cc:16: two or more data types in declaration of `class_ppmhdr'
ppm/ppm.cc: In member function `virtual TclObject* PPMClass::create(int, const
   char* const*)':
ppm/ppm.cc:24: parse error before `;' token
ppm/ppm.cc: At global scope:
ppm/ppm.cc:29: syntax error before `::' token
ppm/ppm.cc:35: syntax error before `::' token
ppm/ppm.cc:39: `pkt' was not declared in this scope
ppm/ppm.cc:42: `pkt' was not declared in this scope
ppm/ppm.cc:44: parse error before `if'
ppm/ppm.cc:52: syntax error before `->' token
ppm/ppm.cc:58: `pkt' was not declared in this scope
ppm/ppm.cc:58: ISO C++ forbids declaration of `send' with no type
ppm/ppm.cc:58: initializer list being treated as compound expression
ppm/ppm.cc:59: parse error before `}' token
make: *** [ppm/ppm.o] Error 1

---------------------------------------------------------------------------------------------------------

The directory structure for my code files is /root/ns-allinone-2.27/ns-2.27/ppm/

Also, here is the ppm.cc contents:

#include "ppm.h"

static class PPMHeaderClass : public PacketHeaderClass {
public:
        PPMHeaderClass() : PacketHeaderClass("PacketHeader/PPM",
sizeof(hdr_ppm))
        {
                bind_offset(&hdr_ppm::offset_);
        }

} class_ppmhdr;


static class PPMClass : public TclClass {
public:
        PPMClass() : TclClass("Agent/PPM") {}
        TclObject* create(int, const char*const*)
        {
                return (new PPMAgent));
        }
} class_ppm;


PPMAgent::PPMAgent() : Agent(PT_PPM)
{
        bind("packetSize_", &size_);
}
void PPMAgent::recv(Packet* pkt, Handler*)
{
        printf("Recieved a packed on PPM Agent");
        // Access the IP header for the received packet:
        hdr_ip* hdrip = hdr_ip::access(pkt);

        // Access the PPM header for the received packet:
        hdr_ppm* hdr = hdr_ppm::access(pkt);

        if(hdr_ppm->marked == 1)
        {
                printf("Packet is already marked");
        }

        else
        {
                hdr_ppm->marked = 1;
                hdr->time_marked = Scheduler::instance().clock();
        }

        send(pkt,0);
}

-------------------------------------------------------------------------------------------------

The PPM Agent is to be attached to the routers which would primarily
mark the packets it receives. Also, all the relevant headers have been
included in the ppm.h file.

Can anyone suggest what sort of an error this points to be.

I would be grateful.

Sincerely,

Rajesh Bachani


--
Rajesh Bachani
DA-IICT 4th Year (Bachelor of Technology)
+919824407356

Reply via email to