From owner-freebsd-hackers@FreeBSD.ORG  Sun Dec 10 08:25:56 2006
Return-Path: <owner-freebsd-hackers@FreeBSD.ORG>
X-Original-To: freebsd-hackers@freebsd.org
Delivered-To: freebsd-hackers@freebsd.org
Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 90E1216A416
	for <freebsd-hackers@freebsd.org>; Sun, 10 Dec 2006 08:25:56 +0000 (UTC)
	(envelope-from julian@elischer.org)
Received: from outE.internet-mail-service.net (outE.internet-mail-service.net
	[216.240.47.228])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 5409A43CA3
	for <freebsd-hackers@freebsd.org>; Sun, 10 Dec 2006 08:24:47 +0000 (GMT)
	(envelope-from julian@elischer.org)
Received: from shell.idiom.com (HELO idiom.com) (216.240.47.20)
	by out.internet-mail-service.net (qpsmtpd/0.32) with ESMTP;
	Sun, 10 Dec 2006 00:11:23 -0800
Received: from [192.168.2.4] (home.elischer.org [216.240.48.38])
	by idiom.com (8.12.11/8.12.11) with ESMTP id kBA8Pr1B065022;
	Sun, 10 Dec 2006 00:25:54 -0800 (PST)
	(envelope-from julian@elischer.org)
Message-ID: <457BC490.30904@elischer.org>
Date: Sun, 10 Dec 2006 00:25:52 -0800
From: Julian Elischer <julian@elischer.org>
User-Agent: Thunderbird 1.5.0.8 (Macintosh/20061025)
MIME-Version: 1.0
To: =?ISO-8859-9?Q?=D6zkan_KIRIK?= <ozkan@mersin.edu.tr>
References: <eb7c8e2e0612091218r61bb72b4q49faee99d85c509d@mail.gmail.com>	<20061209.222526.-816359937.imp@bsdimp.com>
	<457BBCC3.9040605@mersin.edu.tr>
In-Reply-To: <457BBCC3.9040605@mersin.edu.tr>
Content-Type: text/plain; charset=ISO-8859-9; format=flowed
Content-Transfer-Encoding: 8bit
Cc: freebsd-hackers@freebsd.org
Subject: Re: Example network protocol implementation
X-BeenThere: freebsd-hackers@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: Technical Discussions relating to FreeBSD
	<freebsd-hackers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-hackers>, 
	<mailto:freebsd-hackers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-hackers>
List-Post: <mailto:freebsd-hackers@freebsd.org>
List-Help: <mailto:freebsd-hackers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-hackers>,
	<mailto:freebsd-hackers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 10 Dec 2006 08:25:56 -0000

Özkan KIRIK wrote:
> I think netgraph subsystem provides this infrastructure for implementing 
> new protocols.
> 
> according to netgraph (4) man page:
> 
>    The aim of *netgraph* is to supplement rather than replace the existing
>     kernel networking infrastructure.    It provides:
> 
>     *·*     A flexible way of combining protocol and link level drivers.
>     *·*     A modular way to implement new protocols.
>     *·*     A common framework for kernel entities to inter-communicate.
>     *·*     A reasonably fast, kernel-based implementation.
> 
> There are many examples and applications at this address:
> http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/netgraph/

also look it up in the daemon news archives at:
http://ezine.daemonnews.org/200003/netgraph.html

a little out of date but the basic ideas are still right.


> 
> 
> you implementation may be "ng_iscsi" :)

I thought of this but the trick is to do with the locking..
You would need to get a transfer of control from the
netgraph locking domain to the geom or scsi universe's locking domain.

There are all the components needed if you consider using the ksocket
netgraph node to open a TCP socket within the kernel, and you could hook 
that to a scsi device netgraph node almost directly if you wrote it,
but the hardest part will be to create a method of crossing that locking
divide.

Still it's possibly worth looking at. Of course the method suggested by
Warner is also very valid and may be about the same amount of work.


> 
> I hope this helps,
> 
> Özkan KIRIK
> EnderUNIX SDT @ Turkey
> Software Developer
>