1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright (C) 2014 Intel Corporation. All rights reserved.
12 #include "time-util.h"
14 struct sd_ndisc_router
{
17 triple_timestamp timestamp
;
18 struct in6_addr address
;
20 /* The raw packet size. The data is appended to the object, accessible via NDIS_ROUTER_RAW() */
23 /* The current read index for the iterative option interface */
34 static inline void* NDISC_ROUTER_RAW(const sd_ndisc_router
*rt
) {
35 return (uint8_t*) rt
+ ALIGN(sizeof(sd_ndisc_router
));
38 static inline void *NDISC_ROUTER_OPTION_DATA(const sd_ndisc_router
*rt
) {
39 return ((uint8_t*) NDISC_ROUTER_RAW(rt
)) + rt
->rindex
;
42 static inline uint8_t NDISC_ROUTER_OPTION_TYPE(const sd_ndisc_router
*rt
) {
43 return ((uint8_t*) NDISC_ROUTER_OPTION_DATA(rt
))[0];
45 static inline size_t NDISC_ROUTER_OPTION_LENGTH(const sd_ndisc_router
*rt
) {
46 return ((uint8_t*) NDISC_ROUTER_OPTION_DATA(rt
))[1] * 8;
49 sd_ndisc_router
*ndisc_router_new(size_t raw_size
);
50 int ndisc_router_parse(sd_ndisc_router
*rt
);