rplout.c revision 50c83d09652262aba75a6182b3203c80b48b092b
/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <poll.h>
#include <unistd.h>
#include "rpld.h"
#define LLC_OVERHEAD 3
#define RPL_OVERHEAD 29
extern int totclnt;
extern long delayGran;
extern int debugLevel;
extern int outblocked;
extern unsigned char myNodeAddr[];
extern char debugmsg[];
/* This is the framework for the FOUND frame to the client */
char FOUNDFRAME[] = {
0x00, 0x3a, /* program length */
0x00, 0x02, /* command for FOUND frame */
0x00, 0x08, 0x40, 0x03, /* correlator header */
0x00, 0x00, 0x00, 0x00, /* correlator */
0x00, 0x05, 0x40, 0x0B, /* resp header */
0x00, /* resp code */
0x00, 0x0A, 0x40, 0x0C, /* dest header */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* dest address */
0x00, 0x0A, 0x40, 0x06, /* source header */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* source server address */
0x00, 0x10, 0x00, 0x08, /* info header */
0x00, 0x06, 0x40, 0x09, /* frame header */
0x03, 0x00, /* max frame */
0x00, 0x06, 0x40, 0x0A, /* class header */
0x00, 0x00, /* conn class */
0x00, 0x05, 0x40, 0x07, /* Lsap header */
(char)0xFC /* Rsap */
};
/* This is the framework for the FILEDATA response frames */
char outFILE[1600] = {
0x00, 0x19, /* program length */
0x00, 0x20, /* FILE.DATA.RESPONSE */
0x00, 0x08, 0x40, 0x11, /* sequence header */
0x00, 0x00, 0x00, 0x00, /* sequence number of 00 */
0x00, 0x0D, (char)0xC0, 0x14, /* loader header */
0x00, 0x00, 0x7C, 0x00, /* load address */
0x00, 0x00, 0x7C, 0x00, /* transfer address */
LOCATE_ENABLE, /* flags */
0x00, 0x44, 0x40, 0x18 /* data header */
};
int
{
struct dl_address *addr;
if (debugLevel >= MSG_INFO_1) {
}
(unsigned char *)NULL, 0);
else
outblocked = 1;
return (0);
}
void
{
char ch;
long loadaddr;
int ncount;
struct dl_address *addr;
char b[20];
if (debugLevel >= MSG_ALWAYS) {
"Delay = %d, not allowed to send yet\n",
}
return;
}
0xFC, (unsigned char *)NULL, 0);
if (debugLevel >= MSG_ERROR_1) {
"Terminating servicing this client\n");
}
return;
}
}
if (debugLevel >= MSG_INFO_2) {
}
if (ncount > 0) {
if (debugLevel >= MSG_ALWAYS) {
}
/* sequence number */
/* load address and flags */
/* data header */
/* program header */
if (debugLevel >= MSG_ALWAYS) {
"%02X %02X %02X %02X\n",
}
/* send it out */
outblocked = 1;
/* increment sequence number */
/* prepare for next seek */
/* reset delay counter */
} /* ncount > 0 */
/* see if we hit the end-of-file of the current file */
if (debugLevel >= MSG_ALWAYS) {
}
if (debugLevel >= MSG_INFO_2) {
"Current file reaches eof, closing\n");
}
== NULL) {
if (debugLevel >= MSG_ERROR_1) {
"Can't open bootfile %s\n",
"servicing this client\n");
}
return;
}
} else {
if (debugLevel >= MSG_INFO_2) {
"update state to ST_SEND_FINAL\n");
}
}
}
}
void
{
struct dl_address *addr;
if (debugLevel >= MSG_ALWAYS) {
"Delay = %d, not allowed to send yet\n",
}
return;
}
0xFC, (unsigned char *)NULL, 0);
if (debugLevel >= MSG_INFO_1) {
}
/* sequence number */
/* transfer address */
/* flags */
/* data header */
outFILE[25] = 0;
/* program header */
outFILE[0] = 0;
if (debugLevel >= MSG_ALWAYS) {
"%02X %02X: transfer to %02X %02X %02X %02X\n",
}
outblocked = 1;
}