[Click] Writing your own element

Amita Ekbote amita.ekbote at gmail.com
Sat Jan 23 21:59:41 EST 2010


Yup it will. I have the PingSender already written, I was just wondering if
it could be done in a single element. But I think ill go ahead with the two
element thing. Thanks a lot for the inputs.

On Sat, Jan 23, 2010 at 7:28 PM, Ian Rose <ianrose at eecs.harvard.edu> wrote:

> Ok so let me see if I have this straight.  You want to:
>
> 1) send out packets at some regular interval (via a timer), similar to
> pings
>
> 2) send a response packet (like a ping reply) whenever a packet is received
>
> Why not make these 2 different elements for simplicity?  So element #1
> (PingSender) would just send out packets based on a timer - you could maybe
> even just reuse TimedSource for this although if you are including a
> sequence number or something such that the packets are not all identical
> then you may have to write your own, but it should be pretty simple.  This
> would be an PUSH element with 0 inputs and 1 output.
>
> Element #2 (PingResponder) would be a PUSH element with 1 input and 1
> output.  Whenever a packet is received, you respond with another packet.
>
> Put it all together and your click config could be something like:
>
> FromDevice -> PingResponder -> out::Queue -> ToDevice;
> PingSender -> out;
>
> Of course you will probably also need some Classifier() and other elements
> in there, but you get the general idea I hope...
>
> Does that sound like it could accomplish what you are trying to do?
>
> - Ian
>
>
>
> Amita Ekbote wrote:
>
>> Hey,
>>
>> The element is going to try and measure the link quality. In my element I
>> have the run_timer which is just sending out packets, I have written a small
>> client program to make sure that these packets make it. Once a packet is
>> received the client sends back a packet. I have the pull function which just
>> contains the pull print statement. I put a print statement before my click
>> element and it does receive a packet. For processing I have used "a/a" .
>>
>> On Sat, Jan 23, 2010 at 12:15 PM, Ian Rose <ianrose at eecs.harvard.edu<mailto:
>> ianrose at eecs.harvard.edu>> wrote:
>>
>>    Could you say a bit more about how you want this element to work -
>>    I'm afraid I'm not really getting the full picture.  Perhaps an
>>    example of how a packet should be handled would help.  And when you
>>    say that the receive "is not working out", what do you mean?  Are
>>    packets never received by your element?  It might help to put a
>>    Print element right before your element (in your click
>>    configuration) - this element will Print some stuff to the console
>>    every time a packet flows through it, so if nothing is ever printed
>>    then you know that packets simply aren't moving and it might be a
>>    problem with your click config itself (in which case, send it in an
>>    email so we can take a look).
>>
>>    Also, what does your elements 'processing' method return?  Just look
>>    in <yourelement>.hh and you should see something like:
>>
>>    const char *processing() const  { return PUSH; }
>>
>>    or
>>
>>    const char *processing() const  { return AGNOSTIC; }
>>
>>    If you don't see a processing method then you are using the default
>>    (AGNOSTIC).
>>
>>    - Ian
>>
>>
>>    Amita Ekbote wrote:
>>
>>        Hello,
>>
>>        I need to write an element which can send packets and receive
>>        packets. The
>>        send needs to be like the timed source and based on packets
>>        received the
>>        send packet will be modified. The send and receive is to the
>>        same ip but
>>        different port numbers. I have the run_timer function which
>>        sends the packet
>>        but integrating  the receive part in the same element is not
>>        working out. I
>>        could write another element for receive and pass it as
>>        configuration to the
>>        send but was hoping to integrate them into one element. Any
>>        suggestions
>>        would be appreciated.
>>
>>        Thanks
>>
>>
>>
>>
>> --
>> Amita Ekbote
>>
>


-- 
Amita Ekbote


More information about the click mailing list