[Click] File operations in Click
Eddie Kohler
kohler at cs.ucla.edu
Thu Jul 17 11:15:03 EDT 2008
There are lots of examples. An event is delivered to c on write. Probably
the most analogous code is in elements/ip/iproutetable.cc. Check out
add_handlers() and ctrl_handler() (ctrl_handler() is the element-specific code).
Eddie
Jelena Mirkovic wrote:
> That may work. Is there a sample code where I could see how to use the
> write handler? What I'm not clear about is if I do e.g. write c.count
> value (or whatever the syntax is) multiple times do I loop in c to
> read this or is there an event delivered to c on write?
>
> Thanks
> -------------------------------------
> Jelena Mirkovic
> Computer Scientist
> USC Information Sciences Institute
> 4676 Admiralty Way, Suite 1001
> Marina del Rey, CA 90292
> 310-448-9170
>
>
> On Jul 16, 2008, at 9:17 PM, Cliff Frey wrote:
>
>> You could add a write handler to your element, and write these
>> delays in (either one at a time, or a bunch at once).
>>
>> On Wed, Jul 16, 2008 at 8:00 PM, Jelena Mirkovic <mirkovic at isi.edu>
>> wrote:
>> Well, Script element is not quite what I want. I want to read a set of
>> IPs and delays like this:
>> MailScanner has detected a possible fraud attempt from
>> "1.1.1.1" claiming to be MailScanner warning: numerical links are
>> often malicious: 1.1.1.1 200
>> MailScanner has detected a possible fraud attempt from
>> "2.2.2.2" claiming to be MailScanner warning: numerical links are
>> often malicious: 2.2.2.2 300
>> then remember them in the kernel module. When a packet comes from
>> MailScanner has detected a possible fraud attempt from "1.1.1.1"
>> claiming to be MailScanner warning: numerical links are often
>> malicious: 1.1.1.1 I want to impose 200 ms delay, and for
>> MailScanner has detected a possible fraud attempt from "2.2.2.2"
>> claiming to be MailScanner warning: numerical links are often
>> malicious: 2.2.2.2 source 300 ms
>> delay. So I'm afraid some file reading is necessary and I cannot use
>> variables from Script. Or am I missing some other Script
>> functionality that may be useful?
>>
>> Thanks
>> -------------------------------------
>> Jelena Mirkovic
>> Computer Scientist
>> USC Information Sciences Institute
>> 4676 Admiralty Way, Suite 1001
>> Marina del Rey, CA 90292
>> 310-448-9170
>>
>>
>> On Jul 16, 2008, at 7:03 PM, Roman Chertov wrote:
>>
>>> Jelena Mirkovic wrote:
>>>> I've been trying to write a kernel module in Click that reads
>>>> address info from a file, then manipulates (drops or forwards)
>>>> packets for the specified addresses. I've had problems with using
>>>> fopen - basically click-install informs me that fopen is unknown
>>>> symbol even though I've included stdio.h in my file. I seem to
>>>> remember Linux kernel has a problem manipulating files. Is there
>>>> an easy way to open
>>> It is disallowed to use system calls inside the kernel. It is
>>> possible to still use them with some trickery but is best not to do
>>> so.
>>>
>>> Take a look at the Script element; it might be what you are looking
>>> for.
>>>
>>> Roman
>>>
>>>> and read a file from a Click kernel module?
>>>> Thanks
>>>> -------------------------------------
>>>> Jelena Mirkovic
>>>> Computer Scientist
>>>> USC Information Sciences Institute
>>>> 4676 Admiralty Way, Suite 1001
>>>> Marina del Rey, CA 90292
>>>> 310-448-9170
>>>> _______________________________________________
>>>> 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
>>
>
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
More information about the click
mailing list