[Click] method interface problems.

Joonwoo Park joonwpark81 at gmail.com
Wed Oct 24 00:37:09 EDT 2007


Hi Kurtis,

2007/10/24, Kurtis Heimerl <munncha at gmail.com>:
> Awesome, thanks a ton.
>
> I have some followup questions. The segment of the documentation dealing
> with method interfaces and method handlers.
>
> First off, i have not been able to find any documentation on how to use
> these in the configuration files. I want to know the amount of packets
> currently in each of my routers, which is an API the router exports. How do
> I connect this API to my LinearIPLookup clone? The only location I've found
> documentation of the click config language is in the papers, which only
> mentions the method interfaces in passing.
>

If you want to count packets, please check counter elements.
(http://read.cs.ucla.edu/click/elements#counters)
Taking a look at example config filse may help you for using these elements
The examples is located in 'conf' directory of source the code.

> In the element documentation has confused me as far as more generic
> handlers. It says that the elements will be controlled from a file. However,
> the locations it suggests are not right on my box. I'm assuming that's
> because i'm in user mode. Where does click store these files if it's in user
> mode? I've switched to SimpleQueue from Queue, as I think that simple queue
> should be outputting to a file somewhere. Is that right?

In my understanding, the file means config file what you wrote.
In the userlevel, you need to run click with config file (the option -f)

I hope it helps you.

Thanks.
Joonwoo Park.

>
> Thanks again, I've spent a couple hours on each of these problems, so the
> few minutes you guys spend answering them is really appreciated.
>
> On 10/23/07, Joonwoo Park <joonwpark81 at gmail.com> wrote:
> > Hi,
> >
> > 2007/10/23, Kurtis Heimerl <munncha at gmail.com>:
> > > Hi, I've got a little problem I thought this list might be able to help
> me
> > > with.
> > >
> > > I've begun modifying LinearIPLookup.cc for my own uses. The first thing
> I've
> > > begun doing is printing the IP and port of the incoming packets.
> > >
> > > The IP I am able to get in long format via the ip->ip_src.s_addr. I need
> it
> > > in dot. The normal way to do this is with the  inet_ntoa() function  in
> > > either the
> > > netinet/in.h or arpa/inet.h
> > > libraries.
> > >
> > > However, the inclusion of either causes the element to fail to compile.
> > > What's the proper way to do this in click?
> >
> > 'printf("%s\n", inet_ntoa(iph->ip_src));' would work just only for
> userlevel.
> > (
> > Please make sure you don't pass one more inet_ntoa's return value to
> > single printf, it would print nonsensical out
> > (eg. printf("%s %s\n", inet_ntoa(ip_src), inet_ntoa(ip_dst))
> > )
> >
> > IPAddress ipaddr(iph->ip_src.s_addr);
> > click_chatter("%s", ipaddr.unparse ().c_str());
> > is the way of the click.
> > It works for all platform.
> >
> > >
> > > Another question is about the TCP header. The port I am pulling out
> seems to
> > > be nonsensical, at least compared to the ones TCP dump are providing. A
> > > brief code snippet:
> > > const click_tcp* tcp = p->tcp_header();
> > > printf("%d\n", tcp->th_sport);
> >
> > On the little endian machine, It should be 'printf("%d\n",
> > ntohs(tcp->th_sport));'
> >
> > Thanks.
> >
> > Joonwoo Park
> >
> > >
> > > Am I doing anything wrong?
> > >
> > > Thanks!
> > > ****
> > > _______________________________________________
> > > click mailing list
> > > click at amsterdam.lcs.mit.edu
> > > https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> > >
> >
>
>


More information about the click mailing list