Lely core libraries
2.3.4
|
This file is part of the I/O library; it contains the implementation of the rtnetlink functions. More...
Go to the source code of this file.
Functions | |
int | io_rtnl_socket (__u32 pid, __u32 groups) |
Opens an rtnetlink socket. More... | |
int | io_rtnl_newlink (int fd, __u32 seq, __u32 pid, int ifi_index, unsigned int ifi_flags, struct rtattr *rta, unsigned short rtalen) |
Sends an RTM_NEWLINK request and waits until the acknowledgment is received. More... | |
int | io_rtnl_getlink (int fd, __u32 seq, __u32 pid, io_rtnl_newlink_func_t *func, void *data) |
Sends an RTM_GETLINK request and invokes the specified callback function for each received network interface. More... | |
int | io_rtnl_getattr (int fd, __u32 seq, __u32 pid, int ifi_index, unsigned int *pifi_flags, unsigned short type, void *data, unsigned short payload) |
Invokes io_rtnl_getlink() and retrieves a single attribute of the specified network interface. More... | |
int | io_rtnl_setattr (int fd, __u32 seq, __u32 pid, int ifi_index, unsigned int ifi_flags, unsigned short type, const void *data, unsigned short payload) |
Invokes io_rtnl_newlink() to set at most one attribute of the specified network interface. More... | |
This file is part of the I/O library; it contains the implementation of the rtnetlink functions.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file rtnl.c.
int io_rtnl_socket | ( | __u32 | pid, |
__u32 | groups | ||
) |
Opens an rtnetlink socket.
pid | a unique id identifying the netlink socket. This can be equal to the process id only for at most one socket. If pid is 0, the kernel assigns a unique id. |
groups | a bitmask specifying to which of the 32 multicast groups the socket should listen. Sending or receiving multicast messages requires the CAP_NET_ADMIN capability. |
errno
. int io_rtnl_newlink | ( | int | fd, |
__u32 | seq, | ||
__u32 | pid, | ||
int | ifi_index, | ||
unsigned int | ifi_flags, | ||
struct rtattr * | rta, | ||
unsigned short | rtalen | ||
) |
Sends an RTM_NEWLINK request and waits until the acknowledgment is received.
This operation requires the CAP_NET_ADMIN capability.
fd | an rtnetlink socket file descriptor. |
seq | the sequence number identifying the request (can be 0). |
pid | the (process) ID identifying the sender (can be 0). |
ifi_index | the interface index. |
ifi_flags | the active flag word of the device. |
rta | a pointer to a list of attributes (can be NULL). |
rtalen | the length of the attribute list (in bytes). |
errno
. int io_rtnl_getlink | ( | int | fd, |
__u32 | seq, | ||
__u32 | pid, | ||
io_rtnl_newlink_func_t * | func, | ||
void * | data | ||
) |
Sends an RTM_GETLINK request and invokes the specified callback function for each received network interface.
fd | an rtnetlink socket file descriptor. |
seq | the sequence number identifying the request (can be 0). |
pid | the (process) ID identifying the sender (can be 0). |
func | a pointer to the function to be invoked for each network interface. |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to func. |
errno
. int io_rtnl_getattr | ( | int | fd, |
__u32 | seq, | ||
__u32 | pid, | ||
int | ifi_index, | ||
unsigned int * | pifi_flags, | ||
unsigned short | type, | ||
void * | data, | ||
unsigned short | payload | ||
) |
Invokes io_rtnl_getlink() and retrieves a single attribute of the specified network interface.
fd | an rtnetlink socket file descriptor. |
seq | the sequence number identifying the request (can be 0). |
pid | the (process) ID identifying the sender (can be 0). |
ifi_index | the interface index. |
pifi_flags | the address at which to store the active flag word of the device (can be NULL). |
type | the type of the attribute. |
data | the address at which to store the payload of the attribute. |
payload | the size of the buffer at data (in bytes). |
errno
. Note that the result can be larger than payload, but at most payload bytes will be copied to data.int io_rtnl_setattr | ( | int | fd, |
__u32 | seq, | ||
__u32 | pid, | ||
int | ifi_index, | ||
unsigned int | ifi_flags, | ||
unsigned short | type, | ||
const void * | data, | ||
unsigned short | payload | ||
) |
Invokes io_rtnl_newlink() to set at most one attribute of the specified network interface.
This operation requires the CAP_NET_ADMIN capability.
fd | an rtnetlink socket file descriptor. |
seq | the sequence number identifying the request (can be 0). |
pid | the (process) ID identifying the sender (can be 0). |
ifi_index | the interface index. |
ifi_flags | the active flag word of the device. |
type | the type of the attribute. |
data | a pointer to the payload of the attribute (can be NULL). |
payload | the length of the payload (in bytes). |
errno
.