sd-dhcp: fix namespacing

Prefix all constants with SD_DHCP_CLIENT_* to avoid namespacing
conflicts.
This commit is contained in:
David Herrmann
2015-09-22 14:46:21 +02:00
parent 8e112c803c
commit 0374814250
4 changed files with 22 additions and 22 deletions
+10 -10
View File
@@ -213,7 +213,7 @@ int sd_dhcp_client_set_mac(sd_dhcp_client *client, const uint8_t *addr,
log_dhcp_client(client, "Changing MAC address on running DHCP "
"client, restarting");
need_restart = true;
client_stop(client, DHCP_EVENT_STOP);
client_stop(client, SD_DHCP_CLIENT_EVENT_STOP);
}
memcpy(&client->mac_addr, addr, addr_len);
@@ -277,7 +277,7 @@ int sd_dhcp_client_set_client_id(sd_dhcp_client *client, uint8_t type,
log_dhcp_client(client, "Changing client ID on running DHCP "
"client, restarting");
need_restart = true;
client_stop(client, DHCP_EVENT_STOP);
client_stop(client, SD_DHCP_CLIENT_EVENT_STOP);
}
client->client_id.type = type;
@@ -385,7 +385,7 @@ static void client_stop(sd_dhcp_client *client, int error) {
if (error < 0)
log_dhcp_client(client, "STOPPED: %s", strerror(-error));
else if (error == DHCP_EVENT_STOP)
else if (error == SD_DHCP_CLIENT_EVENT_STOP)
log_dhcp_client(client, "STOPPED");
else
log_dhcp_client(client, "STOPPED: Unknown event");
@@ -983,7 +983,7 @@ static int client_timeout_expire(sd_event_source *s, uint64_t usec,
log_dhcp_client(client, "EXPIRED");
client_notify(client, DHCP_EVENT_EXPIRED);
client_notify(client, SD_DHCP_CLIENT_EVENT_EXPIRED);
/* lease was lost, start over if not freed or stopped in callback */
if (client->state != DHCP_STATE_STOPPED) {
@@ -1143,14 +1143,14 @@ static int client_handle_ack(sd_dhcp_client *client, DHCPMessage *ack,
}
}
r = DHCP_EVENT_IP_ACQUIRE;
r = SD_DHCP_CLIENT_EVENT_IP_ACQUIRE;
if (client->lease) {
if (client->lease->address != lease->address ||
client->lease->subnet_mask != lease->subnet_mask ||
client->lease->router != lease->router) {
r = DHCP_EVENT_IP_CHANGE;
r = SD_DHCP_CLIENT_EVENT_IP_CHANGE;
} else
r = DHCP_EVENT_RENEW;
r = SD_DHCP_CLIENT_EVENT_RENEW;
client->lease = sd_dhcp_lease_unref(client->lease);
}
@@ -1382,8 +1382,8 @@ static int client_handle_message(sd_dhcp_client *client, DHCPMessage *message,
if (IN_SET(client->state, DHCP_STATE_REQUESTING,
DHCP_STATE_REBOOTING))
notify_event = DHCP_EVENT_IP_ACQUIRE;
else if (r != DHCP_EVENT_IP_ACQUIRE)
notify_event = SD_DHCP_CLIENT_EVENT_IP_ACQUIRE;
else if (r != SD_DHCP_CLIENT_EVENT_IP_ACQUIRE)
notify_event = r;
client->state = DHCP_STATE_BOUND;
@@ -1633,7 +1633,7 @@ int sd_dhcp_client_stop(sd_dhcp_client *client) {
assert_return(client, -EINVAL);
client_stop(client, DHCP_EVENT_STOP);
client_stop(client, SD_DHCP_CLIENT_EVENT_STOP);
client->state = DHCP_STATE_STOPPED;
return 0;
+1 -1
View File
@@ -360,7 +360,7 @@ static void test_addr_acq_acquired(sd_dhcp_client *client, int event,
struct in_addr addr;
assert_se(client);
assert_se(event == DHCP_EVENT_IP_ACQUIRE);
assert_se(event == SD_DHCP_CLIENT_EVENT_IP_ACQUIRE);
assert_se(sd_dhcp_client_get_lease(client, &lease) >= 0);
assert_se(lease);
+6 -6
View File
@@ -471,9 +471,9 @@ static void dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) {
return;
switch (event) {
case DHCP_EVENT_EXPIRED:
case DHCP_EVENT_STOP:
case DHCP_EVENT_IP_CHANGE:
case SD_DHCP_CLIENT_EVENT_EXPIRED:
case SD_DHCP_CLIENT_EVENT_STOP:
case SD_DHCP_CLIENT_EVENT_IP_CHANGE:
if (link->network->dhcp_critical) {
log_link_error(link, "DHCPv4 connection considered system critical, ignoring request to reconfigure it.");
return;
@@ -487,7 +487,7 @@ static void dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) {
}
}
if (event == DHCP_EVENT_IP_CHANGE) {
if (event == SD_DHCP_CLIENT_EVENT_IP_CHANGE) {
r = dhcp_lease_acquired(client, link);
if (r < 0) {
link_enter_failed(link);
@@ -496,14 +496,14 @@ static void dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) {
}
break;
case DHCP_EVENT_RENEW:
case SD_DHCP_CLIENT_EVENT_RENEW:
r = dhcp_lease_renew(client, link);
if (r < 0) {
link_enter_failed(link);
return;
}
break;
case DHCP_EVENT_IP_ACQUIRE:
case SD_DHCP_CLIENT_EVENT_IP_ACQUIRE:
r = dhcp_lease_acquired(client, link);
if (r < 0) {
link_enter_failed(link);
+5 -5
View File
@@ -29,11 +29,11 @@
#include "sd-dhcp-lease.h"
enum {
DHCP_EVENT_STOP = 0,
DHCP_EVENT_IP_ACQUIRE = 1,
DHCP_EVENT_IP_CHANGE = 2,
DHCP_EVENT_EXPIRED = 3,
DHCP_EVENT_RENEW = 4,
SD_DHCP_CLIENT_EVENT_STOP = 0,
SD_DHCP_CLIENT_EVENT_IP_ACQUIRE = 1,
SD_DHCP_CLIENT_EVENT_IP_CHANGE = 2,
SD_DHCP_CLIENT_EVENT_EXPIRED = 3,
SD_DHCP_CLIENT_EVENT_RENEW = 4,
};
typedef struct sd_dhcp_client sd_dhcp_client;