[Ns-developers] TCP and UDP layer refactoring

Mathieu Lacage mathieu.lacage at sophia.inria.fr
Mon Jul 7 10:07:12 PDT 2008


On Fri, 2008-07-04 at 13:43 +0200, Sébastien Vincent wrote:

> > - Allocate() method takes Address arguments and return EndPoint*.
> I forgot one thing :
> In *L4Protocol::Allocate(void) and *L4Protocol::Allocate(uint16_t port) 
> we could not determine which L3 protocol we want and set the according 
> Ipv*EndPointDemux (to allocate).
> 
> Two solutions to solve the problem :
> 
> 1)
> Have the following prototypes instead :
> EndPoint *L4Protocol::Allocate(Ipv4Address addr = Ipv4Address::Any());
> EndPoint *L4Protocol::Allocate(uint16_t port, Ipv4Address addr = 
> Ipv4Address::Any());
> EndPoint *L4Protocol::Allocate(Ipv6Address addr = Ipv6Address::Any());
> EndPoint *L4Protocol::Allocate(uint16_t port, Ipv6Address addr = 
> Ipv6Address::Any());
> 
> Not very aesthetic!
> 
> 2)
> Don't use Allocate(void) and Allocate(uint16_t port).
> Replace them in the *SocketImpl code by Allocate(Ipv*Address::Any()) and 
> Allocate(Ipv*Address::Any(), port).
> Remove Ipv*EndPointDemux::Allocate (void).
> 
> Easy to do!


2) looks much better.



More information about the Ns-developers mailing list