ISC DHCP  4.4.2b1
A reference DHCPv4 and DHCPv6 implementation
omshell.c
Go to the documentation of this file.
1 /* omshell.c
2 
3  Examine and modify omapi objects. */
4 
5 /*
6  * Copyright (c) 2004-2017 by Internet Systems Consortium, Inc. ("ISC")
7  * Copyright (c) 2001-2003 by Internet Software Consortium
8  *
9  * This Source Code Form is subject to the terms of the Mozilla Public
10  * License, v. 2.0. If a copy of the MPL was not distributed with this
11  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
14  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
16  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20  *
21  * Internet Systems Consortium, Inc.
22  * 950 Charter Street
23  * Redwood City, CA 94063
24  * <info@isc.org>
25  * https://www.isc.org/
26  *
27  */
28 
29 #include "config.h"
30 
31 #include <time.h>
32 #include <sys/time.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <stdarg.h>
36 #include <string.h>
37 //#include "result.h"
38 #include <syslog.h>
39 #include "dhcpctl.h"
40 #include "dhcpd.h"
41 #include <isc/file.h>
42 
43 /* Fixups */
44 isc_result_t find_class (struct class **c, const char *n, const char *f, int l)
45 {
46  return 0;
47 }
48 int parse_allow_deny (struct option_cache **oc, struct parse *cfile, int flag)
49 {
50  return 0;
51 }
52 void dhcp (struct packet *packet) { }
53 void bootp (struct packet *packet) { }
54 
55 #ifdef DHCPv6
56 /* XXX: should we warn or something here? */
57 void dhcpv6(struct packet *packet) { }
58 #ifdef DHCP4o6
59 isc_result_t dhcpv4o6_handler(omapi_object_t *h)
60 {
61  return ISC_R_NOTIMPLEMENTED;
62 }
63 #endif /* DHCP4o6 */
64 #endif /* DHCPv6 */
65 
66 int check_collection (struct packet *p, struct lease *l, struct collection *c)
67 {
68  return 0;
69 }
70 void classify (struct packet *packet, struct class *class) { }
71 
72 static void usage (const char *s) {
73  fprintf (stderr, "Usage: %s\n", s);
74  exit (1);
75 }
76 
77 static void check (isc_result_t status, const char *func) {
78  if (status != ISC_R_SUCCESS) {
79  fprintf (stderr, "%s: %s\n", func, isc_result_totext (status));
80  exit (1);
81  }
82 }
83 
84 int
85 main(int argc, char **argv) {
86  isc_result_t status, waitstatus;
87  dhcpctl_handle connection;
88  dhcpctl_handle authenticator;
89  dhcpctl_handle oh;
90  struct data_string secret;
91  const char *name = 0, *algorithm = "hmac-md5";
92  int i;
93  int port = 7911;
94  const char *server = "127.0.0.1";
95  struct parse *cfile;
96  enum dhcp_token token;
97  const char *val;
98  char *s;
99  char buf[1024];
100  char s1[1024];
101  int connected = 0;
102  char hex_buf[1025];
103  char *progname;
104 
105 #ifdef OLD_LOG_NAME
106  progname = "omshell";
107 #else
108  progname = argv[0];
109 #endif
110 
111  for (i = 1; i < argc; i++) {
112  usage(isc_file_basename(progname));
113  }
114 
115  /* Initially, log errors to stderr as well as to syslogd. */
116  openlog (isc_file_basename(progname),
118  status = dhcpctl_initialize ();
119  if (status != ISC_R_SUCCESS) {
120  fprintf (stderr, "dhcpctl_initialize: %s\n",
121  isc_result_totext (status));
122  exit (1);
123  }
124 
125  memset (&oh, 0, sizeof oh);
126 
127  do {
128  if (!connected) {
129  } else if (oh == NULL) {
130  printf ("obj: <null>\n");
131  } else {
134  (omapi_generic_object_t *)(r -> inner);
135 
136  printf ("obj: ");
137 
138  if (r -> rtype -> type != omapi_datatype_string) {
139  printf ("?\n");
140  } else {
141  printf ("%.*s\n",
142  (int)(r -> rtype -> u . buffer . len),
143  r -> rtype -> u . buffer . value);
144  }
145 
146  for (i = 0; i < g -> nvalues; i++) {
147  omapi_value_t *v = g -> values [i];
148 
149  if (!g -> values [i])
150  continue;
151 
152  printf ("%.*s = ", (int)v -> name -> len,
153  v -> name -> value);
154 
155  if (!v -> value) {
156  printf ("<null>\n");
157  continue;
158  }
159  switch (v -> value -> type) {
160  case omapi_datatype_int:
161  printf ("%d\n",
162  v -> value -> u . integer);
163  break;
164 
166  printf ("\"%.*s\"\n",
167  (int) v -> value -> u.buffer.len,
168  v -> value -> u.buffer.value);
169  break;
170 
171  case omapi_datatype_data:
173  v->value->u.buffer.value,
174  sizeof(hex_buf), hex_buf);
175  printf("%s\n", hex_buf);
176  break;
177 
179  printf ("<obj>\n");
180  break;
181  }
182  }
183  }
184 
185  fputs ("> ", stdout);
186  fflush (stdout);
187  if (fgets (buf, sizeof(buf), stdin) == NULL)
188  break;
189 
190  status = new_parse (&cfile, -1, buf, strlen(buf), "<STDIN>", 1);
191  check(status, "new_parse()");
192 
193  token = next_token (&val, (unsigned *)0, cfile);
194  switch (token) {
195  default:
196  parse_warn (cfile, "unknown token: %s", val);
197  skip_to_semi (cfile);
198  break;
199 
200  case END_OF_FILE:
201  case ENDOFLINE: /* EOL: */
202  break;
203 
204  case TOKEN_HELP:
205  case QUESTIONMARK: /* '?': */
206  printf ("Commands:\n");
207  printf (" port <server omapi port>\n");
208  printf (" server <server address>\n");
209  printf (" key <key name> <key value>\n");
210  printf (" connect\n");
211  printf (" new <object-type>\n");
212  printf (" set <name> = <value>\n");
213  printf (" create\n");
214  printf (" open\n");
215  printf (" update\n");
216  printf (" unset <name>\n");
217  printf (" refresh\n");
218  printf (" remove\n");
219  skip_to_semi (cfile);
220  break;
221 
222  case PORT:
223  token = next_token (&val, (unsigned *)0, cfile);
224  if (is_identifier (token)) {
225  struct servent *se;
226  se = getservbyname (val, "tcp");
227  if (se)
228  port = ntohs (se -> s_port);
229  else {
230  printf ("unknown service name: %s\n", val);
231  break;
232  }
233  } else if (token == NUMBER) {
234  port = atoi (val);
235  } else {
236  skip_to_semi (cfile);
237  printf ("usage: port <port>\n");
238  break;
239  }
240  token = next_token (&val, (unsigned *)0, cfile);
241  if (token != END_OF_FILE && token != EOL) {
242  printf ("usage: port <server>\n");
243  skip_to_semi (cfile);
244  break;
245  }
246  break;
247 
248  case TOKEN_SERVER:
249  token = next_token (&val, (unsigned *)0, cfile);
250  if (token == NUMBER) {
251  int alen = (sizeof buf) - 1;
252  int len;
253 
254  s = &buf [0];
255  len = strlen (val);
256  if (len + 1 > alen) {
257  baddq:
258  printf ("usage: server <server>\n");
259  skip_to_semi (cfile);
260  break;
261  } strcpy (buf, val);
262  s += len;
263  token = next_token (&val, (unsigned *)0, cfile);
264  if (token != DOT)
265  goto baddq;
266  *s++ = '.';
267  token = next_token (&val, (unsigned *)0, cfile);
268  if (token != NUMBER)
269  goto baddq;
270  len = strlen (val);
271  if (len + 1 > alen)
272  goto baddq;
273  strcpy (s, val);
274  s += len;
275  token = next_token (&val, (unsigned *)0, cfile);
276  if (token != DOT)
277  goto baddq;
278  *s++ = '.';
279  token = next_token (&val, (unsigned *)0, cfile);
280  if (token != NUMBER)
281  goto baddq;
282  len = strlen (val);
283  if (len + 1 > alen)
284  goto baddq;
285  strcpy (s, val);
286  s += len;
287  token = next_token (&val, (unsigned *)0, cfile);
288  if (token != DOT)
289  goto baddq;
290  *s++ = '.';
291  token = next_token (&val, (unsigned *)0, cfile);
292  if (token != NUMBER)
293  goto baddq;
294  len = strlen (val);
295  if (len + 1 > alen)
296  goto baddq;
297  strcpy (s, val);
298  val = &buf [0];
299  } else if (is_identifier (token)) {
300  /* Use val directly. */
301  } else {
302  printf ("usage: server <server>\n");
303  skip_to_semi (cfile);
304  break;
305  }
306 
307  s = dmalloc (strlen (val) + 1, MDL);
308  if (!server) {
309  printf ("no memory to store server name.\n");
310  skip_to_semi (cfile);
311  break;
312  }
313  strcpy (s, val);
314  server = s;
315 
316  token = next_token (&val, (unsigned *)0, cfile);
317  if (token != END_OF_FILE && token != EOL) {
318  printf ("usage: server <server>\n");
319  skip_to_semi (cfile);
320  break;
321  }
322  break;
323 
324  case KEY_ALGORITHM:
325  /* Algorithm is optional */
326  token = next_token (&val, (unsigned *)0, cfile);
327  if (token != NAME || !is_identifier(token)) {
328  printf ("missing or invalid algorithm name\n");
329  printf ("usage: key-algoritm <algorithm name>\n");
330  skip_to_semi (cfile);
331  break;
332  }
333 
334  s = dmalloc (strlen (val) + 1, MDL);
335  if (!s) {
336  printf ("no memory for algorithm name.\n");
337  skip_to_semi (cfile);
338  break;
339  }
340 
341  strcpy (s, val);
342  algorithm = s;
343 
344  token = next_token (&val, (unsigned *)0, cfile);
345  if (token != END_OF_FILE && token != EOL) {
346  printf ("extra information after %s\n", algorithm);
347  printf ("usage: key-algorithm <algorithm name>\n");
348  skip_to_semi (cfile);
349  break;
350  }
351 
352  break;
353 
354  case KEY:
355  token = peek_token(&val, (unsigned *)0, cfile);
356  if (token == STRING) {
357  token = next_token (&val, (unsigned *)0, cfile);
358  if (!is_identifier (token)) {
359  printf ("usage: key <name> <value>\n");
360  skip_to_semi (cfile);
361  break;
362  }
363  s = dmalloc (strlen (val) + 1, MDL);
364  if (!s) {
365  printf ("no memory for key name.\n");
366  skip_to_semi (cfile);
367  break;
368  }
369  strcpy (s, val);
370  } else {
371  s = parse_host_name(cfile);
372  if (s == NULL) {
373  printf ("usage: key <name> <value>\n");
374  skip_to_semi(cfile);
375  break;
376  }
377  }
378  name = s;
379 
380  memset (&secret, 0, sizeof secret);
381  if (!parse_base64 (&secret, cfile)) {
382  skip_to_semi (cfile);
383  break;
384  }
385 
386  token = next_token (&val, (unsigned *)0, cfile);
387  if (token != END_OF_FILE && token != EOL) {
388  printf ("usage: key <name> <value>\n");
389  skip_to_semi (cfile);
390  break;
391  }
392 
393  break;
394 
395  case CONNECT:
396  token = next_token (&val, (unsigned *)0, cfile);
397  if (token != END_OF_FILE && token != EOL) {
398  printf ("usage: connect\n");
399  skip_to_semi (cfile);
400  break;
401  }
402 
403  authenticator = dhcpctl_null_handle;
404 
405  if (name) {
406  status = dhcpctl_new_authenticator (&authenticator,
407  name, algorithm,
408  secret.data,
409  secret.len);
410 
411  if (status != ISC_R_SUCCESS) {
412  fprintf (stderr,
413  "Cannot create authenticator: %s\n",
414  isc_result_totext (status));
415  break;
416  }
417  }
418 
419  memset (&connection, 0, sizeof connection);
420  status = dhcpctl_connect (&connection,
421  server, port, authenticator);
422  if (status != ISC_R_SUCCESS) {
423  fprintf (stderr, "dhcpctl_connect: %s\n",
424  isc_result_totext (status));
425  break;
426  }
427  connected = 1;
428  break;
429 
430  case TOKEN_NEW:
431  token = next_token (&val, (unsigned *)0, cfile);
432  if ((!is_identifier (token) && token != STRING)) {
433  printf ("usage: new <object-type>\n");
434  break;
435  }
436 
437  if (oh) {
438  printf ("an object is already open.\n");
439  skip_to_semi (cfile);
440  break;
441  }
442 
443  if (!connected) {
444  printf ("not connected.\n");
445  skip_to_semi (cfile);
446  break;
447  }
448 
449  status = dhcpctl_new_object (&oh, connection, val);
450  if (status != ISC_R_SUCCESS) {
451  printf ("can't create object: %s\n",
452  isc_result_totext (status));
453  break;
454  }
455 
456  token = next_token (&val, (unsigned *)0, cfile);
457  if (token != END_OF_FILE && token != EOL) {
458  printf ("usage: new <object-type>\n");
459  skip_to_semi (cfile);
460  break;
461  }
462  break;
463 
464  case TOKEN_CLOSE:
465  token = next_token (&val, (unsigned *)0, cfile);
466  if (token != END_OF_FILE && token != EOL) {
467  printf ("usage: close\n");
468  skip_to_semi (cfile);
469  break;
470  }
471 
472  if (!connected) {
473  printf ("not connected.\n");
474  skip_to_semi (cfile);
475  break;
476  }
477 
478  if (!oh) {
479  printf ("not open.\n");
480  skip_to_semi (cfile);
481  break;
482  }
484 
485  break;
486 
487  case TOKEN_SET:
488  token = next_token (&val, (unsigned *)0, cfile);
489 
490  if ((!is_identifier (token) && token != STRING)) {
491  set_usage:
492  printf ("usage: set <name> = <value>\n");
493  skip_to_semi (cfile);
494  break;
495  }
496 
497  if (oh == NULL) {
498  printf ("no open object.\n");
499  skip_to_semi (cfile);
500  break;
501  }
502 
503  if (!connected) {
504  printf ("not connected.\n");
505  skip_to_semi (cfile);
506  break;
507  }
508 
509 #ifdef HAVE_STRLCPY
510  strlcpy (s1, val, sizeof(s1));
511 #else
512  s1[0] = 0;
513  strncat (s1, val, sizeof(s1)-strlen(s1)-1);
514 #endif
515 
516  token = next_token (&val, (unsigned *)0, cfile);
517  if (token != EQUAL)
518  goto set_usage;
519 
520  token = next_token (&val, (unsigned *)0, cfile);
521  switch (token) {
522  case STRING:
523  dhcpctl_set_string_value (oh, val, s1);
524  token = next_token (&val, (unsigned *)0, cfile);
525  break;
526 
527  case NUMBER:
528  strcpy (buf, val);
529  token = peek_token (&val, (unsigned *)0, cfile);
530  /* Colon-separated hex list? */
531  if (token == COLON)
532  goto cshl;
533  else if (token == DOT) {
534  s = buf;
535  val = buf;
536  do {
537  int intval = atoi (val);
538  if (intval > 255) {
539  parse_warn (cfile,
540  "dotted octet > 255: %s",
541  val);
542  skip_to_semi (cfile);
543  goto badnum;
544  }
545  *s++ = intval;
546  token = next_token (&val,
547  (unsigned *)0, cfile);
548  if (token != DOT)
549  break;
550  /* DOT is zero. */
551  while ((token = next_token (&val,
552  (unsigned *)0, cfile)) == DOT)
553  *s++ = 0;
554  } while (token == NUMBER);
555  dhcpctl_set_data_value (oh, buf,
556  (unsigned)(s - buf),
557  s1);
558  break;
559  }
560  dhcpctl_set_int_value (oh, atoi (buf), s1);
561  token = next_token (&val, (unsigned *)0, cfile);
562  badnum:
563  break;
564 
565  case NUMBER_OR_NAME:
566  strcpy (buf, val);
567  cshl:
568  s = buf;
569  val = buf;
570  do {
571  convert_num (cfile, (unsigned char *)s,
572  val, 16, 8);
573  ++s;
574  token = next_token (&val,
575  (unsigned *)0, cfile);
576  if (token != COLON)
577  break;
578  token = next_token (&val,
579  (unsigned *)0, cfile);
580  } while (token == NUMBER ||
581  token == NUMBER_OR_NAME);
582  dhcpctl_set_data_value (oh, buf,
583  (unsigned)(s - buf), s1);
584  break;
585 
586  default:
587  printf ("invalid value.\n");
588  skip_to_semi (cfile);
589  }
590 
591  if (token != END_OF_FILE && token != EOL)
592  goto set_usage;
593  break;
594 
595  case UNSET:
596  token = next_token (&val, (unsigned *)0, cfile);
597 
598  if ((!is_identifier (token) && token != STRING)) {
599  unset_usage:
600  printf ("usage: unset <name>\n");
601  skip_to_semi (cfile);
602  break;
603  }
604 
605  if (!oh) {
606  printf ("no open object.\n");
607  skip_to_semi (cfile);
608  break;
609  }
610 
611  if (!connected) {
612  printf ("not connected.\n");
613  skip_to_semi (cfile);
614  break;
615  }
616 
617 #if HAVE_STRLCPY
618  strlcpy (s1, val, sizeof(s1));
619 #else
620  s1[0] = 0;
621  strncat (s1, val, sizeof(s1)-strlen(s1)-1);
622 #endif
623 
624  token = next_token (&val, (unsigned *)0, cfile);
625  if (token != END_OF_FILE && token != EOL)
626  goto unset_usage;
627 
628  dhcpctl_set_null_value (oh, s1);
629  break;
630 
631 
632  case TOKEN_CREATE:
633  case TOKEN_OPEN:
634  i = token;
635  token = next_token (&val, (unsigned *)0, cfile);
636  if (token != END_OF_FILE && token != EOL) {
637  printf ("usage: %s\n", val);
638  skip_to_semi (cfile);
639  break;
640  }
641 
642  if (!connected) {
643  printf ("not connected.\n");
644  skip_to_semi (cfile);
645  break;
646  }
647 
648  if (!oh) {
649  printf ("you must make a new object first!\n");
650  skip_to_semi (cfile);
651  break;
652  }
653 
654  if (i == TOKEN_CREATE)
656  else
657  i = 0;
658 
659  status = dhcpctl_open_object (oh, connection, i);
660  if (status == ISC_R_SUCCESS)
662  (oh, &waitstatus);
663  if (status == ISC_R_SUCCESS)
664  status = waitstatus;
665  if (status != ISC_R_SUCCESS) {
666  printf ("can't open object: %s\n",
667  isc_result_totext (status));
668  break;
669  }
670 
671  break;
672 
673  case UPDATE:
674  token = next_token (&val, (unsigned *)0, cfile);
675  if (token != END_OF_FILE && token != EOL) {
676  printf ("usage: %s\n", val);
677  skip_to_semi (cfile);
678  break;
679  }
680 
681  if (!connected) {
682  printf ("not connected.\n");
683  skip_to_semi (cfile);
684  break;
685  }
686 
687  if (!oh) {
688  printf ("you haven't opened an object yet!\n");
689  skip_to_semi (cfile);
690  break;
691  }
692 
693  status = dhcpctl_object_update(connection, oh);
694  if (status == ISC_R_SUCCESS)
696  (oh, &waitstatus);
697  if (status == ISC_R_SUCCESS)
698  status = waitstatus;
699  if (status != ISC_R_SUCCESS) {
700  printf ("can't update object: %s\n",
701  isc_result_totext (status));
702  break;
703  }
704 
705  break;
706 
707  case REMOVE:
708  token = next_token (&val, (unsigned *)0, cfile);
709  if (token != END_OF_FILE && token != EOL) {
710  printf ("usage: remove\n");
711  skip_to_semi (cfile);
712  break;
713  }
714 
715  if (!connected) {
716  printf ("not connected.\n");
717  break;
718  }
719 
720  if (!oh) {
721  printf ("no object.\n");
722  break;
723  }
724 
725  status = dhcpctl_object_remove(connection, oh);
726  if (status == ISC_R_SUCCESS)
728  (oh, &waitstatus);
729  if (status == ISC_R_SUCCESS)
730  status = waitstatus;
731  if (status != ISC_R_SUCCESS) {
732  printf ("can't destroy object: %s\n",
733  isc_result_totext (status));
734  break;
735  }
737  break;
738 
739  case REFRESH:
740  token = next_token (&val, (unsigned *)0, cfile);
741  if (token != END_OF_FILE && token != EOL) {
742  printf ("usage: refresh\n");
743  skip_to_semi (cfile);
744  break;
745  }
746 
747  if (!connected) {
748  printf ("not connected.\n");
749  break;
750  }
751 
752  if (!oh) {
753  printf ("no object.\n");
754  break;
755  }
756 
757  status = dhcpctl_object_refresh(connection, oh);
758  if (status == ISC_R_SUCCESS)
760  (oh, &waitstatus);
761  if (status == ISC_R_SUCCESS)
762  status = waitstatus;
763  if (status != ISC_R_SUCCESS) {
764  printf ("can't refresh object: %s\n",
765  isc_result_totext (status));
766  break;
767  }
768 
769  break;
770  }
771  end_parse (&cfile);
772  } while (1);
773 
774  exit (0);
775 }
776 
777 /* Sigh */
779  control_object_state_t newstate)
780 {
781  if (newstate != server_shutdown)
782  return ISC_R_SUCCESS;
783  exit (0);
784 }
dhcp_token
dhcp_token
Definition: dhctoken.h:34
dhcpctl_set_string_value
dhcpctl_status dhcpctl_set_string_value(dhcpctl_handle h, const char *value, const char *value_name)
Definition: dhcpctl.c:288
lease
Definition: dhcpd.h:560
EQUAL
Definition: dhctoken.h:46
dhcpctl_object_update
dhcpctl_status dhcpctl_object_update(dhcpctl_handle connection, dhcpctl_handle h)
Definition: dhcpctl.c:435
TOKEN_NEW
Definition: dhctoken.h:301
dhcp_set_control_state
isc_result_t dhcp_set_control_state(control_object_state_t oldstate, control_object_state_t newstate)
Definition: omshell.c:778
COLON
Definition: dhctoken.h:37
TOKEN_CREATE
Definition: dhctoken.h:304
DHCPCTL_EXCL
#define DHCPCTL_EXCL
Definition: dhcpctl.h:42
EOL
#define EOL
Definition: dhcpd.h:88
KEY_ALGORITHM
Definition: dhctoken.h:379
check_collection
int check_collection(struct packet *p, struct lease *l, struct collection *c)
Definition: omshell.c:66
packet
Definition: dhcpd.h:405
NUMBER_OR_NAME
Definition: dhctoken.h:68
dhcpd.h
ENDOFLINE
Definition: dhctoken.h:56
end_parse
isc_result_t end_parse(struct parse **cfile)
Definition: conflex.c:103
TOKEN_CLOSE
Definition: dhctoken.h:303
dhcpctl.h
dhcpctl_set_null_value
dhcpctl_status dhcpctl_set_null_value(dhcpctl_handle h, const char *value_name)
Definition: dhcpctl.c:352
QUESTIONMARK
Definition: dhctoken.h:57
control_object_state_t
control_object_state_t
Definition: dhcpd.h:522
dhcpctl_initialize
dhcpctl_status dhcpctl_initialize()
Definition: dhcpctl.c:40
new_parse
isc_result_t new_parse(struct parse **cfile, int file, char *inbuf, unsigned buflen, const char *name, int eolp)
Definition: conflex.c:41
collection
Definition: dhcpd.h:1084
value
Definition: data.h:205
dhcpctl_new_object
dhcpctl_status dhcpctl_new_object(dhcpctl_handle *, dhcpctl_handle, const char *)
Definition: remote.c:106
data_string::data
const unsigned char * data
Definition: tree.h:78
dhcpctl_wait_for_completion
dhcpctl_status dhcpctl_wait_for_completion(dhcpctl_handle h, dhcpctl_status *s)
Definition: dhcpctl.c:137
option_cache
Definition: dhcpd.h:385
dhcpctl_open_object
dhcpctl_status dhcpctl_open_object(dhcpctl_handle, dhcpctl_handle, int)
Definition: remote.c:171
PORT
Definition: dhctoken.h:173
parse_host_name
char * parse_host_name(struct parse *cfile)
Definition: parse.c:196
dhcpctl_connect
dhcpctl_status dhcpctl_connect(dhcpctl_handle *connection, const char *server_name, int port, dhcpctl_handle authinfo)
Definition: dhcpctl.c:95
skip_to_semi
void skip_to_semi(struct parse *cfile)
Definition: parse.c:81
main
int main(int argc, char **argv)
Definition: omshell.c:85
REFRESH
Definition: dhctoken.h:312
is_identifier
#define is_identifier(x)
Definition: dhctoken.h:384
dhcpv6
void dhcpv6(struct packet *)
TOKEN_SET
Definition: dhctoken.h:248
data_string
Definition: tree.h:76
dhcpctl_set_int_value
dhcpctl_status dhcpctl_set_int_value(dhcpctl_handle h, int value, const char *value_name)
Definition: dhcpctl.c:405
data_string::len
unsigned len
Definition: tree.h:79
parse
Definition: dhcpd.h:288
omapi_typed_data_t::u
union omapi_typed_data_t::@3 u
parse_base64
int parse_base64(struct data_string *data, struct parse *cfile)
Definition: parse.c:1899
bootp
void bootp(struct packet *packet)
Definition: omshell.c:53
DHCPD_LOG_FACILITY
#define DHCPD_LOG_FACILITY
Definition: dhcpd.h:1622
DHCPCTL_CREATE
#define DHCPCTL_CREATE
Definition: dhcpctl.h:40
dhcpctl_set_data_value
dhcpctl_status dhcpctl_set_data_value(dhcpctl_handle h, const char *value, unsigned len, const char *value_name)
Definition: dhcpctl.c:319
NAME
Definition: dhctoken.h:69
omapi_object_dereference
isc_result_t omapi_object_dereference(omapi_object_t **, const char *, int)
Definition: alloc.c:593
TOKEN_SERVER
Definition: dhctoken.h:309
MDL
#define MDL
Definition: omapip.h:567
NUMBER
Definition: dhctoken.h:67
buffer
Definition: tree.h:60
progname
char * progname
Definition: dhclient.c:123
dhcpctl_null_handle
#define dhcpctl_null_handle
Definition: dhcpctl.h:38
DHCP_LOG_OPTIONS
#define DHCP_LOG_OPTIONS
Definition: dhcpd.h:1631
omapi_datatype_string
Definition: omapip.h:43
omapi_datatype_data
Definition: omapip.h:44
parse_allow_deny
int parse_allow_deny(struct option_cache **oc, struct parse *cfile, int flag)
Definition: omshell.c:48
print_hex_or_string
void print_hex_or_string(unsigned len, const u_int8_t *data, unsigned limit, char *buf)
Definition: print.c:419
CONNECT
Definition: dhctoken.h:310
peek_token
enum dhcp_token peek_token(const char **rval, unsigned *rlen, struct parse *cfile)
Definition: conflex.c:443
TOKEN_OPEN
Definition: dhctoken.h:305
END_OF_FILE
Definition: dhctoken.h:307
STRING
Definition: dhctoken.h:66
dhcpctl_object_remove
dhcpctl_status dhcpctl_object_remove(dhcpctl_handle connection, dhcpctl_handle h)
Definition: dhcpctl.c:537
dhcpctl_remote_object_t
Definition: dhcpctl.h:51
omapi_typed_data_t::buffer
struct omapi_typed_data_t::@3::@4 buffer
DOT
Definition: dhctoken.h:36
parse_warn
int parse_warn(struct parse *cfile, const char *fmt,...)
Definition: parse.c:5642
__omapi_object
Definition: omapip.h:127
dmalloc
void * dmalloc(size_t, const char *, int)
Definition: alloc.c:57
find_class
isc_result_t find_class(struct class **c, const char *n, const char *f, int l)
Definition: omshell.c:44
config.h
ISC_R_NOTIMPLEMENTED
#define ISC_R_NOTIMPLEMENTED
__omapi_generic_object
Definition: omapip_p.h:214
server_shutdown
Definition: dhcpd.h:525
dhcp
void dhcp(struct packet *packet)
Definition: omshell.c:52
REMOVE
Definition: dhctoken.h:311
UPDATE
Definition: dhctoken.h:233
TOKEN_HELP
Definition: dhctoken.h:306
KEY
Definition: dhctoken.h:256
dhcpctl_object_refresh
dhcpctl_status dhcpctl_object_refresh(dhcpctl_handle connection, dhcpctl_handle h)
Definition: dhcpctl.c:484
convert_num
void convert_num(struct parse *cfile, unsigned char *buf, const char *str, int base, unsigned size)
Definition: parse.c:840
UNSET
Definition: dhctoken.h:250
dhcpctl_new_authenticator
dhcpctl_status dhcpctl_new_authenticator(dhcpctl_handle *, const char *, const char *, const unsigned char *, unsigned)
Definition: remote.c:43
omapi_datatype_object
Definition: omapip.h:45
omapi_value_t
Definition: omapip.h:87
ISC_R_SUCCESS
#define ISC_R_SUCCESS
parse::token
enum dhcp_token token
Definition: dhcpd.h:320
omapi_datatype_int
Definition: omapip.h:42
next_token
enum dhcp_token next_token(const char **rval, unsigned *rlen, struct parse *cfile)
Definition: conflex.c:369
classify
void classify(struct packet *packet, struct class *class)
Definition: omshell.c:70
omapi_value_t::value
omapi_typed_data_t * value
Definition: omapip.h:90