[Olsr-dev] socket

Henning Rogge (spam-protected)
Thu Jun 17 08:07:21 CEST 2010


On Wed June 16 2010 19:39:55 Airton Ishimori wrote:
> void add_olsr_socket (int fd, socket_handler_func pf_pr,
> socket_handler_func pf_imm, void *data, unsigned int flags);
Yes, I agree... this function could be done better (putting it onto the 0.7.0 
TODO list).

If you have a good suggestion how to clean up the interface, just reply to 
this mail. ;)
 
> In above prototype function in olsrd-0.6 , what means the parameters? and
> what difference between pf_pr and pf_imm? It's obrigatory put all
> parameters in the call function?

There are two different kind of socket handlers in the scheduler of OLSRd. One 
type is the "polling sockets" and one is the "immediate socket".

Polling sockets will only accumulate their traffic until the OLSRd polling 
interval triggers to conserve cpu and energy. All handling of OLSRd messages 
is done in polling sockets (typically 20 times per second).

Immediate sockets will trigger as soon as it's possible, even outside the 
polling. The BMF plugin (in 0.6.0) use this sockets to forward the multicast 
traffic.

*copied*
> void add_olsr_socket (int fd, socket_handler_func pf_pr,
> socket_handler_func pf_imm, void *data, unsigned int flags);
"fd" and "flags" are mandatory arguments.

There are four flags (as bitsets) defined in scheduler.h, that can be 
combined:
SP_PR_READ: POLLING handler should be called for READ events
SP_PR_WRITE: POLLING handler should be called for WRITE events
SP_IMM_READ: IMMEDIATE handler should be called for READ events
SP_IMM_WRITE: IMMEDIATE handler should be called for WRITE events

if you use the first or second (or both), you need to define pf_pr.
If you use the third or fourth, you need to define pf_imm.

Henning Rogge
-- 
Diplom-Informatiker Henning Rogge , Fraunhofer-Institut für
Kommunikation, Informationsverarbeitung und Ergonomie FKIE
Kommunikationssysteme (KOM)
Neuenahrer Straße 20, 53343 Wachtberg, Germany
Telefon +49 228 9435-961,   Fax +49 228 9435 685
mailto:(spam-protected) http://www.fkie.fraunhofer.de
GPG: E1C6 0914 490B 3909 D944 F80D 4487 C67C 55EC CFE0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20100617/cc52f19a/attachment.sig>


More information about the Olsr-dev mailing list