[Click] Problems Creating a Linux-level Element

betamaz betamaz at gmail.com
Wed May 25 02:24:30 EDT 2005


Hi,

I am working on a new element similar to fastudpflows.{cc, hh}.
FastUDPFlows sends udp packets that have the source/destination ip
address (of class E: x.x.x.x.E) randomly changing.  My goal is to
simulate traffic and have click act as a router in between different
host and destinations.

The change i want to make is to be able to control this randomness in
two different ways. First way based on a set of input probabilites.
Seond way, would be  to read the ips from an existing input file.

My problem is that im working based on the linux-level version of
FastUDPFlows. Therefore, I get compile errors when including libraries
such as #include <arpa/inet.h>
I want to use functions like:

int inet_aton(const char *cp, struct in_addr *inp);
char *inet_ntoa(struct in_addr in);
uint32_t htonl(uint32_t hostlong);

I can't find how to use these functions in linux-level? Does click
have its own version? Is there any other route to go then making an
element for userlevel?
 
Thanks,
Bita.
-----------------------------------------------------
(more info, i u need details)

For example, when i compared userlevel/fromhost.cc and
linuxmodule/fromhost.cc i saw the first had inet_ntoa; the second was
using something with sin_addr in the function, in the funciton
set_device_addresses( ). The linux-level included a whole bunch of
things like below (which I'm not sure is what i need):

#include <click/cxxprotect.h>
CLICK_CXX_PROTECT
#include <asm/types.h>
#include <asm/uaccess.h>
#include <linux/ip.h>
#include <linux/inetdevice.h>
#include <net/route.h>
CLICK_CXX_UNPROTECT
#include <click/cxxunprotect.h>


By the way my element is called UDPTrafficFlows, and so far here is
what the configuration looks like:

	 if (cp_va_parse(conf, this, errh,
		cpUnsigned, "send rate", &rate,
		cpInteger, "limit", &limit,
		cpUnsigned, "packet length", &_len,
		cpUnsigned, "number of flows", &_nflows,
		cpUnsigned, "flow size", &_flowsize,
		cpKeywords,
		cpOptional,
		cpBool, cpString, "specify input file name?", &_useInput, 
		"INPUT_FILENAME", cpString, "input file name", &_infile,
		cpBool, cpString, "specify output file name?", &_useOutput, 
		"OUTPUT_FILENAME", cpString, "output file name", &_outfile,
		"LIMIT", cpInteger, "total ip generated", &limit,
		cpBool, "do UDP checksum?", &_cksum,
		cpBool, "active?", &_active,
		cpEnd) < 0)



More information about the click mailing list