[Click] Adding a thin C++ wrapper node to Click

Eddie Kohler kohler at cs.ucla.edu
Mon May 3 23:30:02 EDT 2004


Hi Paolo,

Paolo Pisati wrote:
> 
> Hi Clickers,
> 
> I think the subject says it all.

Well, I'm glad you got a bit more specific :)

> This is my situation:
> 
> I've a standalone application written in plain C that implements a new  
> packet classification
> algorithm using AST (Adaptive Stratified Tree) as data struct.
> After an extensive period of tests and fine tuning we decided it was time
> move all our code inside Click to test our work in a real workload  
> situation.
> 
> The only logical step to achieve this, instead of rewriting everything in
> C++, is to write a thin c++ wrapper click node that actually calls our C
> implementation.
> So the next step would be to hook up my building process to Click, and  
> keep my
> standalone version and Click, both, happy.
> 
> Let's assume that i wrote a correct node, the only remainig problem is 
> the  building process, so
> here come the questions:
> 
> is there a standard way to add any code to Click?

Yes; see the FAQ, Section 3, or look in etc/samplepackage.

> Should i modify/tweak any Makefiles and/or any particular options?

See the FAQ again.  If you add an element to elements/local (and configure with 
--enable-local), you should not need to tweak Makefiles, as long as your source 
files are decorated with EXPORT_ELEMENT() as required.

> And last but not least, is there a particular procedure to follow mixing 
> C  and C++ code?

You may be able to do this automatically with an ELEMENT_PROVIDES() decoration 
on the C file (if you put the C file under elements/local or whatever).  See 
elements/etherswitch/bridgemessage.cc for an example of ELEMENT_PROVIDES().

> I'm obviously following HEAD in cvs.
> 
> It's my first attempt in doing such a thing, so any help is appreciated.
> 
> Thank you.
> 
> Paolo
> 

Hope this helps!
Eddie


More information about the click mailing list