]> git.proxmox.com Git - systemd.git/blame - src/network/networkd-route.h
Imported Upstream version 227
[systemd.git] / src / network / networkd-route.h
CommitLineData
d9dfd233
MP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3#pragma once
4
5/***
6 This file is part of systemd.
7
8 Copyright 2013 Tom Gundersen <teg@jklm.no>
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22***/
23
24typedef struct Route Route;
25
26#include "networkd.h"
27#include "networkd-network.h"
28
29struct Route {
30 Network *network;
31 unsigned section;
32
33 int family;
34 unsigned char dst_prefixlen;
35 unsigned char src_prefixlen;
36 unsigned char scope;
37 uint32_t metrics;
38 unsigned char protocol; /* RTPROT_* */
39
40 union in_addr_union in_addr;
41 union in_addr_union dst_addr;
42 union in_addr_union src_addr;
43 union in_addr_union prefsrc_addr;
44
45 LIST_FIELDS(Route, routes);
46};
47
48int route_new_static(Network *network, unsigned section, Route **ret);
49int route_new_dynamic(Route **ret, unsigned char rtm_protocol);
50void route_free(Route *route);
51int route_configure(Route *route, Link *link, sd_netlink_message_handler_t callback);
52int route_drop(Route *route, Link *link, sd_netlink_message_handler_t callback);
53
54DEFINE_TRIVIAL_CLEANUP_FUNC(Route*, route_free);
55#define _cleanup_route_free_ _cleanup_(route_freep)
56
57int config_parse_gateway(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);
6300502b 58int config_parse_preferred_src(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);
d9dfd233
MP
59int config_parse_destination(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);
60int config_parse_route_priority(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);
61int config_parse_route_scope(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);