ethtool-util.h revision aedca89268ed4fd6be41e55a605f011033ad1fb5
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt/***
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt This file is part of systemd.
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt Copyright (C) 2013 Tom Gundersen <teg@jklm.no>
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt systemd is free software; you can redistribute it and/or modify it
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt under the terms of the GNU Lesser General Public License as published by
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt the Free Software Foundation; either version 2.1 of the License, or
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt (at your option) any later version.
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt systemd is distributed in the hope that it will be useful, but
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt WITHOUT ANY WARRANTY; without even the implied warranty of
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt Lesser General Public License for more details.
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt You should have received a copy of the GNU Lesser General Public License
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt along with systemd; If not, see <http://www.gnu.org/licenses/>.
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt***/
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt#pragma once
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt#include <macro.h>
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt/* we can't use DUPLEX_ prefix, as it
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt * clashes with <linux/ethtool.h> */
3ad0c5d8a4e2e2fa7ffcccd7f3457f577908494eTom Gundersentypedef enum Duplex {
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt DUP_FULL,
5c79bd79839f1e50bd3c34a0670037f7965ca5a4Patrik Flykt DUP_HALF,
be3a09b7ffe62b52658e77ae4d6638d1b0dae654Patrik Flykt _DUP_MAX,
be3a09b7ffe62b52658e77ae4d6638d1b0dae654Patrik Flykt _DUP_INVALID = -1
c62c4628d9dbc27effd36143c75abe528f561867Patrik Flykt} Duplex;
c62c4628d9dbc27effd36143c75abe528f561867Patrik Flykt
c62c4628d9dbc27effd36143c75abe528f561867Patrik Flykttypedef enum WakeOnLan {
c62c4628d9dbc27effd36143c75abe528f561867Patrik Flykt WOL_PHY,
c62c4628d9dbc27effd36143c75abe528f561867Patrik Flykt WOL_MAGIC,
1c4baffc1895809bae9ac36b670af90a4cb9cd7dTom Gundersen WOL_OFF,
c62c4628d9dbc27effd36143c75abe528f561867Patrik Flykt _WOL_MAX,
c62c4628d9dbc27effd36143c75abe528f561867Patrik Flykt _WOL_INVALID = -1
c62c4628d9dbc27effd36143c75abe528f561867Patrik Flykt} WakeOnLan;
c62c4628d9dbc27effd36143c75abe528f561867Patrik Flykt
c62c4628d9dbc27effd36143c75abe528f561867Patrik Flyktint ethtool_connect(int *ret);
c62c4628d9dbc27effd36143c75abe528f561867Patrik Flykt
1c4baffc1895809bae9ac36b670af90a4cb9cd7dTom Gundersenint ethtool_get_driver(int *fd, const char *ifname, char **ret);
c62c4628d9dbc27effd36143c75abe528f561867Patrik Flyktint ethtool_set_speed(int *fd, const char *ifname, unsigned int speed, Duplex duplex);
be3a09b7ffe62b52658e77ae4d6638d1b0dae654Patrik Flyktint ethtool_set_wol(int *fd, const char *ifname, WakeOnLan wol);
be3a09b7ffe62b52658e77ae4d6638d1b0dae654Patrik Flykt
be3a09b7ffe62b52658e77ae4d6638d1b0dae654Patrik Flyktconst char *duplex_to_string(Duplex d) _const_;
be3a09b7ffe62b52658e77ae4d6638d1b0dae654Patrik FlyktDuplex duplex_from_string(const char *d) _pure_;
be3a09b7ffe62b52658e77ae4d6638d1b0dae654Patrik Flykt
be3a09b7ffe62b52658e77ae4d6638d1b0dae654Patrik Flyktconst char *wol_to_string(WakeOnLan wol) _const_;
be3a09b7ffe62b52658e77ae4d6638d1b0dae654Patrik FlyktWakeOnLan wol_from_string(const char *wol) _pure_;
be3a09b7ffe62b52658e77ae4d6638d1b0dae654Patrik Flykt
be3a09b7ffe62b52658e77ae4d6638d1b0dae654Patrik Flyktint 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);
e53fc357a9bb9d0a5362ccc4246d598cb0febd5eLennart Poetteringint 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);
c62c4628d9dbc27effd36143c75abe528f561867Patrik Flykt