test_per_net.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
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Copyright (c) 1996-2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#include <stdio.h>
#include <unistd.h>
#include <syslog.h>
#include <dhcp_gen.h>
#include <dhcpd.h>
#include <per_network.h>
#include <dhcp_msgs.h>
int debug = 1;
int verbose = 1;
/*
* smalloc() -- safe malloc()
*
* Always returns a valid pointer (if it returns at all). The allocated
* memory is initialized to all zeros. If malloc() returns an error, a
* message is printed using the syslog() function and the program aborts
* with a status of 1.
*/
char *
{
char *retvalue;
(void) exit(1);
}
return (retvalue);
}
int
main(void)
{
char tbuf[MAX_CID_LEN];
int recs;
unsigned int len;
register int i, err = 0;
/*
* Test 0. Open the per network database, and locate a *single*
* record by cid.
*/
printf("Test 0: START ******************************************\n");
printf("didn't work.\n");
return (1);
}
/*
* Should only be one.
*/
if (recs < 0)
printf("lookup didn't work.\n");
else {
if (recs > 0) {
len = MAX_CID_LEN;
printf("server IP address is: %s\n",
len = MAX_CID_LEN;
}
}
printf("Test 0: END ******************************************\n");
/* END TEST 0 ********************************************* */
/*
* Test 1. Open the per net database, locate all records with
* cid of 0.
*/
printf("Test 1: START ******************************************\n");
printf("didn't work.\n");
return (1);
} else {
}
if (recs < 0)
printf("lookup didn't work.\n");
else {
if (recs > 0) {
len = MAX_CID_LEN;
printf("server IP address is: %s\n",
len = MAX_CID_LEN;
for (i = 0; i < recs; i++) {
printf("didn't work 2: \n");
break;
}
len = MAX_CID_LEN;
printf("IP address is: %s\n",
printf("server IP address is: %s\n",
len = MAX_CID_LEN;
}
}
}
printf("Test 1: END ******************************************\n");
printf("Test 2: START ******************************************\n");
/*
* Locate client ip 109.108.5.221.
*/
printf("didn't work.\n");
return (1);
} else {
}
if (recs < 0)
printf("lookup didn't work.\n");
else {
if (recs > 0) {
len = MAX_CID_LEN;
printf("server IP address is: %s\n",
len = MAX_CID_LEN;
}
}
printf("Test 2: END ******************************************\n");
printf("Test 3: START ******************************************\n");
if (recs > 0) {
/*
* Using the record from test 2, change the cid, flags, and
* lease, then write the record.
*/
} else
printf("it worked.\n");
}
printf("Test 3: END ******************************************\n");
return (0);
}