[Click] Error in compiling a new element-Urgent
kunal shah
shakuni2 at yahoo.co.in
Wed Nov 30 23:15:00 EST 2005
Hi Eddie,
I am just not able to figure out my syntax error. I
have even tried to put the 2 lines at the end of my
file.
template class Vector<int>;
template class Vector<uint16_t>;
Please advise.
Attached document contains my .cc file
--- Eddie Kohler <kohler at cs.ucla.edu> wrote:
> Your file was mangled in transmission, you need to
> attach such files
> in the future so that line numbers are preserved.
> Good luck finding
> this simple syntax error!!!
>
>
> On Nov 30, 2005, at 12:25 AM, kunal shah wrote:
>
> > Hi,
> >
> > I am getting the following error when I tried to
> > compile a new element called iptable2(which is
> lulea
> > implementation). I have put this element in
> > elements/ip directory.
> >
> > My iptable2.cc file is
> >
> > ---------------------------------------------
> > #include <click/config.h>
> > #include "iptable2.hh"
> > #include <click/ipaddress.hh>
> > #include <click/error.hh>
> > #include <click/integers.hh>
> > CLICK_DECLS
> >
> > #define MT_MAX 675
> > #define DIRECT_POINTER (MT_MAX + 5) //
> > arbitrary value > MT_MAX
> >
> > bool IPTable2::_mt_done = false;
> > uint8_t IPTable2::_maptable[MT_MAX+1][8];
> > uint16_t IPTable2::_mask2index[256][256]; //
> see
> > build_maptable()
> >
> > IPTable2::IPTable2()
> > : entries(0), dirty(false)
> > {
> > if(!_mt_done)
> > build_maptable();
> > }
> >
> > IPTable2::~IPTable2()
> > {
> > }
> >
> >
> > // Adds an entry to the simple routing table if
> not in
> > there already.
> > // Allows only one gateway for equals dst/mask
> > combination.
> > void
> > IPTable2::add(unsigned dst, unsigned mask,
> unsigned
> > gw)
> > {
> > for(int i = 0; i < _v.size(); i++)
> > if(_v[i]._valid && (_v[i]._dst == dst) &&
> > (_v[i]._mask == mask))
> > return;
> >
> > struct Entry e;
> > e._dst = dst;
> > e._mask = mask;
> > e._gw = gw;
> > e._valid = 1;
> > _v.push_back(e);
> >
> > entries++;
> > dirty = true;
> > }
> >
> >
> > // Deletes an entry from the routing table.
> > void
> > IPTable2::del(unsigned dst, unsigned mask)
> > {
> > for(int i = 0; i < _v.size(); i++){
> > if(_v[i]._valid && (_v[i]._dst == dst) &&
> > (_v[i]._mask == mask)) {
> > _v[i]._valid = 0;
> > entries--;
> > dirty = true;
> > return;
> > }
> > }
> > }
> >
> > // Returns the i-th record.
> > bool
> > IPTable2::get(int i, unsigned &dst, unsigned
> &mask,
> > unsigned &gw)
> > {
> > assert(i >= 0 && i < _v.size());
> >
> > if(i < 0 || i >= _v.size() || _v[i]._valid == 0)
> {
> > dst = mask = gw = 0;
> > return(false);
> > }
> >
> > dst = _v[i]._dst;
> > mask = _v[i]._mask;
> > gw = _v[i]._gw;
> > return(true);
> > }
> >
> >
> > // Use the fast routing table to perform the
> lookup.
> > bool
> > IPTable2::lookup(unsigned dst, unsigned &gw, int
> > &index)
> > {
> > if(!entries)
> > return false;
> >
> > // Just in time. XXX: Change this to timer.
> > if(dirty) {
> > build();
> > dirty = false;
> > }
> >
> > // XXX: don't do it this way.
> > dst = ntohl(dst);
> >
> > uint16_t ix = (dst & 0xfff00000) >> 20; //
> > upper 12 bits.
> > uint16_t bix = (dst & 0xffc00000) >> 22; //
> > upper 10 bits.
> > uint8_t bit = (dst & 0x000f0000) >> 16; //
> > lower 4 of upper 16 bits.
> > uint16_t codeword = codewords1[ix];
> > uint16_t ten = (codeword & 0xffc0) >> 6; //
> > upper 10 bits.
> > uint8_t six = codeword & 0x003f; //
> > lower 6 bits.
> >
> > // Offset is not offset but pointer to routing
> > table. See 4.2.1 of Degermark.
> > if(ten == DIRECT_POINTER) {
> > index = six;
> > goto done;
> > }
> >
> > // Figure 10 in Degermark is wrong.
> > int offset = _maptable[ten][bit >> 1];
> > if(bit & 0x0001) // odd
> > offset &= 0x0f;
> > else
> > offset >>= 4;
> > uint16_t pix = baseindex1[bix] + six + offset;
> > index = l1ptrs[pix];
> >
> > done:
> > gw = _v[index & 0x3fff]._gw;
> > return(true);
> > }
> >
> > // Builds the whole structure as described by the
> > Lulea Algorithm.
> > // After execution l1ptrs, codewords1 and
> baseindex1
> > represent routing table.
> > //
> > // (NOT FINISHED: level 2 and 3)
> > //
> > // bitvector1 contains bitvector as described in
> > section 4.2 of Degermark.
> > // bit_admin contains an entry for each bit in
> > bitvector1.
> > // Both are temporary.
> > void
> > IPTable2::build()
> > {
> > uint16_t bitvector1[4096];
> > struct bit bit_admin[65536];
> >
> > for(register int i = 0; i < 65536; i++)
> > bit_admin[i].from_level = bit_admin[i].value =
> 0;
> > for(register int i = 0; i < 4096; i++)
> > codewords1[i] = bitvector1[i] = 0;
> > for(register int i = 0; i < 1024; i++)
> > baseindex1[i] = 0;
> > l1ptrs.clear();
> >
> > Vector<int> affected;
> > for(int i = 0; i < entries; i++) {
> > if(_v[i]._valid == 0)
> > continue;
> >
> > // masked, high16, dst, mask and 0x0000ffff in
> > network order!
> > // masked == (IP address range from router
> table)
> > uint32_t masked = (_v[i]._dst & _v[i]._mask);
>
=== message truncated ===
__________________________________________________________
Enjoy this Diwali with Y! India Click here http://in.promos.yahoo.com/fabmall/index.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: iptable2.cc
Type: text/x-c++src
Size: 15217 bytes
Desc: 2266473178-iptable2.cc
Url : https://amsterdam.lcs.mit.edu/pipermail/click/attachments/20051201/ebf9b6da/iptable2-0001.bin
More information about the click
mailing list