| netlink(3) | Library Functions Manual | netlink(3) |
НАИМЕНОВАНИЕ¶
netlink - макросы netlink
БИБЛИОТЕКА¶
Стандартная библиотека языка C (libc, -lc)
ОБЗОР¶
#include <asm/types.h> #include <linux/netlink.h>
int NLMSG_ALIGN(size_t size); int NLMSG_LENGTH(size_t size); int NLMSG_SPACE(size_t size); void *NLMSG_DATA(struct nlmsghdr *nlh); struct nlmsghdr *NLMSG_NEXT(struct nlmsghdr *nlh, int size); int NLMSG_OK(struct nlmsghdr *nlh, int size); int NLMSG_PAYLOAD(struct nlmsghdr *nlh, int size);
ОПИСАНИЕ¶
В <linux/netlink.h> описаны различные стандартные макросы для доступа или создания дейтаграмм netlink. По сути, они подобны макросам, определённым в cmsg(3) для обычных данных. Работа с буфером, передаваемом или получаемом из сокета netlink, должна выполняться только с помощью этих макросов.
- NLMSG_ALIGN()
- Round the size of a netlink message up to align it properly.
- NLMSG_LENGTH()
- Given the payload size, size, this macro returns the aligned size to store in the nlmsg_len field of the nlmsghdr.
- NLMSG_SPACE()
- Return the number of bytes that a netlink message with payload of size would occupy.
- NLMSG_DATA()
- Возвращает указатель на полезную нагрузку, относящуюся к указанной структуре nlmsghdr.
- NLMSG_NEXT()
- Get the next nlmsghdr in a multipart message. The caller must check if the current nlmsghdr didn't have the NLMSG_DONE set—this function doesn't return NULL on end. The size argument is an lvalue containing the remaining size of the message buffer. This macro decrements it by the size of the message header.
- NLMSG_OK()
- Возвращает значение «истина», если сообщение netlink не обрезано и готово к обработке.
- NLMSG_PAYLOAD()
- Return the size of the payload associated with the nlmsghdr.
ВЕРСИИ¶
В большинстве случаев лучше использовать netlink с помощью функций библиотеки libnetlink, а не через низкоуровневый интерфейс ядра.
СТАНДАРТЫ¶
Linux.
СМОТРИТЕ ТАКЖЕ¶
ПЕРЕВОД¶
Русский перевод этой страницы руководства разработал(и) Alex Nik <rage.iz.me@gmail.com>, Azamat Hackimov <azamat.hackimov@gmail.com>, Dmitry Bolkhovskikh <d20052005@yandex.ru>, Yuri Kozlov <yuray@komyakino.ru>, Иван Павлов <pavia00@gmail.com> и Kirill Rekhov <krekhov.dev@gmail.com>
Этот перевод является свободной программной документацией; он распространяется на условиях общедоступной лицензии GNU (GNU General Public License - GPL, https://www.gnu.org/licenses/gpl-3.0.html версии 3 или более поздней) в отношении авторского права, но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ.
Если вы обнаружите какие-либо ошибки в переводе этой страницы руководства, пожалуйста, сообщите об этом разработчику(ам) по его(их) адресу(ам) электронной почты или по адресу списка рассылки русских переводчиков.
| 17 мая 2025 г. | Справочные страницы Linux (невыпущенные) |