Bug 195

Summary: Naming inconsitency: TcpHeader::GetDestinationPort vs UdpHeader::GetDestination
Product: ns-3 Reporter: Gustavo J. A. M. Carneiro <gjcarneiro>
Component: internetAssignee: ns-bugs <ns-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P1    
Version: pre-release   
Hardware: All   
OS: All   
Attachments: Refactor the udp-header naming for consistency with tcp-header

Description Gustavo J. A. M. Carneiro 2008-05-30 06:17:22 UTC
We have TcpHeader::GetDestinationPort to get the port number in TCP, but UdpHeader::GetDestination for UDP.  Can we get rid of the inconsistency?
Comment 1 Rajib Bhattacharjea 2008-05-30 15:15:31 UTC
Yes, do you have a preference for which way to go?  That is, do we rename the TcpHeader APIs to match the UdpHeader ones, or vice versa?
Comment 2 Gustavo J. A. M. Carneiro 2008-05-30 17:09:38 UTC
My personal preference would be GetDestinationPort instead of just GetDestination.
Comment 3 Craig Dowell 2008-05-30 17:19:26 UTC
Agree.  To me GetDestination makes me think of a destination address.  It's a TCP header, though and so you must be referring to something in there, rather than an address.  If you pull out your handy Stevens, you see on the inside cover that it must be referring to the source port number and destination port number (in his words).

Same story for UDP.

GetDestinationPort and GetSourcePort for TCP and UDP seem perfect.
Comment 4 Rajib Bhattacharjea 2008-06-06 13:03:53 UTC
Created attachment 155 [details]
Refactor the udp-header naming for consistency with tcp-header

This bug is about GetDestination, but for consistency, we should change the names of SetDestination, GetSource, and SetSource as well.  This patch does so.  Okay to push?
Comment 5 Mathieu Lacage 2008-06-06 13:06:22 UTC
(In reply to comment #4)
> Created an attachment (id=155) [edit]
> Refactor the udp-header naming for consistency with tcp-header
> 
> This bug is about GetDestination, but for consistency, we should change the
> names of SetDestination, GetSource, and SetSource as well.  This patch does so.
>  Okay to push?


looks good to me.
Comment 6 Tom Henderson 2008-06-06 13:25:45 UTC
OK
Comment 7 Mathieu Lacage 2008-06-06 14:42:21 UTC
changeset: 3b24ac252fba