mirror of
https://github.com/systemd/systemd.git
synced 2025-01-16 03:24:49 +03:00
sd-dhcp-server: add sd_dhcp_server_set_callback()
This commit is contained in:
parent
161bc1b627
commit
5b03043a75
@ -68,6 +68,9 @@ struct sd_dhcp_server {
|
||||
DHCPLease invalid_lease;
|
||||
|
||||
uint32_t max_lease_time, default_lease_time;
|
||||
|
||||
sd_dhcp_server_callback_t callback;
|
||||
void *callback_userdata;
|
||||
};
|
||||
|
||||
typedef struct DHCPRequest {
|
||||
|
@ -1202,3 +1202,12 @@ int sd_dhcp_server_add_vendor_option(sd_dhcp_server *server, sd_dhcp_option *v)
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sd_dhcp_server_set_callback(sd_dhcp_server *server, sd_dhcp_server_callback_t cb, void *userdata) {
|
||||
assert_return(server, -EINVAL);
|
||||
|
||||
server->callback = cb;
|
||||
server->callback_userdata = userdata;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -40,6 +40,10 @@ int sd_dhcp_server_attach_event(sd_dhcp_server *client, sd_event *event, int64_t
|
||||
int sd_dhcp_server_detach_event(sd_dhcp_server *client);
|
||||
sd_event *sd_dhcp_server_get_event(sd_dhcp_server *client);
|
||||
|
||||
typedef void (*sd_dhcp_server_callback_t)(sd_dhcp_server *server, uint64_t event, void *userdata);
|
||||
|
||||
int sd_dhcp_server_set_callback(sd_dhcp_server *server, sd_dhcp_server_callback_t cb, void *userdata);
|
||||
|
||||
int sd_dhcp_server_is_running(sd_dhcp_server *server);
|
||||
|
||||
int sd_dhcp_server_start(sd_dhcp_server *server);
|
||||
|
Loading…
x
Reference in New Issue
Block a user