From owner-freebsd-hackers Thu May 17 13: 5:12 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from InterJet.dellroad.org (adsl-63-194-81-26.dsl.snfc21.pacbell.net [63.194.81.26]) by hub.freebsd.org (Postfix) with ESMTP id C0B7637B422 for ; Thu, 17 May 2001 13:05:09 -0700 (PDT) (envelope-from archie@dellroad.org) Received: from arch20m.dellroad.org (arch20m.dellroad.org [10.1.1.20]) by InterJet.dellroad.org (8.9.1a/8.9.1) with ESMTP id NAA73374; Thu, 17 May 2001 13:05:08 -0700 (PDT) Received: (from archie@localhost) by arch20m.dellroad.org (8.11.3/8.11.3) id f4HK4Jm76648; Thu, 17 May 2001 13:04:19 -0700 (PDT) (envelope-from archie) From: Archie Cobbs Message-Id: <200105172004.f4HK4Jm76648@arch20m.dellroad.org> Subject: Re: How to transfer data from netgraph node to user program? In-Reply-To: "from Roman V. Palagin at May 14, 2001 11:24:07 pm" To: "Roman V. Palagin" Date: Thu, 17 May 2001 13:04:19 -0700 (PDT) Cc: freebsd-hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL82 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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