you need to use cpElementCast rather than cpElement, see arpquerier.cc for an example.
On Mon, Feb 8, 2010 at 8:39 AM, David Sesmero Sáez <[email protected] > wrote: > > 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 > _______________________________________________ > click mailing list > [email protected] > https://amsterdam.lcs.mit.edu/mailman/listinfo/click > _______________________________________________ click mailing list [email protected] https://amsterdam.lcs.mit.edu/mailman/listinfo/click
