This also renames arguments for storing results.
No functional change, just refactoring and preparation for later commits.
#include "sd-forward.h"
#include "list.h"
-struct sd_dhcp_route {
- struct in_addr dst_addr;
- struct in_addr gw_addr;
- unsigned char dst_prefixlen;
-};
-
struct sd_dhcp_raw_option {
LIST_FIELDS(struct sd_dhcp_raw_option, options);
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include "sd-dhcp-lease.h"
+
+#include "dhcp-route.h" /* IWYU pragma: keep */
+
+int sd_dhcp_route_get_destination(sd_dhcp_route *route, struct in_addr *ret) {
+ assert_return(route, -EINVAL);
+ assert_return(ret, -EINVAL);
+
+ *ret = route->dst_addr;
+ return 0;
+}
+
+int sd_dhcp_route_get_destination_prefix_length(sd_dhcp_route *route, uint8_t *ret) {
+ assert_return(route, -EINVAL);
+ assert_return(ret, -EINVAL);
+
+ *ret = route->dst_prefixlen;
+ return 0;
+}
+
+int sd_dhcp_route_get_gateway(sd_dhcp_route *route, struct in_addr *ret) {
+ assert_return(route, -EINVAL);
+ assert_return(ret, -EINVAL);
+
+ *ret = route->gw_addr;
+ return 0;
+}
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "sd-forward.h"
+
+#include "in-addr-util.h" /* IWYU pragma: keep */
+
+struct sd_dhcp_route {
+ struct in_addr dst_addr;
+ struct in_addr gw_addr;
+ uint8_t dst_prefixlen;
+};
'dhcp-option.c',
'dhcp-packet.c',
'dhcp-protocol.c',
+ 'dhcp-route.c',
'dhcp6-network.c',
'dhcp6-option.c',
'dhcp6-protocol.c',
#include <arpa/inet.h>
#include <stdio.h>
+#include "sd-dhcp-lease.h"
+
#include "alloc-util.h"
-#include "dhcp-lease-internal.h"
+#include "dhcp-route.h"
#include "dns-resolver-internal.h"
#include "extract-word.h"
#include "hexdecoct.h"
#include "alloc-util.h"
#include "dhcp-lease-internal.h"
#include "dhcp-option.h"
+#include "dhcp-route.h"
#include "dns-def.h"
#include "dns-domain.h"
#include "dns-resolver-internal.h"
*ret = lease->timezone;
return 0;
}
-
-int sd_dhcp_route_get_destination(sd_dhcp_route *route, struct in_addr *destination) {
- assert_return(route, -EINVAL);
- assert_return(destination, -EINVAL);
-
- *destination = route->dst_addr;
- return 0;
-}
-
-int sd_dhcp_route_get_destination_prefix_length(sd_dhcp_route *route, uint8_t *length) {
- assert_return(route, -EINVAL);
- assert_return(length, -EINVAL);
-
- *length = route->dst_prefixlen;
- return 0;
-}
-
-int sd_dhcp_route_get_gateway(sd_dhcp_route *route, struct in_addr *gateway) {
- assert_return(route, -EINVAL);
- assert_return(gateway, -EINVAL);
-
- *gateway = route->gw_addr;
- return 0;
-}
#include <arpa/inet.h>
#include "alloc-util.h"
-#include "dhcp-lease-internal.h"
+#include "dhcp-route.h"
#include "hashmap.h"
#include "hostname-setup.h"
#include "network-internal.h"
size_t *ret_n_br_addresses);
int sd_dhcp_lease_has_6rd(sd_dhcp_lease *lease);
-int sd_dhcp_route_get_destination(sd_dhcp_route *route, struct in_addr *destination);
-int sd_dhcp_route_get_destination_prefix_length(sd_dhcp_route *route, uint8_t *length);
-int sd_dhcp_route_get_gateway(sd_dhcp_route *route, struct in_addr *gateway);
+int sd_dhcp_route_get_destination(sd_dhcp_route *route, struct in_addr *ret);
+int sd_dhcp_route_get_destination_prefix_length(sd_dhcp_route *route, uint8_t *ret);
+int sd_dhcp_route_get_gateway(sd_dhcp_route *route, struct in_addr *ret);
_SD_DEFINE_POINTER_CLEANUP_FUNC(sd_dhcp_lease, sd_dhcp_lease_unref);