chiark / gitweb /
shared: include root when canonicalizing conf paths
[elogind.git] / src / shared / net-util.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 <netinet/ether.h>
25 #include <netinet/in.h>
26 #include <stdbool.h>
27
28 bool net_match_config(const struct ether_addr *match_mac,
29                       const char *match_path,
30                       const char *match_driver,
31                       const char *match_type,
32                       const char *match_name,
33                       const char *dev_mac,
34                       const char *dev_path,
35                       const char *dev_driver,
36                       const char *dev_type,
37                       const char *dev_name);
38
39 unsigned net_netmask_to_prefixlen(const struct in_addr *netmask);
40
41 int config_parse_hwaddr(const char *unit, const char *filename, unsigned line,
42                         const char *section, unsigned section_line, const char *lvalue,
43                         int ltype, const char *rvalue, void *data, void *userdata);
44
45 int config_parse_ifname(const char *unit, const char *filename, unsigned line,
46                         const char *section, unsigned section_line, const char *lvalue,
47                         int ltype, const char *rvalue, void *data, void *userdata);
48
49 int config_parse_ifalias(const char *unit, const char *filename, unsigned line,
50                          const char *section, unsigned section_line, const char *lvalue,
51                          int ltype, const char *rvalue, void *data, void *userdata);
52
53 int net_parse_inaddr(const char *address, unsigned char *family, void *dst);