]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dhcp: move DHCP client specific definitions to dhcp-client-internal.h
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 20 Oct 2023 16:03:00 +0000 (01:03 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 20 Oct 2023 16:54:08 +0000 (01:54 +0900)
src/libsystemd-network/dhcp-client-internal.h
src/libsystemd-network/dhcp-internal.h

index 073f605518f05a335f3f443d254a739928032399..cb8e3c332585878acd7ab48739b97e63cfb32964 100644 (file)
@@ -6,6 +6,7 @@
 #include "sd-dhcp-client.h"
 
 #include "macro.h"
+#include "network-common.h"
 
 typedef enum DHCPState {
         DHCP_STATE_STOPPED,
@@ -23,6 +24,8 @@ typedef enum DHCPState {
 
 const char *dhcp_state_to_string(DHCPState s) _const_;
 
+typedef struct sd_dhcp_client sd_dhcp_client;
+
 extern const struct hash_ops dhcp_option_hash_ops;
 
 int dhcp_client_set_state_callback(
@@ -30,3 +33,20 @@ int dhcp_client_set_state_callback(
                 sd_dhcp_client_callback_t cb,
                 void *userdata);
 int dhcp_client_get_state(sd_dhcp_client *client);
+
+/* If we are invoking callbacks of a dhcp-client, ensure unreffing the
+ * client from the callback doesn't destroy the object we are working
+ * on */
+#define DHCP_CLIENT_DONT_DESTROY(client) \
+        _cleanup_(sd_dhcp_client_unrefp) _unused_ sd_dhcp_client *_dont_destroy_##client = sd_dhcp_client_ref(client)
+
+#define log_dhcp_client_errno(client, error, fmt, ...)          \
+        log_interface_prefix_full_errno(                        \
+                "DHCPv4 client: ",                              \
+                sd_dhcp_client, client,                         \
+                error, fmt, ##__VA_ARGS__)
+#define log_dhcp_client(client, fmt, ...)                       \
+        log_interface_prefix_full_errno_zerook(                 \
+                "DHCPv4 client: ",                              \
+                sd_dhcp_client, client,                         \
+                0, fmt, ##__VA_ARGS__)
index 2972a808f9e74cfc45614b170ef1fbd258610b3c..ba6090b982bc7963dad41dcea1b5163a68083cd5 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "dhcp-client-internal.h"
 #include "dhcp-protocol.h"
-#include "network-common.h"
 
 typedef struct sd_dhcp_option {
         unsigned n_ref;
@@ -26,8 +25,6 @@ typedef struct DHCPServerData {
         size_t size;
 } DHCPServerData;
 
-typedef struct sd_dhcp_client sd_dhcp_client;
-
 int dhcp_option_append(DHCPMessage *message, size_t size, size_t *offset, uint8_t overload,
                        uint8_t code, size_t optlen, const void *optval);
 int dhcp_option_find_option(uint8_t *options, size_t length, uint8_t wanted_code, size_t *ret_offset);
@@ -51,20 +48,3 @@ void dhcp_packet_append_ip_headers(DHCPPacket *packet, be32_t source_addr,
                                    uint16_t destination, uint16_t len, int ip_service_type);
 
 int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum, uint16_t port);
-
-/* If we are invoking callbacks of a dhcp-client, ensure unreffing the
- * client from the callback doesn't destroy the object we are working
- * on */
-#define DHCP_CLIENT_DONT_DESTROY(client) \
-        _cleanup_(sd_dhcp_client_unrefp) _unused_ sd_dhcp_client *_dont_destroy_##client = sd_dhcp_client_ref(client)
-
-#define log_dhcp_client_errno(client, error, fmt, ...)          \
-        log_interface_prefix_full_errno(                        \
-                "DHCPv4 client: ",                              \
-                sd_dhcp_client, client,                         \
-                error, fmt, ##__VA_ARGS__)
-#define log_dhcp_client(client, fmt, ...)                       \
-        log_interface_prefix_full_errno_zerook(                 \
-                "DHCPv4 client: ",                              \
-                sd_dhcp_client, client,                         \
-                0, fmt, ##__VA_ARGS__)