Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Mar 2004 02:01:30 +0300
From:      Gleb Smirnoff <glebius@cell.sick.ru>
To:        Ruslan Ermilov <ru@freebsd.org>, julian@freebsd.org, archie@freebsd.org, freebsd-net@freebsd.org
Subject:   Nodes having common properties. Was: kern/63864: [patch] new control message for ng_iface(4) - getifindex
Message-ID:  <20040316230130.GA20251@cell.sick.ru>
In-Reply-To: <20040309185957.GB74537@cell.sick.ru>
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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