Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 May 2001 13:04:19 -0700 (PDT)
From:      Archie Cobbs <archie@dellroad.org>
To:        "Roman V. Palagin" <romanp@unshadow.net>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: How to transfer data from netgraph node to user program?
Message-ID:  <200105172004.f4HK4Jm76648@arch20m.dellroad.org>
In-Reply-To: <Pine.SOL.4.33.0105142254130.3484-100000@abyss.unshadow.net> "from Roman V. Palagin at May 14, 2001 11:24:07 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Roman V. Palagin writes:
> I've wrote netgraph node which collects some information from network. Now
> I want to transfer collected data into user program. I've NGM_XXX_STAT
> message which initiates data transfer and program which uses libnetgraph
> to communicate with node. When I send NGM_XXX_STAT message node must
> starts data transfer but I don't know exactly how much data should be
> transfered so I can't use synhronous reply. Also, NgSendMsg(...,
> NGM_XXX_STAT, ...) doesn't return until handler of NGM_XXX_STAT is
> finished, so I can't use ng_send_msg() in NGM_XXX_STAT handler - nobody
> will read sended messages and I finished up with "No buffer space
> available".
> 
> The question is: how I can initiate smth. like asynchronous reply (so I
> can get data via NgRecvMsg later in my prgram)? Or I'm going wrong way and
> should use another scheme for data transfer? Data size ranges from 10Kb to
> 500Kb.

Whenever you're ready to send the reply, just create one and send it.
You'll want the same 'token' value in the reply and you'll want to
set the NGF_REPLY bit in the flags word to indicate it's a reply.
For an exmple of doing this, see pppoe_send_event() in ng_pppoe.c
(this is not a reply but shows how to create and send a message).

-Archie

__________________________________________________________________________
Archie Cobbs     *     Packet Design     *     http://www.packetdesign.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105172004.f4HK4Jm76648>