networkd-link.h revision c601ebf79f0c54be14d3c16f0f484c0335cdeec4
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering This file is part of systemd.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering Copyright 2013 Tom Gundersen <teg@jklm.no>
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering systemd is free software; you can redistribute it and/or modify it
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering under the terms of the GNU Lesser General Public License as published by
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering (at your option) any later version.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering systemd is distributed in the hope that it will be useful, but
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering Lesser General Public License for more details.
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering You should have received a copy of the GNU Lesser General Public License
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
72c0a2c255b172ebbb2a2b7dab7c9aec4c9582d9Lennart Poetteringint link_get(Manager *m, int ifindex, Link **ret);
72c0a2c255b172ebbb2a2b7dab7c9aec4c9582d9Lennart Poetteringint link_add(Manager *manager, sd_netlink_message *message, Link **ret);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringint link_address_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringint link_route_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringint link_initialized(Link *link, struct udev_device *device);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringint link_update(Link *link, sd_netlink_message *message);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringint link_ipv6ll_gained(Link *link, const struct in6_addr *address);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringint link_set_mtu(Link *link, uint32_t mtu);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringint link_set_hostname(Link *link, const char *hostname);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringint link_set_timezone(Link *link, const char *timezone);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringbool link_dhcp4_server_enabled(Link *link);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringbool link_ipv6_accept_ra_enabled(Link *link);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringconst char* link_state_to_string(LinkState s) _const_;
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart PoetteringLinkState link_state_from_string(const char *s) _pure_;
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringconst char* link_operstate_to_string(LinkOperationalState s) _const_;
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart PoetteringLinkOperationalState link_operstate_from_string(const char *s) _pure_;
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringint link_node_enumerator(sd_bus *bus, const char *path, void *userdata, char ***nodes, sd_bus_error *error);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringint link_object_find(sd_bus *bus, const char *path, const char *interface, void *userdata, void **found, sd_bus_error *error);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poetteringint link_send_changed(Link *link, const char *property, ...) _sentinel_;
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(Link*, link_unref);
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define _cleanup_link_unref_ _cleanup_(link_unrefp)
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering/* Macros which append INTERFACE= to the message */
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define log_link_full(link, level, error, ...) \
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering _l ? log_object_internal(level, error, __FILE__, __LINE__, __func__, "INTERFACE=", _l->ifname, ##__VA_ARGS__) : \
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering log_internal(level, error, __FILE__, __LINE__, __func__, ##__VA_ARGS__); \
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define log_link_debug(link, ...) log_link_full(link, LOG_DEBUG, 0, ##__VA_ARGS__)
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define log_link_info(link, ...) log_link_full(link, LOG_INFO, 0, ##__VA_ARGS__)
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define log_link_notice(link, ...) log_link_full(link, LOG_NOTICE, 0, ##__VA_ARGS__)
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define log_link_warning(link, ...) log_link_full(link, LOG_WARNING, 0, ##__VA_ARGS__)
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define log_link_error(link, ...) log_link_full(link, LOG_ERR, 0, ##__VA_ARGS__)
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define log_link_debug_errno(link, error, ...) log_link_full(link, LOG_DEBUG, error, ##__VA_ARGS__)
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define log_link_info_errno(link, error, ...) log_link_full(link, LOG_INFO, error, ##__VA_ARGS__)
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define log_link_notice_errno(link, error, ...) log_link_full(link, LOG_NOTICE, error, ##__VA_ARGS__)
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define log_link_warning_errno(link, error, ...) log_link_full(link, LOG_WARNING, error, ##__VA_ARGS__)
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering#define log_link_error_errno(link, error, ...) log_link_full(link, LOG_ERR, error, ##__VA_ARGS__)
72c0a2c255b172ebbb2a2b7dab7c9aec4c9582d9Lennart Poettering#define LOG_LINK_MESSAGE(link, fmt, ...) "MESSAGE=%s: " fmt, (link)->ifname, ##__VA_ARGS__
72c0a2c255b172ebbb2a2b7dab7c9aec4c9582d9Lennart Poettering#define LOG_LINK_INTERFACE(link) "INTERFACE=%s", (link)->ifname
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering (be32toh((address).s_addr) >> 16) & 0xFFu, \
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering (be32toh((address).s_addr) >> 8) & 0xFFu, \