[Click] Doubt about information elements

Beyers Cronje bcronje at cs.co.za
Fri Sep 17 07:58:20 EDT 2004


Hi Eddie, everyone,

So if I understand you correctly one can implement an "information element" that can hold information ie maps of TCPFlows or IP Routes etc. that can be accessed and modified from standard elements?

Say for instance we have a "RipRouteTable" information element with say 2 public methods called LookupRoute() and AddRoute(). Can these methods be accessed via any element in the router config?

If so would the correct way to access these methods from a standard element be something in line with:

  RipRouteTable *rrt;
  for (int ei = 0; ei < router()->nelements() && !found; ei++) {
    Element *e = router()->element(ei);
    if (rrt = (RipRouteTable *)e->cast("RipRouteTable")) {
	found = true;
    }
  }
  rrt->AddRoute("10.1.1.0/255.255.255.0 0");

Thanks in advance for any information anyone can provide.

Kind regards

Beyers Cronje


-----Original Message-----
From: click-bounces at amsterdam.lcs.mit.edu
[mailto:click-bounces at amsterdam.lcs.mit.edu]On Behalf Of Eddie Kohler
Sent: Saturday, September 11, 2004 3:24 AM
To: Pedro Menchen Lopez
Cc: click at amsterdam.lcs.mit.edu
Subject: Re: [Click] Doubt about information elements


Hi Pedro,

> I am implementing RIP support for Click.

Great!  We'd love to distribute it when you're done.

> And i have a problem: I want to make the manage of the routing table  
> independent from RIP elements, so, it could be accesed by two or more  
> elements (Maybe one "RIP core" and the other "lookup routes"). I don't  
> know how no-element classes work so i cannot make Routing table  
> static. I have read something about information elements but i don't  
> understand how it can help me.

Hm.  Well, first, I'd expect the routing table to be encapsulated in an  
element.  So do you really want a no-element class?

I can point you at a couple information elements:
- PortInfo (one of the simplest ones)
- PerfCountInfo
Maybe looking at these will help you get a feel for the style.

Now, if you want to just figure out how to get Click to include a .cc  
file that doesn't contain an element, that's simple.  Add  
ELEMENT_PROVIDES(SomeIdentifierForYourFile) to the bottom of the .cc  
file.  Make sure you add ELEMENT_REQUIRES(ThatIdentifier) to any other  
elemnents requiring that code.  See userlevel/fakepcap.cc for an  
example.

Does this help?
Eddie


>
> At this moment RIP core makes both actions, but this solution is not  
> extensible and i don't like it.
>
> Any ideas or help will be very wellcome.
>
> Sorry about my english.
>
> Pedro Menchen
> student at University of Coruña
>
> _________________________________________________________________
> Descarga gratis la Barra de Herramientas de MSN  
> http://www.msn.es/usuario/busqueda/barra? 
> XAPID=2031&DI=1055&SU=http%3A// 
> www.hotmail.com&HL=LINKTAG1OPENINGTEXT_MSNBH
>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click


_______________________________________________
click mailing list
click at amsterdam.lcs.mit.edu
https://amsterdam.lcs.mit.edu/mailman/listinfo/click
This is an email from CS Holdings. It is confidential to the ordinary user of the email address
to which it is addressed and may contain copyright and/or legally privileged information. No one
else may read, print, store, copy, forward or act in reliance upon all or any part of it or its 
attachments. If you received this email in error please notify its sender.



More information about the click mailing list