chiark / gitweb /
57d2c9c3cd635fe3e5a5d11112a6b046254b50ef
[elogind.git] / src / udev / net / link-config.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 /***
4  This file is part of systemd.
5
6  Copyright (C) 2013 Tom Gundersen <teg@jklm.no>
7
8   systemd is free software; you can redistribute it and/or modify it
9   under the terms of the GNU Lesser General Public License as published by
10   the Free Software Foundation; either version 2.1 of the License, or
11   (at your option) any later version.
12
13   systemd is distributed in the hope that it will be useful, but
14   WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16   Lesser General Public License for more details.
17
18   You should have received a copy of the GNU Lesser General Public License
19   along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #pragma once
23
24 #include "libudev.h"
25 #include "util.h"
26 #include "list.h"
27
28
29 typedef struct link_config_ctx link_config_ctx;
30 typedef struct link_config link_config;
31
32 struct link_config {
33         char *filename;
34
35         char *match_mac;
36         char *match_path;
37         char *match_driver;
38         char *match_type;
39
40         char *description;
41         unsigned int speed;
42         char *duplex;
43         char *wol;
44
45         LIST_FIELDS(link_config, links);
46 };
47
48 int link_config_ctx_new(link_config_ctx **ret);
49 void link_config_ctx_free(link_config_ctx *ctx);
50
51 int link_config_load(link_config_ctx *ctx);
52 bool link_config_should_reload(link_config_ctx *ctx);
53
54 int link_config_get(link_config_ctx *ctx, struct udev_device *device, struct link_config **ret);
55 int link_config_apply(link_config_ctx *ctx, struct link_config *config, struct udev_device *device);
56
57 /* gperf lookup function */
58 const struct ConfigPerfItem* link_config_gperf_lookup(const char *key, unsigned length);