[Ns-developers] TCP and UDP layer refactoring
Gustavo Carneiro
gjcarneiro at gmail.com
Mon Jul 7 06:33:51 PDT 2008
2008/7/7 Tom Henderson <tomh at tomh.org>:
> Sébastien Vincent wrote:
>
>
>> Ok so if I summarize :
>> - Remove incomingInterface from EndPointDemux::Lookup() and associate
>> code.
>> - One EndPointDemux with a ::Lookup() function for each address family
>> (IPv4 and IPv6).
>> - *L4Protocol and *SocketImpl use Address and test with
>> *Address::IsMatchingType().
>> - Have a single tag called SocketAddressesTag with Address parameters and
>> test as usual (*Address::IsMatchingType).
>>
>
> I am still not clear on whether and where tags for these addresses are
> needed, and where they are removed.
>
>
>> If you are OK with this, I can begin something this week.
>>
>>
> It seems reasonable to me to prototype something like you summarized and
> see how it comes out. Perhaps other people working on the internals of
> internet-stack could review this plan also.
OK, I'll chip in with some comments, since I hacked that code in the past (
http://www.nsnam.org/bugzilla/show_bug.cgi?id=136).
It sounds OK to remove the interface pointer parameter, but then you have to
replace it with either:
1- A list of addresses associated with the netdevice in question;
2- A tag containing: a) a list of addresses, or b) NetDevice index;
The endpoint demux matching algorithm in question is supposed to be along
these lines (at least a part of it):
FOREACH endpoint:
// match destination address
IF packet.destAddr is unicast:
IF endpoint.destAddr != 0 AND packet.destAddr != endpoint.destAddr:
CONTINUE
ELSE: // broadcast or multicast
IF endpoint.destAddr == 0:
PASS // socket is not bound to any specific interface, this
always matches
ELSE:
interfaceMatches = False
FOREACH interfaceAddress IN
incomingInterface.GetAllAddresses():
IF endpoint.destAddr == interfaceAddress:
interfaceMatch = True
BREAK
IF NOT interfaceMatches:
CONTINUE
// match destination port
IF endpoint.destPort != 0 AND packet.destPort != endpoint.destPort:
CONTINUE
matches.push_back (endpoint);
Now, the only thing that can change here is how to obtain the information
incomingInterface.GetAllAddresses(), but the information needs to come from
somewhere.
I hope this helps clear things up a bit.
--
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
More information about the Ns-developers
mailing list