diff options
author | Tom Gundersen <teg@jklm.no> | 2013-10-28 20:59:56 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2013-10-29 14:17:57 +0100 |
commit | 5fde13d748749f0e06e2e6cdd15f0980a79ea82c (patch) | |
tree | a10f8106048135d1f84b3dbe6c1ec9d8827afd1f /src/udev/net/ethtool-util.h | |
parent | 916484f54d084e11a11458716b2e0bbdf4822d40 (diff) |
udev: link-config - add proper parsing
Diffstat (limited to 'src/udev/net/ethtool-util.h')
-rw-r--r-- | src/udev/net/ethtool-util.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/udev/net/ethtool-util.h b/src/udev/net/ethtool-util.h index 74bbada6ed..a02088fd9e 100644 --- a/src/udev/net/ethtool-util.h +++ b/src/udev/net/ethtool-util.h @@ -19,7 +19,37 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#pragma once + +#include <macro.h> + +/* we can't use DUPLEX_ prefix, as it + * clashes with <linux/ethtool.h> */ +typedef enum Duplex { + DUP_FULL, + DUP_HALF, + _DUP_MAX, + _DUP_INVALID = -1 +} Duplex; + +typedef enum WakeOnLan { + WOL_PHY, + WOL_MAGIC, + WOL_OFF, + _WOL_MAX, + _WOL_INVALID = -1 +} WakeOnLan; + int ethtool_connect(int *ret); -int ethtool_set_speed(int fd, const char *ifname, const unsigned int speed, const char *duplex); -int ethtool_set_wol(int fd, const char *ifname, const char *wol); +int ethtool_set_speed(int fd, const char *ifname, unsigned int speed, Duplex duplex); +int ethtool_set_wol(int fd, const char *ifname, WakeOnLan wol); + +const char *duplex_to_string(Duplex d) _const_; +Duplex duplex_from_string(const char *d) _pure_; + +const char *wol_to_string(WakeOnLan wol) _const_; +WakeOnLan wol_from_string(const char *wol) _pure_; + +int config_parse_duplex(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); +int config_parse_wol(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); |