networkd-netdev.h revision 0dd25fb9f005d8ab7ac4bc10a609d00569f8c56a
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering This file is part of systemd.
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering Copyright 2013 Tom Gundersen <teg@jklm.no>
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering systemd is free software; you can redistribute it and/or modify it
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering under the terms of the GNU Lesser General Public License as published by
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering (at your option) any later version.
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering systemd is distributed in the hope that it will be useful, but
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering Lesser General Public License for more details.
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering You should have received a copy of the GNU Lesser General Public License
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poetteringtypedef struct netdev_join_callback netdev_join_callback;
7410616cd9dbbec97cf98d75324da5cda2b2f7a2Lennart Poettering LIST_FIELDS(netdev_join_callback, callbacks);
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering LIST_HEAD(netdev_join_callback, callbacks);
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering /* fill in message to create netdev */
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering int (*fill_message_create)(NetDev *netdev, sd_rtnl_message *message);
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering /* fill in message to create netdev on top of a given link */
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering int (*fill_message_create_on_link)(NetDev *netdev, Link *link, sd_rtnl_message *message);
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering /* fill in message to enslave link by netdev */
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering int (*enslave)(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback);
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering /* create netdev, if not done via rtnl */
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering /* verify that compulsory configuration options were specified */
696fd1ef4f2f8574e349332a16987c6772641eddLennart Poettering int (*config_verify)(NetDev *netdev, const char *filename);
115cbf7e209a86cf5317fa12d44566247b4af332Evgeny Vereshchaginextern const NetDevVTable * const netdev_vtable[_NETDEV_KIND_MAX];
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering#define NETDEV_VTABLE(n) netdev_vtable[(n)->kind]
19f6d710772305610b928bc2678b9d77fe11e770Lennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(NetDev*, netdev_unref);
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering#define _cleanup_netdev_unref_ _cleanup_(netdev_unrefp)
b2c23da8cea1987a1a329f5a964d3299b7ca7890Lennart Poetteringint netdev_get(Manager *manager, const char *name, NetDev **ret);
2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2Lennart Poetteringint netdev_set_ifindex(NetDev *netdev, sd_rtnl_message *newlink);
2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2Lennart Poetteringint netdev_enslave(NetDev *netdev, Link *link, sd_rtnl_message_handler_t callback);
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poetteringint netdev_get_mac(const char *ifname, struct ether_addr **ret);
2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2Lennart Poetteringint netdev_join(NetDev *netdev, Link *link, sd_rtnl_message_handler_t cb);
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poetteringconst char *netdev_kind_to_string(NetDevKind d) _const_;
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart PoetteringNetDevKind netdev_kind_from_string(const char *d) _pure_;
2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2Lennart Poetteringint 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);
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poetteringconst struct ConfigPerfItem* network_netdev_gperf_lookup(const char *key, unsigned length);
41f9172f427bdbb8221c64029f78364b8dd4e527Lennart Poettering/* Macros which append INTERFACE= to the message */
19f6d710772305610b928bc2678b9d77fe11e770Lennart Poettering#define log_full_netdev(level, netdev, fmt, ...) log_meta_object(level, __FILE__, __LINE__, __func__, "INTERFACE=", netdev->ifname, "%-*s: " fmt, IFNAMSIZ, netdev->ifname, ##__VA_ARGS__)
79413b673b45adc98dfeaec882bbdda2343cb2f9Lennart Poettering#define log_debug_netdev(netdev, ...) log_full_netdev(LOG_DEBUG, netdev, ##__VA_ARGS__)
2cfbd749af308bdbe56edcfed7f3eea0fc2b93d2Lennart Poettering#define log_info_netdev(netdev, ...) log_full_netdev(LOG_INFO, netdev, ##__VA_ARGS__)
79413b673b45adc98dfeaec882bbdda2343cb2f9Lennart Poettering#define log_notice_netdev(netdev, ...) log_full_netdev(LOG_NOTICE, netdev, ##__VA_ARGS__)
79413b673b45adc98dfeaec882bbdda2343cb2f9Lennart Poettering#define log_warning_netdev(netdev, ...) log_full_netdev(LOG_WARNING, netdev,## __VA_ARGS__)
79413b673b45adc98dfeaec882bbdda2343cb2f9Lennart Poettering#define log_error_netdev(netdev, ...) log_full_netdev(LOG_ERR, netdev, ##__VA_ARGS__)
067d851d30386c553e3a84f59d81d003ff638b91Daniel Wallace#define log_struct_netdev(level, netdev, ...) log_struct(level, "INTERFACE=%s", netdev->ifname, __VA_ARGS__)
79413b673b45adc98dfeaec882bbdda2343cb2f9Lennart Poettering#define NETDEV(netdev) "INTERFACE=%s", netdev->ifname