clientop.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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <netinet/if_ether.h>
#include "rpld.h"
extern int totclnt;
extern char databuf[];
extern unsigned long delayGran;
extern unsigned long startDelay;
extern int frameSize;
extern int debugLevel;
extern int maxClients;
extern char debugmsg[];
/*
* Add the new client between the current clntp and its next in the
* circular linked list.
*/
{
totclnt++;
return;
}
}
/*
* Remove the indicated client from the circular linked list.
*/
{
if (debugLevel >= MSG_INFO_1) {
}
totclnt--;
if (totclnt == 0) {
return;
}
}
client_t *
unsigned char addr[];
{
int i;
int found = 0;
if (debugLevel >= MSG_INFO_2) {
}
if (totclnt == 0) {
if (debugLevel >= MSG_INFO_2) {
}
return(NULL);
}
if (debugLevel >= MSG_INFO_1) {
}
for (i=0; i<totclnt; i++) {
{
if (debugLevel >= MSG_INFO_1) {
}
found = 1;
break;
}
}
if (found)
return(cp);
else
return(NULL);
}
int
{
struct ether_addr *addrp;
int done = 0;
int i, j;
int bootparamslen;
int numfiles = -1;
char hostname[100];
char bootparams[1000];
if (debugLevel >= MSG_WARN_2) {
sprintf(debugmsg, "Already serving maximum number of clients (= %d), request ignored\n", maxClients);
}
return(-1);
}
/*
* Get the network address from the global data buffer and look
* it up in the ethers database.
*/
if (debugLevel >= MSG_WARN_1) {
}
return(-1);
} else {
if (debugLevel >= MSG_INFO_1) {
}
}
/* See if we are already serving this client */
if (debugLevel >= MSG_INFO_2) {
}
/* start from the beginning */
return(0);
}
/*
* Now lookup the bootparams database and retrieve the whole
* client record in ASCII.
*/
sizeof(bootparams)) != 0) {
if (debugLevel >= MSG_ERROR_1) {
}
return(-1);
}
if (debugLevel >= MSG_ALWAYS) {
}
/* The TAB char will be a problem, so replace them with '\0' */
for (i=0; i<bootparamslen; i++) {
bootparams[i] = '\0';
}
if (debugLevel >= MSG_ALWAYS) {
}
/*
* Try to allocate a client_t structure to serve this client.
*/
if (debugLevel >= MSG_WARN_1) {
}
return(-1);
}
/* Fill this structure with config info */
/* Get the number of boot files for this client */
for (i=0; i<bootparamslen-13; i++) {
if (bootparams[i] == 'n' &&
{
}
}
if (numfiles < 0) {
if (debugLevel >= MSG_ERROR_1) {
}
return(-1);
}
if (debugLevel >= MSG_INFO_2) {
}
/* Create the bootfile list and fill in the info from bootparams */
for (j=0; j<numfiles; j++) {
if (debugLevel >= MSG_WARN_1) {
}
goto cleanup;
}
} else {
}
}
for (i=0; i<bootparamslen-9; i++) {
if (bootparams[i] == 'b' &&
{
if (debugLevel >= MSG_ALWAYS) {
}
break;
if (debugLevel >= MSG_ERROR_1) {
"No access to bootfile (%s)\n",
}
goto cleanup;
}
if (debugLevel >= MSG_ALWAYS) {
}
}
}
/* Finally the transfer address */
for (i=0; i<bootparamslen-9; i++) {
if (bootparams[i] == 'b' &&
{
if (debugLevel >= MSG_ALWAYS) {
}
if (debugLevel >= MSG_ALWAYS) {
}
}
}
return(0);
/* clean up any allocated structures and return */
while (bp) {
}
return(-1);
}