summaryrefslogtreecommitdiffstats
path: root/src/core/ip-address-access.h
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2016-11-03 17:30:06 +0100
committerLennart Poettering <lennart@poettering.net>2017-09-22 15:24:54 +0200
commitb36672e072e32060d6c25acfb51e409bc617b754 (patch)
tree03ed77f636deca027db5417c6da88bd804d92817 /src/core/ip-address-access.h
parentAdd abstraction model for BPF programs (diff)
downloadsystemd-b36672e072e32060d6c25acfb51e409bc617b754.tar.xz
systemd-b36672e072e32060d6c25acfb51e409bc617b754.zip
Add IP address address ACL representation and parser
Add a config directive parser that takes multiple space separated IPv4 or IPv6 addresses with optional netmasks in CIDR notation rvalue and puts a parsed version of it to linked list of IPAddressAccessItem objects. The code actually using this will be added later.
Diffstat (limited to 'src/core/ip-address-access.h')
-rw-r--r--src/core/ip-address-access.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/core/ip-address-access.h b/src/core/ip-address-access.h
new file mode 100644
index 0000000000..eea20b4848
--- /dev/null
+++ b/src/core/ip-address-access.h
@@ -0,0 +1,36 @@
+#pragma once
+
+/***
+ This file is part of systemd.
+
+ Copyright 2016 Daniel Mack
+
+ systemd is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 2.1 of the License, or
+ (at your option) any later version.
+
+ systemd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
+***/
+
+#include "in-addr-util.h"
+#include "list.h"
+
+typedef struct IPAddressAccessItem IPAddressAccessItem;
+
+struct IPAddressAccessItem {
+ int family;
+ unsigned char prefixlen;
+ union in_addr_union address;
+ LIST_FIELDS(IPAddressAccessItem, items);
+};
+
+int config_parse_ip_address_access(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);
+
+IPAddressAccessItem* ip_address_access_free_all(IPAddressAccessItem *first);