Nodes having common properties. Was: kern/63864: [patch] new
control message for ng_iface(4) - getifindex
Gleb Smirnoff
glebius at cell.sick.ru
Tue Mar 16 15:01:34 PST 2004
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
More information about the freebsd-net
mailing list