From owner-freebsd-net@FreeBSD.ORG Tue Mar 16 15:01:33 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E8F8E16A4CE; Tue, 16 Mar 2004 15:01:33 -0800 (PST) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0FAF643D1F; Tue, 16 Mar 2004 15:01:33 -0800 (PST) (envelope-from glebius@cell.sick.ru) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.12.9/8.12.8) with ESMTP id i2GN1UQE020384 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 17 Mar 2004 02:01:30 +0300 (MSK) (envelope-from glebius@cell.sick.ru) Received: (from glebius@localhost) by cell.sick.ru (8.12.9/8.12.6/Submit) id i2GN1UGj020383; Wed, 17 Mar 2004 02:01:30 +0300 (MSK) Date: Wed, 17 Mar 2004 02:01:30 +0300 From: Gleb Smirnoff To: Ruslan Ermilov , julian@freebsd.org, archie@freebsd.org, freebsd-net@freebsd.org Message-ID: <20040316230130.GA20251@cell.sick.ru> Mail-Followup-To: Gleb Smirnoff , Ruslan Ermilov , julian@freebsd.org, archie@freebsd.org, freebsd-net@freebsd.org References: <200403072302.i27N2StR008804@freefall.freebsd.org> <20040308102033.GA66247@cell.sick.ru> <20040308212939.GB30394@ip.net.ua> <20040308214820.GA68803@cell.sick.ru> <20040309065356.GA55139@ip.net.ua> <20040309185957.GB74537@cell.sick.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20040309185957.GB74537@cell.sick.ru> User-Agent: Mutt/1.5.6i Subject: Nodes having common properties. Was: kern/63864: [patch] new control message for ng_iface(4) - getifindex X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2004 23:01:34 -0000 We have communicated a bit with ru in private mail. He insist on some OO like model: if we invent some generic properties for all interface nodes, they must be inherited, rather than supported by the node itself. So I have proposed a different approach, and ru liked it. What will you say about it? Two new fields in struct ng_type are introduced: - u_int32_t family, a generic node type. All current nodes have this field as 0, they have no similar properties. For example, interface node family has value of 1. - void *family_data, a pointer to a family specific data. In case of interface family, it'll be struct ifnet *. A macro for assigning to a specific family is written. This macro sets type and sets pointer to proper data. Within this approach we have got kind of inherited properties. The only thing node needs to join some family, is to set its family and pass pointer to data. After this, it will support all family messages. Family specific messages really never reach the node code. They are handled in ng_base.c. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE