[Click] About my ipsec additions

Markku Savela Markku.Savela at vtt.fi
Mon Jun 25 02:37:54 EDT 2012


On 06/22/2012 07:00 PM, Eddie Kohler wrote:

> But I looked through it very briefly for nits. Here are two,
> interested in your thoughts.
> - IPsec::Mutex: Why? We have Spinlock for this... At least make it a
> nested class or call it IPsecMutex.

I guess I forgot to look for such. Though, the main service
of my version is the automatic lock on construct and automatic
release on destructor -- you get "critical" region for the code
block by simply declaring the mutex inside it -- no other calls
needed because the compiler does all the work (no worry about
accidentally leaving the lock on). But yes, could be derived
from Spinlock...

> - dynamic_cast: What you actually want to do here is call "cast()", a
> Click-specific function designed for exactly this use. So
>
> IPsecTransform *tr = (IPsecTransform *)
> e->output(port).element()->cast("IPsecTransform");

Assuming it returns NULL, if element is not derived from
IPsecTransform.


More information about the click mailing list