networkd.h revision eb27aeca247a4cf8816fffc4c0dbcab55ead3864
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 Tom Gundersen <teg@jklm.no>
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/>.
***/
#pragma once
#include <linux/rtnetlink.h>
#include "sd-event.h"
#include "sd-rtnl.h"
#include "sd-bus.h"
#include "sd-dhcp-client.h"
#include "udev.h"
#include "rtnl-util.h"
#include "hashmap.h"
#include "list.h"
typedef struct netdev_enslave_callback netdev_enslave_callback;
struct netdev_enslave_callback {
};
typedef enum NetdevKind {
_NETDEV_KIND_INVALID = -1
} NetdevKind;
typedef enum NetdevState {
_NETDEV_STATE_INVALID = -1,
} NetdevState;
struct Netdev {
char *filename;
char *description;
char *name;
int vlanid;
};
struct Network {
char *filename;
struct ether_addr *match_mac;
char *match_path;
char *match_driver;
char *match_type;
char *match_name;
char *description;
bool dhcp;
bool dhcp_dns;
bool dhcp_mtu;
bool dhcp_hostname;
bool dhcp_domainname;
bool dhcp_critical;
};
struct Address {
unsigned char family;
unsigned char prefixlen;
char *label;
union {
} in_addr;
};
struct Route {
unsigned char family;
unsigned char dst_family;
unsigned char dst_prefixlen;
union {
} in_addr;
union {
} dst_addr;
};
typedef enum LinkState {
_LINK_STATE_INVALID = -1
} LinkState;
struct Link {
char *ifname;
struct ether_addr mac;
unsigned flags;
unsigned addr_messages;
unsigned route_messages;
unsigned enslaving;
};
struct Manager {
struct udev_monitor *udev_monitor;
};
extern const char* const network_dirs[];
/* Manager */
void manager_free(Manager *m);
int manager_load_config(Manager *m);
bool manager_should_reload(Manager *m);
int manager_udev_enumerate_links(Manager *m);
int manager_udev_listen(Manager *m);
int manager_rtnl_listen(Manager *m);
int manager_bus_listen(Manager *m);
int manager_update_resolv_conf(Manager *m);
/* Netdev */
int config_parse_netdev_kind(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);
/* Network */
/* gperf */
/* Route */
/* Address */
/* Link */
/* Macros which append INTERFACE= to the message */
#define log_full_link(level, link, fmt, ...) log_meta_object(level, __FILE__, __LINE__, __func__, "INTERFACE=", link->ifname, "%s: " fmt, link->ifname, ##__VA_ARGS__)
#define log_struct_link(level, link, ...) log_struct(level, "INTERFACE=%s", link->ifname, __VA_ARGS__)
/* More macros which append INTERFACE= to the message */
#define log_full_netdev(level, netdev, fmt, ...) log_meta_object(level, __FILE__, __LINE__, __func__, "INTERFACE=", netdev->name, "%s: " fmt, netdev->name, ##__VA_ARGS__)
#define log_struct_netdev(level, netdev, ...) log_struct(level, "INTERFACE=%s", netdev->name, __VA_ARGS__)
#define ADDRESS_FMT_VAL(address) \