chiark / gitweb /
rtnl: headers in src/systemd/ may not include internal headers
[elogind.git] / src / systemd / sd-rtnl.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 /***
4   This file is part of systemd.
5
6   Copyright 2013 Tom Gundersen <teg@jklm.no>
7
8   systemd is free software; you can redistribute it and/or modify it
9   under the terms of the GNU Lesser General Public License as published by
10   the Free Software Foundation; either version 2.1 of the License, or
11   (at your option) any later version.
12
13   systemd is distributed in the hope that it will be useful, but
14   WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16   Lesser General Public License for more details.
17
18   You should have received a copy of the GNU Lesser General Public License
19   along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #pragma once
23
24 #include <inttypes.h>
25
26 typedef struct sd_rtnl sd_rtnl;
27 typedef struct sd_rtnl_message sd_rtnl_message;
28
29 /* bus */
30 int sd_rtnl_open(uint32_t groups, sd_rtnl **nl);
31
32 sd_rtnl *sd_rtnl_ref(sd_rtnl *nl);
33 sd_rtnl *sd_rtnl_unref(sd_rtnl *nl);
34
35 int sd_rtnl_send_with_reply_and_block(sd_rtnl *nl, sd_rtnl_message *message, uint64_t timeout, sd_rtnl_message **reply);
36
37 /* messages */
38 int sd_rtnl_message_link_new(uint16_t msg_type, int index, unsigned int type,
39                              unsigned int flags, sd_rtnl_message **ret);
40 int sd_rtnl_message_addr_new(uint16_t msg_type, int index, unsigned char family,
41                              unsigned char prefixlen, unsigned char flags,
42                              unsigned char scope, sd_rtnl_message **ret);
43 int sd_rtnl_message_route_new(uint16_t nlmsg_type, unsigned char rtm_family,
44                               unsigned char rtm_dst_len, unsigned char rtm_src_len,
45                               unsigned char rtm_tos, unsigned char rtm_table,
46                               unsigned char rtm_scope, unsigned char rtm_protocol,
47                               unsigned char rtm_type, unsigned flags, sd_rtnl_message **ret);
48 sd_rtnl_message *sd_rtnl_message_ref(sd_rtnl_message *m);
49 sd_rtnl_message *sd_rtnl_message_unref(sd_rtnl_message *m);
50
51 int sd_rtnl_message_get_type(sd_rtnl_message *m, uint16_t *type);
52 int sd_rtnl_message_append(sd_rtnl_message *m, unsigned short type, const void *data);
53 int sd_rtnl_message_read(sd_rtnl_message *m, unsigned short *type, void **data);