I am curious as to why sockaddr
is used inside pcap_addr_t
which is given to you when calling pcap_findalldevs
. The reason this is not so straight forward is because sockaddr_in
contains information about the address and port. This is similar to .NET's System.Net.IPEndPoint
class.
If we were looking at a .NET library, I would not expect to see a property such as that with a description about addresses belonging to a device. As far as I know, no protocols define an address and port when describing a device on a system.
On all of my devices (IPv4 and IPv6 only), the port is 0.
When would it be beneficial to associate an address and port to a device as one of its owned endpoints? The reason I ask is because I am developing a C# binding for libpcap and want to know if it would be useful or just erroneous/silly to expose all of the data from sockaddr_in
to the user in the form of a System.Net.IPEndPoint
property on my NetworkDeviceAddress
class which describes the addresses owned by a particular device.