]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/udev/net/ethtool-util.h
Merge pull request #2589 from keszybz/resolve-tool-2
[thirdparty/systemd.git] / src / udev / net / ethtool-util.h
1 /***
2 This file is part of systemd.
3
4 Copyright (C) 2013 Tom Gundersen <teg@jklm.no>
5
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
10
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <http://www.gnu.org/licenses/>.
18 ***/
19
20 #pragma once
21
22 #include <macro.h>
23
24 /* we can't use DUPLEX_ prefix, as it
25 * clashes with <linux/ethtool.h> */
26 typedef enum Duplex {
27 DUP_FULL,
28 DUP_HALF,
29 _DUP_MAX,
30 _DUP_INVALID = -1
31 } Duplex;
32
33 typedef enum WakeOnLan {
34 WOL_PHY,
35 WOL_MAGIC,
36 WOL_OFF,
37 _WOL_MAX,
38 _WOL_INVALID = -1
39 } WakeOnLan;
40
41 int ethtool_connect(int *ret);
42
43 int ethtool_get_driver(int *fd, const char *ifname, char **ret);
44 int ethtool_set_speed(int *fd, const char *ifname, unsigned int speed, Duplex duplex);
45 int ethtool_set_wol(int *fd, const char *ifname, WakeOnLan wol);
46
47 const char *duplex_to_string(Duplex d) _const_;
48 Duplex duplex_from_string(const char *d) _pure_;
49
50 const char *wol_to_string(WakeOnLan wol) _const_;
51 WakeOnLan wol_from_string(const char *wol) _pure_;
52
53 int config_parse_duplex(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
54 int config_parse_wol(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);