diff options
author | David Sommerseth <davids@redhat.com> | 2013-09-13 20:18:57 +0200 |
---|---|---|
committer | David Sommerseth <davids@redhat.com> | 2013-09-13 20:18:57 +0200 |
commit | d3f5fd74bdb903c032eca8ab4e391172d3162c76 (patch) | |
tree | 89da2c01762ecf0bb8cee3b195b36ecc329abb28 /python-ethtool/etherinfo_struct.h | |
parent | f8b0e05c03add3d0bd7736c3e3f81e8eb28bc7c3 (diff) | |
download | python-ethtool-d3f5fd74bdb903c032eca8ab4e391172d3162c76.tar.gz python-ethtool-d3f5fd74bdb903c032eca8ab4e391172d3162c76.tar.xz python-ethtool-d3f5fd74bdb903c032eca8ab4e391172d3162c76.zip |
Merge PyNetlinkIPv4Address and PyNetlinkIPv6Address classes
Simplify the overall implementation by reusing code more efficiently.
The differences between the IPv4 and IPv6 implementation in libnl is
minimal and can more easily be differentiated those few places its
needed instead.
Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to 'python-ethtool/etherinfo_struct.h')
-rw-r--r-- | python-ethtool/etherinfo_struct.h | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/python-ethtool/etherinfo_struct.h b/python-ethtool/etherinfo_struct.h index dff1105..72e4962 100644 --- a/python-ethtool/etherinfo_struct.h +++ b/python-ethtool/etherinfo_struct.h @@ -39,22 +39,16 @@ struct etherinfo { }; /* Python object containing data baked from a (struct rtnl_addr) */ -typedef struct PyNetlinkIPv4Address { +typedef struct PyNetlinkIPaddress { PyObject_HEAD - PyObject *ipv4_address; /**< string: Configured IPv4 address */ - int ipv4_netmask; /**< int: Configured IPv4 netmask */ + int family; /**< int: must be AF_INET or AF_INET6 */ + PyObject *local; /**< string: Configured local IP address */ + PyObject *peer; /**< string: Configured peer IP address */ PyObject *ipv4_broadcast; /**< string: Configured IPv4 broadcast address */ -} PyNetlinkIPv4Address; -extern PyTypeObject ethtool_netlink_ipv4_address_Type; - -/* Python object containing data baked from a (struct rtnl_addr) */ -typedef struct PyNetlinkIPv6Address { - PyObject_HEAD - PyObject *ipv6_address; /**< string: Configured IPv6 address */ - int ipv6_netmask; /**< int: Configured IPv6 prefix */ - PyObject *ipv6_scope; /**< string: IPv6 address scope */ -} PyNetlinkIPv6Address; -extern PyTypeObject ethtool_netlink_ipv6_address_Type; + int prefixlen; /**< int: Configured network prefix (netmask) */ + PyObject *scope; /**< string: IP address scope */ +} PyNetlinkIPaddress; +extern PyTypeObject ethtool_netlink_ip_address_Type; /** * Contains the internal data structure of the |