OUTPUT:
RETVAL
-
+
+bool
+delete_set(session, setname)
+ struct ipset_session *session;
+ const char *setname;
+
+ PREINIT:
+ enum ipset_cmd cmd = IPSET_CMD_DESTROY;
+
+ CODE:
+ // Assign the setname to the session data.
+ int r = ipset_session_data_set(session, IPSET_SETNAME, setname);
+ if (r < 0) {
+ printf("Could not set setname: %s\n",
+ ipset_session_report_msg(session));
+ }
+
+ r = ipset_cmd(session, cmd, 0);
+ if (r < 0) {
+ printf("Command failed: %s\n",
+ ipset_session_report_msg(session));
+
+ RETVAL = false;
+ }
+
+ RETVAL = true;
+
+ OUTPUT:
+ RETVAL
+
bool
setname_exists(session, setname)
struct ipset_session *session;
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More tests => 4;
BEGIN { use_ok('IPSet') };
#########################
# Check if the testset exists.
my $exists = &IPSet::setname_exists($session, $setname);
ok($exists, "The testset exists.");
+
+# Delete the testset.
+my $delete = &IPSet::delete_set($session, $setname);
+ok($delete, "Successfully deleted set.");