[netgraph] NGF_RESP

Harti Brandt brandt at fokus.fraunhofer.de
Thu Jun 5 00:42:55 PDT 2003


On Wed, 4 Jun 2003, Vincent Jardin wrote:

VJ>Hi,
VJ>
VJ>I'm trying to understand how does NGF_RESP work and how can it be used ?
VJ>
VJ>According to ng_message.h, it is a flag that describes a response message,
VJ>however are all the response messages synchronous to a request or could some
VJ>messages be asynchronous ? If some messages could be asynchronous, what does
VJ>receive these messages ?

If you look at the NG_MKRESPONSE macro you'll see that a response has the
same cookie, token and cmd code as the original command. The difference
is, that the response flag is set. There is no need to send a response
immediately, you can do it anytime later.

I use asynchronuous messages in my ng_atm node for things like carrier
change and PVC changes. I have defined a message code for this just like
other message codes for the node (just with command codes above 10000).
The node defines a special hook 'manage'. If this hook is connected, these
messages are sent to the node at the other end of the hook. The SNMP
daemon connects this hook when it starts to manage the interface and so
receives these asynchronuous messages. Another possibility is to configure
a node number or path into the node, where it should send messages to.
This technique, however, may be subject to races when nodes are
created/destroyed.

harti
-- 
harti brandt,
http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private
brandt at fokus.fraunhofer.de, harti at freebsd.org


More information about the freebsd-net mailing list