From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 16 22:13:49 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09BD7106566B for ; Mon, 16 Mar 2009 22:13:49 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from kientzle.com (kientzle.com [66.166.149.50]) by mx1.freebsd.org (Postfix) with ESMTP id 5037E8FC15 for ; Mon, 16 Mar 2009 22:13:48 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: (from root@localhost) by kientzle.com (8.14.3/8.14.3) id n2GLaMUA000146; Mon, 16 Mar 2009 14:36:22 -0700 (PDT) (envelope-from kientzle@freebsd.org) Received: from [10.123.2.23] (fw2.kientzle.com [10.123.1.2]) by kientzle.com with SMTP id kptcxzkb9bcgg37crnjkevmhtn; Mon, 16 Mar 2009 14:36:22 -0700 (PDT) (envelope-from kientzle@freebsd.org) Message-ID: <49BEC656.50702@freebsd.org> Date: Mon, 16 Mar 2009 14:36:22 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060422 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Cipta H References: <13b997e60903160716x21881adfma588c32551c36e6f@mail.gmail.com> <21C1FF9D-4CDA-4476-9F11-3DE281279C1A@freebsd.org> <13b997e60903161141j8faaf7frd6ce9b1423b40164@mail.gmail.com> <49BEA2BC.6000405@delphij.net> <13b997e60903161213t320252dbg56e96335e79f7eb9@mail.gmail.com> In-Reply-To: <13b997e60903161213t320252dbg56e96335e79f7eb9@mail.gmail.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, d@delphij.net Subject: Re: writing libnetstat for Summer of Code 2009 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2009 22:13:49 -0000 Many people consider top-posting to be rude. FYI. My comments below, where they belong. Cipta H wrote: > Thanks for the reply, Xin. I'm aware of something called sysctl, and if > I am accepted to work on this project, my main task is to ensure all live > network data will come from sysctl, but the only XML I know of is the > markup language. Perhaps someone more knowledgeable can point me > to the right resource? Thanks in advance. > > Cipta > > On Mon, Mar 16, 2009 at 3:04 PM, Xin LI wrote: > >>I'm not very sure but I think Rui is referring XML like the GEOM >>subsystem has used (perhaps to have the kernel expose the statistics >>data with XML and the userland part of the library parse and return the >>result)? There are two different issues: * Kernel <-> userland communications * library <-> client program communications There is ample precedent for the former to use sysctl interfaces that return XML from the kernel that is then parsed in userland. In particular, this makes it much easier to extend in the future, as long as the proposed libnetstat library ignores data it doesn't understand. (In the past, many tools parsed in-kernel data structures to obtain this kind of information, which is prone to breakage whenever the kernel changes. Making this so that kernel and tools can evolve more independently is a major goal here.) For the latter, some kind of opaque C structure makes sense, since that simplifies the client programs. So really this breaks down into two very different tasks: * Designing and implementing a sysctl that returns network statistics as an XML blob * Designing and implementing a C library that knows how to fetch the XML blob, parse it, and return data to client programs. Does this make more sense now? Tim