[Click] Elements interconnection

David Sesmero Sáez deivid_sesme at hotmail.com
Mon Feb 8 11:39:08 EST 2010


Hi!

I'm trying to pass one element into other element for using some functions of the element in the other element.. My .click is like this:

tables::VlanTables(NUM_PORTS 8)
vlanencap::VlanEncap(VLAN_MODE 0, TABLES tables)

FromHost(tap3)->vlanencap->ToHost(tap4)
FromHost(tap4)->Discard

And inside VlanTables.cc I have got:

int
VlanTables::get_var()
{
    var=12;
    return var;
}

In VlanEncap I tried to get these var, doing this:

int
VlanEncap::configure(Vector<String> &conf, ErrorHandler *errh)
{
    if (cp_va_kparse(conf, this, errh,
        "VLAN_MODE",cpkP+cpkM,cpInteger,&vlan_mode,
        "TABLES", cpElement, "tables", &tables,
           cpEnd) < 0){
        return -1;
    }
}

void
VlanEncap::push(int source, Packet *p)
{
    VlanTables *vlan_tables = static_cast<VlanTables *>(tables);
                if (int var = vlan_tables->num_ports) 
                {
                    click_chatter("Valor: %d",var);
                }
                else{
                    click_chatter("Error");
                }
}

When I compile the code there are no errors but when I run the .click, I have "Segmentation Fail" error.

Anyone can help me please?


Thanks, 
David Sesmero.

 		 	   		  
_________________________________________________________________
Los auténticos Hotmail y Messenger en tu Blackberry con Movistar. ¡Descárgatelos ya!
http://serviciosmoviles.es.msn.com/messenger/blackberry.aspx


More information about the click mailing list