42int main (
int,
char **);
44static void usage (
char *
s) {
46 "Usage: %s [-s <server ip>] [-p <port>]",
s);
50static void fail_on_error(
isc_result_t status,
const char* message) {
88 char* hostname =
"cltest2.host";
92 for (
i = 1;
i < argc;
i++) {
97 }
else if (
argv[
i][0] ==
'-') {
104 fail_on_error(status ,
"can't initialize dhcpctl");
109 fail_on_error(status ,
"connect failed");
114 fail_on_error(status ,
"new oject failed");
117 fail_on_error(status ,
"cant set host name");
128 fail_on_error(status ,
"can't set client id");
132 fail_on_error(status,
"open(create) failed");
135 fail_on_error(status,
"wait after open(create)");
145 fail_on_error(status,
"initial open failed, waiting for completion");
151 fail_on_error(status,
"can't disconnect");
155 fail_on_error(status ,
"can't reconnect");
159 fail_on_error(status ,
"can't refresh");
162 fail_on_error(status ,
"wait after refresh failed");
168 fail_on_error(status,
"can't disconnect");
177 printf (
"Retry timed connect\n");
183 fail_on_error(status ,
"can't reconnect");
187 fail_on_error(status ,
"can't disconnect");
239 for (
i = 0;
i <
object->nvalues;
i++) {
245 printf (
"\t%.*s = ", (
int)
v->name->len,
v->name->value);
252 switch (
v->value->type) {
254 printf (
"%d\n",
v->value->u.integer);
258 printf (
"\"%.*s\"\n", (
int)
v->value->u.buffer.len,
259 v->value->u.buffer.value);
264 v->value->u.buffer.value,
void bootp(struct packet *packet)
void dhcp(struct packet *packet)
int parse_allow_deny(struct option_cache **oc, struct parse *cfile, int flag)
int check_collection(struct packet *p, struct lease *l, struct collection *c)
isc_result_t wait_with_retry(dhcpctl_handle handle, struct timeval *timeout, int retries)
void print_object(char *msg, dhcpctl_handle handle)
void classify(struct packet *packet, struct class *class)
isc_result_t dhcp_set_control_state(control_object_state_t oldstate, control_object_state_t newstate)
isc_result_t find_class(struct class **c, const char *n, const char *f, int l)
void print_hex_or_string(unsigned len, const u_int8_t *data, unsigned limit, char *buf)
dhcpctl_status dhcpctl_object_refresh(dhcpctl_handle connection, dhcpctl_handle h)
dhcpctl_status dhcpctl_connect(dhcpctl_handle *connection, const char *server_name, int port, dhcpctl_handle authinfo)
dhcpctl_status dhcpctl_timed_connect(dhcpctl_handle *connection, const char *server_name, int port, dhcpctl_handle authinfo, struct timeval *t)
dhcpctl_status dhcpctl_disconnect(dhcpctl_handle *connection, int force)
dhcpctl_status dhcpctl_timed_wait_for_completion(dhcpctl_handle h, dhcpctl_status *s, struct timeval *t)
dhcpctl_status dhcpctl_initialize()
dhcpctl_status dhcpctl_set_string_value(dhcpctl_handle h, const char *value, const char *value_name)
dhcpctl_status dhcpctl_open_object(dhcpctl_handle, dhcpctl_handle, int)
dhcpctl_status dhcpctl_new_object(dhcpctl_handle *, dhcpctl_handle, const char *)
void dhcpv6(struct packet *)
#define ISC_R_NOTIMPLEMENTED