[Click] help click:unknown element class when adding own element to patchless linuxmodule

Huiqing Fu huiqingfu2012 at gmail.com
Sun Jul 22 16:29:43 EDT 2012


hi,
I try to add my own element “PushTest” to patchless linuxmodule in
click, now I installed element in the patchless linuxmodule,but the
prolems is that when I run click -install File.click to use my own
element it fails and says that "File.click:9: unknown element class
'PushTest';  Router could not be initialized!"

My installing steps are:  ./configure --enable-local; --> make
elemlist; --> make -i install(if without -i, there are always two
errors) --> click-install ./conf/File.click.  Then it fails.
 The File.click is quite simple :

InfiniteSource(DATA \<00 00 c0 ae 67 ef  00 00 00 00 00 00  08 00
45 00 00 28  00 00 00 00  40 11 77 c3  01 00 00 01
02 00 00 02  13 69 13 69  00 14 d6 41  55 44 50 20
70 61 63 6b  65 74 21 0a>, LIMIT 5, STOP true)
        -> Strip(14)
        -> Align(4, 0)    // in case we're not on x86
        -> CheckIPHeader(BADSRC 18.26.4.255 2.255.255.255 1.255.255.255)
        -> Print(okPUSH)
        ->PushTest
        ->Discard;

The PushTest is the element that I write, which is also rather simple:
 *#include <click/config.h>
#include <click/confparse.hh>
#include <click/error.hh>
#include "pushtest.hh"

CLICK_DECLS
PushTest::PushTest()
{}

PushTest::~ PushTest()
{}

int PushTest::configure(Vector<String> &conf, ErrorHandler *errh) {

        if(cp_va_kparse(conf, this, errh,
                        cpEnd) < 0)
                return -1;
        return 0;
}

void PushTest::push(int, Packet *p){
         output(0).push(p);
}

CLICK_ENDDECLS
EXPORT_ELEMENT(PushTest)
ELEMENT_REQUIRES(linuxmodule)


So, how to add own element to patchless linuxmodule click router? Or
how to solve the "unknown class" error?


I run it on Ubuntu 10.10 with linux kernel 2.6.35-30-generic



More information about the click mailing list