test_private.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <alloca.h>
#include <strings.h>
#include <fcntl.h>
#include <errno.h>
#include <dhcp_svc_confopt.h>
#include <dhcp_svc_private.h>
#include <dhcp_svc_public.h>
#include <libinetutil.h>
/*
* Argument: resource, and path in that resource.
*/
int
{
if (argc != 3) {
argv[0]);
return (1);
}
/* enumerate_dd() */
(void) printf("enumerate_dd: ... ");
if (error != DSVC_SUCCESS)
return (1);
for (i = 0; i < nmods; i++) {
}
}
if (!dsp_valid) {
argv[1]);
return (1);
}
(void) printf("\nstarting testing on %s, tables @ %s\n",
/*
* Using the datastore struct we built from arguments, begin poking
* at the user selected public module.
*/
/* status_dd */
(void) printf("status_dd: ... ");
/* mklocation_dd */
/* list_dd - dhcptab */
(void) printf("\nlist_dd of dhcptab containers: ... ");
if (error == DSVC_SUCCESS) {
for (i = 0; i < count; i++) {
listpp[i] : "NULL");
}
(void) printf("\n");
} else {
(void) printf("list_dd: listpp: 0x%p, count: %d\n",
}
/* open_dd - dhcptab (create) */
(void) printf("open_dd: dhcptab: ... ");
if (error != DSVC_SUCCESS)
return (1);
/* add_dd_entry - dhcptab */
{
":Router=172.20.64.2:Subnet=255.255.255.192:";
":Router=172.20.64.65:Subnet=255.255.255.192:";
":Router=172.20.64.129:Subnet=255.255.255.128:";
":Router=172.22.0.1:Subnet=255.255.0.0:MTU=4532:";
(void) printf("add_dd_entry: ... key type value\n");
(void) printf(" %s %c %s ... ",
if (error != DSVC_SUCCESS)
break;
}
}
/* lookup_dd - dhcptab - macro called '172.20.64.128', then delete it */
&count);
if (error == DSVC_SUCCESS) {
if (count != 1) {
(void) printf("lookup_dd: expected 1 record, got %d\n",
count);
}
(void) printf(" %s %c %s\n",
}
}
/* Delete it */
/*
* lookup_dd - dhcptab - macro called '172.21.0.0', and modify its
* definition and replace the value.
*/
&count);
if (error == DSVC_SUCCESS) {
if (count != 1) {
(void) printf("lookup_dd: expected 1 record, "
"got %d\n", count);
} else {
":Subnet=255.255.0.0:Router=172.21.0.1 "
"172.21.0.2:MTU=1500:");
/* Modify it */
(void) printf("modify_dd_entry: macro %s ... ",
}
}
}
/* lookup_dd - all records */
(void) printf("lookup_dd: all records ... ");
&count);
if (error == DSVC_SUCCESS) {
}
}
/* close_dd - dhcptab */
(void) printf("close_dd: dhcptab ... ");
/* list_dd - dhcp network containers */
(void) printf("list_dd: dhcptab ... ");
if (error == DSVC_SUCCESS) {
for (i = 0; i < count; i++) {
listpp[i] : "NULL");
}
(void) printf("\n");
} else {
(void) printf("list_dd: listpp: 0x%p, count: %d\n",
}
/* remove_dd - dhcptab */
(void) printf("remove_dd: dhcptab ... ");
/* open_dd - 129.148.5.0 create */
(void) printf("\nopen_dd: 129.148.5.0: ... ");
if (error != DSVC_SUCCESS)
return (1);
/* add_dd_entry - 129.148.5.0 */
{
(void) printf("add_dd_entry: ... cid flag cip sip lease "
"macro comment\n");
(void) printf(" %s %d %s %s %u %s %s ... ",
recs[i].dn_comment);
if (error != DSVC_SUCCESS)
break;
}
}
/* lookup_dd - lookup all records. */
(void) printf("lookup_dd: 129.148.5.0 ... ");
&count);
if (error == DSVC_SUCCESS) {
(void) printf(" %s %02u %s %s %u '%s' #%s\n",
}
}
/* delete_dd_entry - 129.148.5.3 */
(void) printf("delete_dd_entry: 129.148.5.3 ... ");
/*
* lookup_dd - 129.148.5.0 - record with cid of 01080020000001, modify
* flags to MANUAL+BOOTP, lease to -1, macro to foobar, and server to
* 129.148.174.27.
*/
(void) printf("lookup_dd: 01080020000001 ... ");
&count);
if (error == DSVC_SUCCESS) {
if (count != 1) {
(void) printf("lookup_dd: expected 1 record, got %d\n",
count);
} else {
/* Modify it */
(void) printf("modify_dd_entry: 01080020000001 ... ");
}
}
/* lookup_dd - lookup all fields with DN_FMANUAL set */
(void) printf("lookup_dd: F_MANUAL ... ");
&count);
if (error == DSVC_SUCCESS) {
if (count != 1) {
(void) printf("lookup_dd: expected 1 record, "
"got %d\n", count);
} else {
(void) printf(" %s %02u %s %s %u '%s' #%s\n",
}
}
/* lookup_dd - lookup all records. */
(void) printf("lookup_dd: 129.148.5.0 ...");
&count);
if (error == DSVC_SUCCESS) {
(void) printf(" %s %02u %s %s %u '%s' #%s\n",
}
}
/* close_dd - 129.148.5.0 */
(void) printf("close_dd: 129.148.5.0 ... ");
/* list_dd - dhcp network containers */
(void) printf("list_dd: ... ");
if (error == DSVC_SUCCESS) {
for (i = 0; i < count; i++) {
listpp[i] : "NULL");
}
(void) printf("\n");
} else {
(void) printf("list_dd: listpp: 0x%p, count: %d\n",
}
/* remove_dd - 129.148.5.0 */
(void) printf("remove_dd_entry: 129.148.5.0 ... ");
return (0);
}