[Click] Problem compiling a new element

Eddie Kohler kohler at cs.ucla.edu
Tue Nov 15 11:58:23 EST 2005


Ramanathan,

Your elements.conf file reports that your element is using the name  
ReplicateElement.  So I don't know why you say it doesn't work.  Or  
are you trying to change the name to Replicate as in your sample.hh  
file?

There are a number of problems with your code as well.  You cannot  
push a packet twice, as your ReplicateElement does.  You need to  
clone it once

void ReplicateElement::push(int port, Packet *p)
{
    output(0).push(p->clone());   // should really check for errors
    output(1).push(p);
}

And as people point out Tee does this job just fine.  So...?
Eddie



On Nov 15, 2005, at 8:52 AM, Ramanathan Palaniappan wrote:

> Hi,
>
> I did make elemlist and the element has compiled successfully. I tried
> changing the name from Replicate to ReplicateElement but did not  
> work. I
> have attached my elements.conf file.
>
> Thanks,
> Ramanathan
>
>
>
> On 11/15/05, Frederic Van Quickenborne <
> frederic.vanquickenborne at intec.ugent.be> wrote:
>>
>> Hi,
>>
>> I know this does not solve your original problem, but the "Tee"  
>> element,
>> included in Click, is a packet copier
>> (http://pdos.csail.mit.edu/click/doc/Tee.n.html).
>>
>> Many regards,
>> Frederic.
>>
>> Ramanathan Palaniappan wrote:
>>
>>> Hi,
>>>
>>> I have added a simple element to Click and I have compiled it
>> successfully.
>>> But when I use the element in my script, Click reports "unknown  
>>> element
>>> class". I have attached the *.cc and *.hh files for reference.  
>>> The new
>>> element was placed under "elements/local" and local was enabled  
>>> during
>>> configuration.
>>>
>>> Any suggestions would be greatly appreciated.
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> ----
>>>
>>> /*
>>> * nullelement.{cc,hh} -- do-nothing element
>>> * Eddie Kohler
>>> *
>>> * Copyright (c) 1999-2000 Massachusetts Institute of Technology
>>> *
>>> * Permission is hereby granted, free of charge, to any person  
>>> obtaining
>> a
>>> * copy of this software and associated documentation files (the
>> "Software"),
>>> * to deal in the Software without restriction, subject to the  
>>> conditions
>>> * listed in the Click LICENSE file. These conditions include: you  
>>> must
>>> * preserve this copyright notice, and you cannot mention the  
>>> copyright
>>> * holders in advertising related to the Software without their
>> permission.
>>> * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED.
>> This
>>> * notice is a summary of the Click LICENSE file; the license in that
>> file is
>>> * legally binding.
>>> */
>>>
>>> #include <click/config.h>
>>> #include "sample.hh"
>>> CLICK_DECLS
>>>
>>> ReplicateElement::ReplicateElement()
>>> : Element(1, 2)
>>> {
>>> MOD_INC_USE_COUNT;
>>> }
>>>
>>> ReplicateElement::~ReplicateElement()
>>> {
>>> MOD_DEC_USE_COUNT;
>>> }
>>>
>>> void
>>> ReplicateElement::push(int port, Packet *p)
>>> {
>>> output(0).push(p);
>>> output(1).push(p);
>>> }
>>>
>>>
>>>
>>> EXPORT_ELEMENT(ReplicateElement)
>>> ELEMENT_REQUIRES(linuxmodule)
>>> //ELEMENT_REQUIRES(userlevel)
>>> //ELEMENT_MT_SAFE(ReplicateElement)
>>> CLICK_ENDDECLS
>>>
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> ----
>>>
>>> _______________________________________________
>>> click mailing list
>>> click at amsterdam.lcs.mit.edu
>>> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>>>
>>>
>>
>> --
>> Frederic Van Quickenborne
>> Department of Information Technology (INTEC)
>> Ghent University - IBBT - IMEC
>> Gaston Crommenlaan 8 (Bus 201), B-9050 Gent, Belgium
>> tel.: +32-9331 4974; tel. secr.: +32-9331 4900
>> fax: +32-9331 4899
>> Frederic.VanQuickenborne at intec.ugent.be
>> http://www.ibcn.intec.ugent.be
>>
>> The contents of this e-mail are intended for the named addressee 
>> (s) only.
>> It contains information which may be confidential and which may  
>> also be
>> privileged. Unless you are the named addressee (or authorised to  
>> receive for
>> the addressee) you may not copy or use it, or disclose it to  
>> anyone else. If
>> you received it in error please notify us immediately and then  
>> destroy it.
>> Further, we make every effort to keep our network free from viruses.
>> However, you do need to check this e-mail and any attachments to  
>> it for
>> viruses as we can take no responsibility for any computer virus  
>> which might
>> be transferred by way of this e-mail.
>>
>>
>>
>> <elements.conf>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click



More information about the click mailing list