]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Demonstrate removal of an object.
authorTed Lemon <source@isc.org>
Wed, 26 Jan 2000 17:24:30 +0000 (17:24 +0000)
committerTed Lemon <source@isc.org>
Wed, 26 Jan 2000 17:24:30 +0000 (17:24 +0000)
dhcpctl/test.c

index 42a347995337fcfd677149038b60ac89b007ef48..3f41cf0655b3fb967018de0b271fa2d48ad79af2 100644 (file)
@@ -114,7 +114,7 @@ option domain-name-servers 10.0.0.1, 10.0.0.2;",
                exit (1);
        }
 
-#if 1
+/*#if 0 */
        memset (&cid, 0, sizeof cid);
        status = omapi_data_string_new (&cid, 6, MDL);
        if (status != ISC_R_SUCCESS) {
@@ -127,17 +127,19 @@ option domain-name-servers 10.0.0.1, 10.0.0.2;",
        cid -> value [2] = 0x5a; cid -> value [3] = 0xf8;
        cid -> value [4] = 0x00; cid -> value [5] = 0xbb;
 
+      doitagain:
        status = dhcpctl_set_value (host_handle,
                                    cid, "dhcp-client-identifier");
-#else
-       status = dhcpctl_set_string_value (host_handle, "grosse",
-                                          "dhcp-client-identifier");
+/*#else 
+  doitagain: */
+       status = dhcpctl_set_string_value (host_handle, "gnorf",
+                                          "name");
        if (status != ISC_R_SUCCESS) {
                fprintf (stderr, "dhcpctl_set_value: %s\n",
                         isc_result_totext (status));
                exit (1);
        }
-#endif
+/*#endif*/
 
        status = dhcpctl_set_value (host_handle, groupname, "group");
        if (status != ISC_R_SUCCESS) {
@@ -218,6 +220,38 @@ option smtp-server 10.0.0.1;",
                                 isc_result_totext (waitstatus));
                        exit (1);
                }
+
+               status = dhcpctl_object_remove (connection, host_handle);
+               if (status != ISC_R_SUCCESS) {
+                       fprintf (stderr, "dhcpctl_object_remove: %s\n",
+                                isc_result_totext (status));
+                       exit (1);
+               }
+               status = dhcpctl_wait_for_completion (host_handle,
+                                                     &waitstatus);
+               if (status != ISC_R_SUCCESS) {
+                       fprintf (stderr,
+                                "remove: dhcpctl_wait_for_completion: %s\n",
+                                isc_result_totext (status));
+                       exit (1);
+               }
+               if (waitstatus != ISC_R_SUCCESS) {
+                       fprintf (stderr,
+                                "remove: dhcpctl_wait_for_completion: %s\n",
+                                isc_result_totext (waitstatus));
+                       exit (1);
+               }
+
+               omapi_object_dereference (&host_handle, MDL);
+
+               status = dhcpctl_new_object (&host_handle, connection, "host");
+               if (status != ISC_R_SUCCESS) {
+                       fprintf (stderr, "dhcpctl_new_object: %s\n",
+                                isc_result_totext (status));
+                       exit (1);
+               }
+
+               goto doitagain;
        }
 
        memset (&result, 0, sizeof result);