Subject: Re: ipsec pcb/socket passing
To: None <jonathan@DSG.Stanford.EDU>
From: Jun-ichiro itojun Hagino <itojun@itojun.org>
List: tech-net
Date: 08/25/2003 07:27:52
> Maybe so.  Where I come from, such examples are a staple ingredient of
> programming-language courses. Perhaps I am brainwashed, but both the
> courses and experience left me (strongly) opposed to burying switches
> on object-type, deeply nested two or three levels of abstraction below
> the object being swicthed on.
> 
> IME, it is almost invariably a nightmare for documentation, ease of
> maintenance, and eventual clarity and quality of code -- all things
> which are important to the NetBSD project.

	i guess you are ignoring cases with IPv4 mapped address, so you are
	seeing simpler picture than me.
	(NOTE: I'm not advocating it.  i'm very opposed of the idea of IPv4
	mapped address.  however, for compatibility's sake we need to support
	it no matter what)
	even if you define common inpcb_hdr structure, you have to go back
	to socket layer to know whether it is:
	- IPv4 pcb
	- IPv6 pcb with IPv4 mapped address
	- IPv6 pcb with something other than IPv4 mapped address
	the only way you can tell which L3 protocol being used is to see
	so->so_proto->pr_domain->dom_family.  so i don't see the point in
	passing inpcb * when you need to go back to socket * anyways.

itojun