My Dandilion (aka Star) stops with the dreaded 0937 'I abjure the
world - I can't find a time server' boot code.
If it was a 6085 I'd just boot the VP installer and convert it to
standalone, but I can't do that - don't have VP on 8" floppy.
I'm not aware of any trivial way around this, but the thought has
occured to me: is there an XNS timeserver package available for *nix
or Windoze? If so, I could just hook the thing up to my network and it
would fly....
Thanks
'As I walk along these shores
I am the history within'
"Michael Ross" <mi...@corestore.org> schrieb im Newsbeitrag
news:3a54f917ec9bb19f...@news.teranews.com...
I just converted last week my 8010 to a standalone system running VP
1.2 .
Do a fresh install of Viewpoint and you should be able to get your
machine away
from the stcode 937. You could even start your 8010 with a VP install
floppy (I did that several times before reinstall. Not sure about the
behavoir of Interlisp. I'll try to get that on my 8010 in the next
time.
Cheers,
Marc
mcwood aaattt t-online.de
"Heinz Fermum" <h...@gmx.net> wrote in message news:<bvl288$ua4$1...@online.de>...
>Hi Mike,
>
>I just converted last week my 8010 to a standalone system running VP
>1.2 .
>Do a fresh install of Viewpoint and you should be able to get your
>machine away
>from the stcode 937. You could even start your 8010 with a VP install
>floppy (I did that several times before reinstall. Not sure about the
>behavoir of Interlisp. I'll try to get that on my 8010 in the next
>time.
Marc,
Thanks for the tip re. Al - but I already know Al's site, and have got
some useful doc from there.
I've hacked Xerox stuff before, and I've fixed the '0937 problem' on
6085 workstations by the method you suggest, i.e. reinstalling VP in
'standalone' mode. (My Star also halts with the flashing '0322' ('no
network') code earlier in the boot sequence, but you can get past that
by pressing the 'boot' switch.)
I can't do this for the Star, since I only have VP 2.0 & 3.2 on 5 1/4
floppy, I have no Xerox s/w on 8" floppy.
Therefor I have to have a working timeserver on the LAN. Since my
Xerox servers are in the UK, I can't start up an 8010 or 8090.
So I'm looking for another solution. Such as a Windows or Unix
implementation of an XNS time server. If I can bring that up on my
LAN, my Star will find it and boot.
There's a thought... I do have 6085s working, all standalone... can a
6085 have XNS time server software installed, and act as a timeserver
for a small network? I'm sure I've heard of 'peer-to-peer' networks of
6085s, with no central 8010 or 8090...???
Cheers
Interlisp-D can be run w/o a network. It will ask for a date and time. It's been a while
though, so I've never tried it with Y2K dates.
Cornell did an XNS stack for BSD in the mid-80's. It was part of the BSD distribution at
one point. I'll see about digging out what I have, since the problem of getting time service
comes up quite a bit.
Did you get a floppy set up to write the images Marc?
I can't find my program to create shell archives, so you'll have to
pull the four files apart by hand.
--------------------- Makefile
#
# nsTimed Makefile 9/12/85
#
nsTimed: nsTimed.c /usr/src/lib/libc/gen/ctime.c pex.h
cc -O -o nsTimed nsTimed.c
install: nsTimed
install -s nsTimed /etc
--------------------- pex.h
/* pex.h 1.1 85/01/26 */
/*
* Packet Exchange protocol header.
* See XSIS 028112, December 1981
*/
struct pex {
u_long ph_id; /* `unique' transaction identifier */
u_short ph_client; /* client type field */
};
--------------------- nsTimed.c
/*
* Xerox Time Protocol Server
*
* Bill Nesheim
* Cornell University
* Dept. of Computer Science
* Sept. 1985
*
* $Header: /usr/src/etc/nsTimed/RCS/nsTimed.c,v 1.2 85/09/16 10:33:56
bill Exp $
*/
/* get timezone stuff */
#include "/usr/src/lib/libc/gen/ctime.c"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netns/ns.h>
#include <netns/idp.h>
#include <signal.h>
#include <syslog.h>
#include <stdio.h>
#include <errno.h>
#include "pex.h"
#define TimeVersion 2
#define TimeServerSocket 8
#define TimePEXClientType 1
#define TimeInternalVersion 0
#define BUFLEN 1024
#define NOIFTRACE
/*
* Until we have interface tracing, we need this nonsense
* because STAR asks for time before it knows its net number!
*/
#ifdef NOIFTRACE
long mynets[] = {2273, 2269, 0};
#endif
/* From XDE/3.0/ComSoft/Friends/TimeServerFormat.mesa!1 */
/*
TSPacket: TYPE = MACHINE DEPENDENT RECORD [
version(0): WORD,
tsBody(1): SELECT type(1): PacketType FROM
timeRequest => NULL,
timeResponse => [
time(2): WireLong,
zoneS(4): System.WestEast,
zoneH(5): [0..177B],
zoneM(6): [0..377B],
beginDST(7): WORD,
endDST(8): WORD,
errorAccurate(9): BOOLEAN,
absoluteError(10): WireLong],
statisticRequest => NULL,
statisticResponse => [
numberRequests(2): WireLong,
active(4): BOOLEAN,
resetting(5): BOOLEAN,
timeSet(6): WireLong,
lastChange(8): WireLong,
source(10): System.NetworkAddress],
startRequest, startResponse => NULL,
stopRequest, stopResponse => NULL,
resetRequest => [timeSource(2): System.NetworkAddress],
resetResponse => NULL,
internalTimeRequest => NULL,
internalTimeResponse => [
time(2): WireLong,
absoluteError(4): WireLong,
timeVersion(6): WireLong],
noteNewVersion => [timeVersion(2): WireLong],
ENDCASE];
*/
enum PacketType { timeRequest = 1, timeResponse = 2, statisticRequest = 3,
statisticResponse = 4, startRequest = 5, startResponse = 6,
stopRequest = 7, stopResponse = 8, resetRequest = 9,
resetResponse = 10, internalTimeRequest = 11, internalTimeResponse = 12,
noteNewVersion = 13 };
enum BOOLEAN { TRUE = 1, FALSE = 0 };
struct TSpacket {
u_short version;
u_short type;
union tsBody {
int timeRequest;
struct TimeResponse {
u_long time;
u_short zoneS;
u_short zoneH;
u_short zoneM;
u_short beginDST;
u_short endDST;
u_short errorAccurate;
u_long absoluteError;
} timeResponse;
int statisticRequest;
struct StatisticResponse {
u_long numberRequests;
u_short active;
u_short resetting;
u_long timeSet;
u_long lastChange;
struct ns_addr source;
} statisticResponse;
int startRequest, startResponse;
int stopRequest, stopResponse;
struct ResetRequest {
struct ns_addr timesource;
} resetRequest;
int resetResponse;
int internalTimeRequest;
struct InternalTimeResponse {
u_long time;
u_long absoluteError;
u_long timeVersion;
} internalTimeResponse;
struct NoteNewVersion {
u_long timeVersion;
} noteNewVersion;
} p;
};
/*
* Conversion of the Xerox representation of time to the Unix
* representation of time.
*
* The following was extracted from /xde/3.0/pilot/public/System.mesa
*
*
* GreenwichMeanTime: TYPE = RECORD [LONG CARDINAL];
*
* A greenwich mean time t represents the time which is t-gmtEpoch seconds
* after midnight, 1 January 1968, the time chosen as the epoch or
* beginning of the Pilot time standard. Within the range in which they
* overlap, the Alto and Pilot time standards assign identical bit
* patterns, but the Pilot standard runs an additional 67 years before
* overflowing. Greenwich mean times should be compared directly only for
* equality; to find which of two gmt's comes first, apply
* SecondsSinceEpoch to each and compare the result. If t2 is a gmt known
* to occur after t1, then t2-t1 is the seconds between t1 and t2. If t
* is a gmt, then System.GreenwichMeanTime[t+60] is the gmt one minute
* after t.
*
* gmtEpoch: GreenwichMeanTime = [2114294400]; = (67 years * 365 days + 16
* leap days) * 24 hours * 60 minutes * 60 seconds
*
* Unix uses midnight Jan 1, 1970 as its base, so we subtract 2 years
* plus one day.
*/
long
XeroxGMT_to_unixGMT(t)
long t;
{
return ( t - 2114294400 - 63158400 );
}
long
unixGMT_to_XeroxGMT(t)
long t;
{
return ( t + 63158400 + 2114294400 );
}
char *ns_ntoa();
int s;
int rnum = 1; /* PEX transaction ID */
/* Debugging */
int Debug = 0;
/* Statistics */
numberRequests = 0;
#ifdef DEBUG
sendrequest()
{
char buf[576];
struct pex *pex;
struct TSpacket *ts;
struct sockaddr_ns sns;
int i;
pex = (struct pex *)buf;
ts = (struct TSpacket *) &buf[6];
sns.sns_family = AF_NS;
sns.sns_port = htons(TimeServerSocket);
*(u_long *)&(sns.sns_addr) = htonl(2273);
for(i = 0; i < 6; i++)
sns.sns_addr.x_host.c_host[i] = 0xff;
pex->ph_id = htonl(rnum++);
pex->ph_client = htons(TimePEXClientType);
ts->version = htons(TimeVersion);
ts->type = htons((short) timeRequest);
if ( sendto(s, buf, 6+4, MSG_DONTROUTE, &sns, sizeof (sns)) < 0) {
syslog(LOG_ERR,"sendto: %m");
}
pex->ph_id = htonl(rnum++);
pex->ph_client = htons(TimePEXClientType);
ts->version = htons(TimeVersion);
ts->type = htons((short) internalTimeRequest);
if ( sendto(s, buf, 6+4, MSG_DONTROUTE, &sns, sizeof (sns)) < 0) {
syslog(LOG_ERR,"sendto: %m");
}
pex->ph_id = htonl(rnum++);
pex->ph_client = htons(TimePEXClientType);
ts->version = htons(TimeVersion);
ts->type = htons((short) statisticRequest);
if ( sendto(s, buf, 6+4, MSG_DONTROUTE, &sns, sizeof (sns)) < 0) {
syslog(LOG_ERR,"sendto: %m");
}
pex->ph_id = htonl(rnum++);
pex->ph_client = htons(TimePEXClientType);
ts->version = htons(TimeVersion);
ts->type = htons((short) resetRequest);
*(u_long *)&(ts->p.resetRequest.timesource) = htonl(2273);
ts->p.resetRequest.timesource.x_host.c_host[0] = (0xaa);
ts->p.resetRequest.timesource.x_host.c_host[1] = (0x00);
ts->p.resetRequest.timesource.x_host.c_host[2] = (0x03);
ts->p.resetRequest.timesource.x_host.c_host[3] = (0x01);
ts->p.resetRequest.timesource.x_host.c_host[4] = (0x11);
ts->p.resetRequest.timesource.x_host.c_host[5] = (0x16);
ts->p.resetRequest.timesource.x_port = htons(TimeServerSocket);
if ( sendto(s, buf, 6+16, MSG_DONTROUTE, &sns, sizeof (sns)) < 0) {
syslog(LOG_ERR,"sendto: %m");
}
}
#endif
sendInternalResponse(who, pex_id, flags)
struct sockaddr_ns *who;
u_long pex_id;
int flags;
{
char buf[576];
struct pex *pex;
struct TSpacket *ts;
struct timeval tv;
struct timezone tz;
numberRequests++;
if (Debug) printf("InternalResponse to %s\n", ns_ntoa(who->sns_addr));
pex = (struct pex *)buf;
ts = (struct TSpacket *) &buf[6];
pex->ph_id = pex_id;
pex->ph_client = htons(TimePEXClientType);
ts->version = htons(TimeVersion);
ts->type = htons((short) internalTimeResponse);
if (gettimeofday(&tv, &tz) < 0) {
syslog(LOG_ERR,"gettimeofday: %m");
return;
}
if (tv.tv_usec > 500000) tv.tv_sec++;
ts->p.internalTimeResponse.time = htonl(unixGMT_to_XeroxGMT(tv.tv_sec));
ts->p.internalTimeResponse.absoluteError = tv.tv_usec > 500000 ?
htonl(1000 - tv.tv_usec/1000) : htonl(tv.tv_usec/1000) ;
ts->p.internalTimeResponse.timeVersion = htonl(TimeInternalVersion);
if (sendto(s, buf, 6 + 16, flags, who, sizeof(*who)) < 0) {
syslog(LOG_ERR,"sendto: %m");
}
}
/*
* Send a TimeResponse to "who"
*/
sendResponse(who, pex_id, flags)
struct sockaddr_ns *who;
u_long pex_id;
int flags;
{
char buf[576];
register struct pex *pex;
register struct TSpacket *ts;
struct timezone tz;
struct timeval tv;
register dalybeg, daylend;
register struct dayrules *dr;
register struct dstab *ds;
register struct tm *ct;
time_t copyt;
int year;
if (Debug) printf("Response to %s\n", ns_ntoa(who->sns_addr));
pex = (struct pex *)buf;
ts = (struct TSpacket *) &buf[6];
pex->ph_id = pex_id;
pex->ph_client = htons(TimePEXClientType);
ts->version = htons(TimeVersion);
ts->type = htons((short) timeResponse);
if (gettimeofday(&tv, &tz) < 0) {
syslog(LOG_ERR,"gettimeofday: %m");
exit(1);
}
/*
* From ctime.c
*/
copyt = (time_t)tv.tv_sec - (time_t)tz.tz_minuteswest*60;
ct = gmtime(©t);
for (dr = dayrules; dr->dst_type >= 0; dr++)
if (dr->dst_type == tz.tz_dsttime)
break;
if (dr->dst_type >= 0) {
year = ct->tm_year + 1900;
for (ds = dr->dst_rules; ds->dayyr; ds++)
if (ds->dayyr == year)
break;
dalybeg = ds->daylb; /* Start of dst */
daylend = ds->dayle; /* End of dst */
/* dlions figure out sundays */
} else {
dalybeg = daylend = 0;
}
if (tv.tv_usec > 500000) tv.tv_sec++;
ts->p.timeResponse.time = htonl(unixGMT_to_XeroxGMT(tv.tv_sec));
/* East or West of Greenwitch? */
ts->p.timeResponse.zoneS = (tz.tz_minuteswest > 0) ? 0 : htons(1) ;
/* Hours in this direction? */
ts->p.timeResponse.zoneH = (tz.tz_minuteswest > 720) ?
htons(24 - tz.tz_minuteswest/60) : htons(tz.tz_minuteswest/60);
/* Minutes additionally in this direction */
ts->p.timeResponse.zoneM = (tz.tz_minuteswest > 720) ?
htons(60 - tz.tz_minuteswest%60) :
htons(tz.tz_minuteswest%60);
ts->p.timeResponse.beginDST = htons(dalybeg);
ts->p.timeResponse.endDST = htons(daylend);
/*
* take a shot at the error parameter
*/
ts->p.timeResponse.errorAccurate = htons((short)TRUE);
ts->p.timeResponse.absoluteError = tv.tv_usec > 500000 ?
htonl(1000 - tv.tv_usec/1000) : htonl(tv.tv_usec/1000) ;
if (sendto(s, buf, 6 + 24, flags, who, sizeof(*who)) < 0) {
syslog(LOG_ERR,"sendto: %m");
}
}
main(ac, av)
int ac;
char **av;
{
struct sockaddr_ns me, you;
struct idp idph, *idp;
struct pex *pex;
char buf[BUFLEN];
int yoursize;
struct TSpacket *tp;
int n;
int bytesRecieved;
int on;
char *ctime();
long Time;
if ( ac > 2) {
printf("usage: %s [-d]\n", av[0]);
exit(1);
}
if ( ac > 1) Debug++;
if (!Debug) {
int t;
if (fork())
exit(0);
for (t = 0; t < 20; t++)
(void) close(t);
(void) open("/", 0);
(void) dup2(0, 1);
(void) dup2(0, 2);
t = open("/dev/tty", 2);
if (t >= 0) {
ioctl(t, TIOCNOTTY, (char *)0);
(void) close(t);
}
}
openlog("nsTimed", LOG_PID|LOG_ODELAY, 0);
if ((s = socket(AF_NS, SOCK_DGRAM, 0)) < 0) {
syslog(LOG_ERR,"socket: %m");
exit(1);
}
me.sns_family = AF_NS;
/*me.sns_port = htons(getpid()+1000);*/
me.sns_port = htons(TimeServerSocket);
if (bind(s, &me, sizeof (me)) < 0 ) {
syslog(LOG_ERR,"bind: %m");
exit(1);
}
on = 1;
if (setsockopt(s, 0, SO_HEADERS_ON_INPUT, &on, sizeof(on))) {
syslog(LOG_ERR,"setsockopt SEE HEADERS: %m");
exit(1);
}
idph.idp_pt = NSPROTO_PE;
if (setsockopt(s, 0, SO_DEFAULT_HEADERS, &idph, sizeof(struct idp))) {
syslog(LOG_ERR,"setsockopt SET HEADER: %m");
exit(1);
}
if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &on, sizeof (on)) < 0) {
syslog(LOG_ERR,"setsockopt SO_BROADCAST: %m");
exit(1);
}
#ifdef DEBUG
signal(SIGQUIT,sendrequest);
#endif
for (;;) { /* spy on pex client type n */
fflush(stdout);
putchar('\n');
putchar('\n');
yoursize = sizeof (you);
if ((n = recvfrom(s, buf, BUFLEN, 0, &you, &yoursize)) < 0) {
extern int errno;
if (errno != EINTR)
syslog(LOG_ERR,"rcvfrom: %m");
continue;
}
if (Debug) printf("From %s... ",
ns_ntoa(you.sns_addr));
idp = (struct idp *) buf;
pex = (struct pex *) &buf[sizeof (struct idp)];
/*if (Debug) printf("idp dest was %s, total len %d\n",
ns_ntoa(idp->idp_dna), ntohs(idp->idp_len));*/
if ( idp->idp_pt != NSPROTO_PE ) {
if (Debug) printf("idp_pt = %d ?\n", idp->idp_pt);
continue;
}
/*if (Debug) printf("pex id = %d, client = %d\n",
ntohl(pex->ph_id),
ntohs(pex->ph_client));*/
if ( ntohs(pex->ph_client) != TimePEXClientType)
continue;
/* got a Time Protocol packet, figure out what it is */
/* figure out size of packet */
bytesRecieved = n - sizeof (struct idp) - sizeof (struct pex);
tp = (struct TSpacket *) &buf[36]; /* DAMN C COMPILER! @!@#!@$#@$$#@ */
/*if (Debug) printf("Time Protocol, version %d\n", ntohs(tp->version) );*/
switch ((enum PacketType) ntohs(tp->type)) {
case timeRequest:
if (Debug) printf("Time Request.\n");
#ifdef NOIFTRACE
if (*(u_long *)&(you.sns_addr) == 0) {
long *net;
for (net = &mynets[0]; *net; net++) {
*(u_long *)&you.sns_addr = htonl(*net);
sendResponse(&you, pex->ph_id, MSG_DONTROUTE);
}
break;
}
#endif
sendResponse(&you, pex->ph_id, 0);
break;
case timeResponse:
Time = XeroxGMT_to_unixGMT(ntohl(tp->p.timeResponse.time));
if (Debug) printf("Time Response:\n");
if (Debug) printf("\ttime = %s\tzoneS = %d, zoneH = %d, zoneM =
%d, beginDST = %d, endDST = %d\n",
ctime(&Time),
ntohs(tp->p.timeResponse.zoneS),
ntohs(tp->p.timeResponse.zoneH), ntohs(tp->p.timeResponse.zoneM),
ntohs(tp->p.timeResponse.beginDST),
ntohs(tp->p.timeResponse.endDST));
if (Debug) printf("\terrorAccurate = %d, absoluteError = %d\n",
ntohs(tp->p.timeResponse.errorAccurate),ntohl(tp->p.timeResponse.absoluteError));
break;
case statisticRequest:
if (Debug) printf("StatisticRequest.\n");
/*sendStatistics(&you, px->... */
break;
case statisticResponse:
if (Debug) printf("StatisticResponse:\n");
if (Debug) printf("\tnumberRequests = %d, active = %d, resetting
= %d\n",
ntohl(tp->p.statisticResponse.numberRequests),
ntohs(tp->p.statisticResponse.active),
ntohs(tp->p.statisticResponse.resetting));
Time = XeroxGMT_to_unixGMT(ntohl(tp->p.statisticResponse.timeSet));
if (Debug) printf("\ttimeSet = %s", ctime(&Time));
Time = XeroxGMT_to_unixGMT(ntohl(tp->p.statisticResponse.lastChange));
if (Debug) printf("\tlastChange = %s\tsource = %s\n",
ctime(&Time),
ns_ntoa(tp->p.statisticResponse.source));
break;
case startRequest:
if (Debug) printf("startRequest\n");
break;
case startResponse:
if (Debug) printf("startResponse\n");
break;
case stopRequest:
if (Debug) printf("stopRequest\n");
break;
case stopResponse:
if (Debug) printf("stopResponse\n");
break;
case resetRequest:
if (Debug) printf("ResetRequest\n");
if (Debug) printf("\ttimesource = %s\n",
ns_ntoa(tp->p.resetRequest.timesource));
break;
case resetResponse:
if (Debug) printf("ResetResponse\n");
break;
case internalTimeRequest:
if (Debug) printf("internalTimeRequest\n");
#ifdef NOIFTRACE
if (*(u_long *)&you.sns_addr == 0) {
long *net;
for (net = &mynets[0]; *net; net++) {
*(u_long *)&you.sns_addr = htonl(*net);
sendInternalResponse(&you, pex->ph_id, MSG_DONTROUTE);
}
break;
}
#endif
sendInternalResponse(&you, pex->ph_id, 0);
break;
case internalTimeResponse:
Time = XeroxGMT_to_unixGMT(ntohl(tp->p.internalTimeResponse.time));
if (Debug) printf("internalTimeResponse\n");
if (Debug) printf("\ttime = %s\tabsoluteError = %d, timeVersion =
%d\n",
ctime(&Time),
ntohl(tp->p.internalTimeResponse.absoluteError),
ntohl(tp->p.internalTimeResponse.timeVersion));
break;
case noteNewVersion:
if (Debug) printf("noteNewVersion\n");
if (Debug) printf("\ttimeVersion = %d\n",
ntohl(tp->p.noteNewVersion.timeVersion));
break;
default:
if (Debug) printf("unknown type %d\n",
ntohs(tp->type));
break;
}
} /* listen for more */
}
/*
* Convert network-format ns address
* to ascii
*/
char *
ns_ntoa(addr)
struct ns_addr addr;
{
static char b[50];
char temp[10];
int i;
/* net */
sprintf(b, "%D.", ntohl(*(u_long *)&(addr)));
/* skip leading zeros */
for(i=0; (addr.x_host.c_host[i] == (char) 0); i++) ;
/* print the rest */
for(; i < 6; i++) {
sprintf(temp,"%x", addr.x_host.c_host[i]);
strcat(b, temp);
if(i != 5) strcat(b, ":");
}
sprintf(temp,".%d", ntohs(addr.x_port));
strcat(b, temp);
return (b);
}
--------------------- timequery.c
/*
* Xerox Time Protocol Server
*
* Bill Nesheim
* Cornell University
* Dept. of Computer Science
* Sept. 1985
*
* $Header: /usr/src/etc/nsTimed/RCS/timequery.c,v 1.1 85/09/16 10:38:20
bill Exp $
*/
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netns/ns.h>
#include <netns/idp.h>
#include <signal.h>
#include <syslog.h>
#include <stdio.h>
#include <errno.h>
#include "pex.h"
#define TimeVersion 2
#define TimeServerSocket 8
#define TimePEXClientType 1
#define TimeInternalVersion 0
#define BUFLEN 1024
/* From XDE/3.0/ComSoft/Friends/TimeServerFormat.mesa!1 */
/*
TSPacket: TYPE = MACHINE DEPENDENT RECORD [
version(0): WORD,
tsBody(1): SELECT type(1): PacketType FROM
timeRequest => NULL,
timeResponse => [
time(2): WireLong,
zoneS(4): System.WestEast,
zoneH(5): [0..177B],
zoneM(6): [0..377B],
beginDST(7): WORD,
endDST(8): WORD,
errorAccurate(9): BOOLEAN,
absoluteError(10): WireLong],
statisticRequest => NULL,
statisticResponse => [
numberRequests(2): WireLong,
active(4): BOOLEAN,
resetting(5): BOOLEAN,
timeSet(6): WireLong,
lastChange(8): WireLong,
source(10): System.NetworkAddress],
startRequest, startResponse => NULL,
stopRequest, stopResponse => NULL,
resetRequest => [timeSource(2): System.NetworkAddress],
resetResponse => NULL,
internalTimeRequest => NULL,
internalTimeResponse => [
time(2): WireLong,
absoluteError(4): WireLong,
timeVersion(6): WireLong],
noteNewVersion => [timeVersion(2): WireLong],
ENDCASE];
*/
enum PacketType { timeRequest = 1, timeResponse = 2, statisticRequest = 3,
statisticResponse = 4, startRequest = 5, startResponse = 6,
stopRequest = 7, stopResponse = 8, resetRequest = 9,
resetResponse = 10, internalTimeRequest = 11, internalTimeResponse = 12,
noteNewVersion = 13 };
enum BOOLEAN { TRUE = 1, FALSE = 0 };
struct TSpacket {
u_short version;
u_short type;
union tsBody {
int timeRequest;
struct TimeResponse {
u_long time;
u_short zoneS;
u_short zoneH;
u_short zoneM;
u_short beginDST;
u_short endDST;
u_short errorAccurate;
u_long absoluteError;
} timeResponse;
int statisticRequest;
struct StatisticResponse {
u_long numberRequests;
u_short active;
u_short resetting;
u_long timeSet;
u_long lastChange;
struct ns_addr source;
} statisticResponse;
int startRequest, startResponse;
int stopRequest, stopResponse;
struct ResetRequest {
struct ns_addr timesource;
} resetRequest;
int resetResponse;
int internalTimeRequest;
struct InternalTimeResponse {
u_long time;
u_long absoluteError;
u_long timeVersion;
} internalTimeResponse;
struct NoteNewVersion {
u_long timeVersion;
} noteNewVersion;
} p;
};
/*
* Conversion of the Xerox representation of time to the Unix
* representation of time.
*
* The following was extracted from /xde/3.0/pilot/public/System.mesa
*
*
* GreenwichMeanTime: TYPE = RECORD [LONG CARDINAL];
*
* A greenwich mean time t represents the time which is t-gmtEpoch seconds
* after midnight, 1 January 1968, the time chosen as the epoch or
* beginning of the Pilot time standard. Within the range in which they
* overlap, the Alto and Pilot time standards assign identical bit
* patterns, but the Pilot standard runs an additional 67 years before
* overflowing. Greenwich mean times should be compared directly only for
* equality; to find which of two gmt's comes first, apply
* SecondsSinceEpoch to each and compare the result. If t2 is a gmt known
* to occur after t1, then t2-t1 is the seconds between t1 and t2. If t
* is a gmt, then System.GreenwichMeanTime[t+60] is the gmt one minute
* after t.
*
* gmtEpoch: GreenwichMeanTime = [2114294400]; = (67 years * 365 days + 16
* leap days) * 24 hours * 60 minutes * 60 seconds
*
*/
long
XeroxGMT_to_unixGMT(t)
long t;
{
return ( t - 2114294400 - 63158400 );
}
long
unixGMT_to_XeroxGMT(t)
long t;
{
return ( t + 63158400 + 2114294400 );
}
char *ns_ntoa();
int s;
int rnum = 1; /* PEX transaction ID */
sendrequest(type, who)
enum PacketType type;
struct sockaddr_ns *who;
{
char buf[576];
struct pex *pex;
struct TSpacket *ts;
int i;
pex = (struct pex *)buf;
ts = (struct TSpacket *) &buf[6];
pex->ph_id = htonl(rnum++);
pex->ph_client = htons(TimePEXClientType);
i = 6;
ts->version = htons(TimeVersion);
ts->type = htons((short) type);
i += 2*sizeof(short);
switch (type) {
case timeRequest:
case statisticRequest:
case startRequest:
case stopRequest:
case internalTimeRequest:
break;
case resetRequest:
{
struct ns_addr *nsa = &ts->p.resetRequest.timesource;
long net;
int n;
printf("resetRequest.timesource? ");
fflush(stdout);
if (scanf(" %x.%hx,%hx,%hx", &net, &nsa->x_host.s_host[0],
&nsa->x_host.s_host[1], &nsa->x_host.s_host[2]) != 4) {
printf("Illegal address\n");
return;
}
*(u_long *)&(*nsa) = htonl(net);
for (n = 0; n < 3; n++)
nsa->x_host.s_host[n] = htons(nsa->x_host.s_host[n]);
i += sizeof (struct ns_addr);
break;
}
case noteNewVersion:
printf("NewVersion? ");
fflush(stdout);
if (scanf(" %d", &ts->p.noteNewVersion.timeVersion ) != 1) {
printf("Illegal version\n");
return;
}
ts->p.noteNewVersion.timeVersion =
ntohl(ts->p.noteNewVersion.timeVersion );
i += sizeof (long);
break;
default:
printf("Illegal send request\n");
return;
}
if ( sendto(s, buf, i, 0, who, sizeof (*who)) < 0) {
perror("sendto");
}
}
main(ac, av)
int ac;
char **av;
{
struct sockaddr_ns me, you, who;
struct idp idph, *idp;
struct pex *pex;
char buf[BUFLEN];
int yoursize;
struct TSpacket *tp;
int n;
int bytesRecieved;
int on;
char *ctime();
long Time;
struct timeval tval;
int mask;
if ((s = socket(AF_NS, SOCK_DGRAM, 0)) < 0) {
perror("socket: %m");
exit(1);
}
me.sns_family = AF_NS;
me.sns_port = htons(getpid()+3000);
if (bind(s, &me, sizeof (me)) < 0 ) {
perror("bind: %m");
exit(1);
}
on = 1;
if (setsockopt(s, 0, SO_HEADERS_ON_INPUT, &on, sizeof(on))) {
perror("setsockopt SEE HEADERS: %m");
exit(1);
}
idph.idp_pt = NSPROTO_PE;
if (setsockopt(s, 0, SO_DEFAULT_HEADERS, &idph, sizeof(struct idp))) {
perror("setsockopt SET HEADER: %m");
exit(1);
}
if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &on, sizeof (on)) < 0) {
perror("setsockopt SO_BROADCAST: %m");
exit(1);
}
who.sns_family = AF_NS;
who.sns_port = htons(TimeServerSocket);
*(u_long *)(&who.sns_addr.x_net) = htonl(2269L);
for( n = 0; n < 3; n++)
who.sns_addr.x_host.s_host[n] = 0xffff;
if (ac > 1) {
struct ns_addr *nsa = &who.sns_addr;
long net;
int n;
n = sscanf(av[1], "%x.%hx,%hx,%hx", &net, &nsa->x_host.s_host[0],
&nsa->x_host.s_host[1], &nsa->x_host.s_host[2]);
if (n != 1 && n != 4) {
printf("Usage: %s [addr]\nwhere addr is either hex net or
net.host,host,host");
exit(1);
}
*(u_long *)&(who.sns_addr.x_net) = htonl(net);
for (n = 0; n < 3; n++)
nsa->x_host.s_host[n] = htons(nsa->x_host.s_host[n]);
}
for (;;) {
char cmd[80];
/* get command */
printf("cmd> ");
fflush(stdout);
if (gets(cmd) == NULL) exit(0);
switch(cmd[0]) {
case 'm':
sendrequest(timeRequest, &who);
break;
case 'i':
sendrequest(internalTimeRequest, &who);
break;
case 't':
sendrequest(startRequest, &who);
break;
case 'z':
sendrequest(stopRequest, &who);
break;
case 's':
sendrequest(statisticRequest, &who);
break;
case 'v':
sendrequest(noteNewVersion, &who);
break;
case 'r':
sendrequest(resetRequest, &who);
break;
case '\r':
case '\n':
continue;
case EOF:
exit(0);
default:
printf("\
r - resetRequest\n\
v - noteNewVersion\n\
s - statisticRequest\n\
z - stopRequest\n\
t - startRequest\n\
i - internalTimeRequest\n\
m - timeRequest\n");
fflush(stdin);
continue;
}
fflush(stdin);
tval.tv_sec = 3;
tval.tv_usec = 0;
while ( mask = 1<<s, (select(20, &mask, 0, 0, &tval) > 0)
&& (mask & 1<<s) ) {
yoursize = sizeof (you);
if ((n = recvfrom(s, buf, BUFLEN, 0, &you, &yoursize)) < 0) {
extern int errno;
if (errno != EINTR)
perror("rcvfrom: %m");
continue;
}
printf("%s --> ",
ns_ntoa(you.sns_addr));
idp = (struct idp *) buf;
pex = (struct pex *) &buf[sizeof (struct idp)];
printf("%s\n", ns_ntoa(idp->idp_dna));
if ( idp->idp_tc != (u_char) 0)
printf("idp->idp_tc = %d\n", idp->idp_tc);
if ( idp->idp_pt != NSPROTO_PE ) {
printf("idp_pt = %d ?\n", idp->idp_pt);
continue;
}
printf("pex id = %d, client = %d\n",
ntohl(pex->ph_id),
ntohs(pex->ph_client));
if ( ntohs(pex->ph_client) != TimePEXClientType)
continue;
/* got a Time Protocol packet, figure out what it is */
/* figure out size of packet */
bytesRecieved = n - sizeof (struct idp) - sizeof (struct pex);
tp = (struct TSpacket *) &buf[36]; /* DAMN C COMPILER! @!@#!@$#@$$#@ */
/*printf("Time Protocol, version %d\n", ntohs(tp->version) );*/
switch ((enum PacketType) ntohs(tp->type)) {
case timeRequest:
printf("Time Request.\n");
break;
case timeResponse:
Time = XeroxGMT_to_unixGMT(ntohl(tp->p.timeResponse.time));
printf("Time Response:\n");
printf("\ttime = %s\tzoneS = %d, zoneH = %d, zoneM = %d,
beginDST = %d, endDST = %d\n",
ctime(&Time),
ntohs(tp->p.timeResponse.zoneS),
ntohs(tp->p.timeResponse.zoneH), ntohs(tp->p.timeResponse.zoneM),
ntohs(tp->p.timeResponse.beginDST),
ntohs(tp->p.timeResponse.endDST));
printf("\terrorAccurate = %d, absoluteError = %d\n",
ntohs(tp->p.timeResponse.errorAccurate),ntohl(tp->p.timeResponse.absoluteError));
break;
case statisticRequest:
printf("StatisticRequest.\n");
break;
case statisticResponse:
printf("StatisticResponse:\n");
printf("\tnumberRequests = %d, active = %d, resetting = %d\n",
ntohl(tp->p.statisticResponse.numberRequests),
ntohs(tp->p.statisticResponse.active),
ntohs(tp->p.statisticResponse.resetting));
Time = XeroxGMT_to_unixGMT(ntohl(tp->p.statisticResponse.timeSet));
printf("\ttimeSet = %s", ctime(&Time));
printf("\tlastChange = %d seconds\tsource = %s\n",
ntohl(tp->p.statisticResponse.lastChange),
ns_ntoa(tp->p.statisticResponse.source));
break;
case startRequest:
printf("startRequest\n");
break;
case startResponse:
printf("startResponse\n");
break;
case stopRequest:
printf("stopRequest\n");
break;
case stopResponse:
printf("stopResponse\n");
break;
case resetRequest:
printf("ResetRequest\n");
printf("\ttimesource = %s\n", ns_ntoa(tp->p.resetRequest.timesource));
break;
case resetResponse:
printf("ResetResponse\n");
break;
case internalTimeRequest:
printf("internalTimeRequest\n");
break;
case internalTimeResponse:
Time = XeroxGMT_to_unixGMT(ntohl(tp->p.internalTimeResponse.time));
printf("internalTimeResponse\n");
printf("\ttime = %s\tabsoluteError = %d, timeVersion = %d\n",
ctime(&Time),
ntohl(tp->p.internalTimeResponse.absoluteError),
ntohl(tp->p.internalTimeResponse.timeVersion));
break;
case noteNewVersion:
printf("noteNewVersion\n");
printf("\ttimeVersion = %d\n",
ntohl(tp->p.noteNewVersion.timeVersion));
break;
default:
printf("unknown type %d\n",
ntohs(tp->type));
break;
}
} /* listen for more */
} /* get more commands */
}
/*
* Convert network-format ns address
* to ascii
*/
char *
ns_ntoa(addr)
struct ns_addr addr;
{
static char b[50];
char temp[10];
int i;
/* net */
sprintf(b, "%D.", ntohl(*(u_long *)&(addr)));
/* skip leading zeros */
for(i=0; (addr.x_host.c_host[i] == (char) 0); i++) ;
/* print the rest */
for(; i < 6; i++) {
sprintf(temp,"%x", addr.x_host.c_host[i]);
strcat(b, temp);
if(i != 5) strcat(b, ":");
}
sprintf(temp,".%d", ntohs(addr.x_port));
strcat(b, temp);
return (b);
}
> Did you get a floppy set up to write the images Marc?
I'm currently playing with my own stuff. But I just found a catweasel
controller and hope to get a set of floppies written in the next time.
I'll let you know if it works.
By the way I tried today to boot my 8010 again and now it is stuck at
0937 after entering the time.
Marc
>By the way I tried today to boot my 8010 again and now it is stuck at
>0937 after entering the time.
I had the same problem with a 6085 last year, never figured out what
was causing it. I'd picked it up, installed VP 3.x standalone, it
booted, asked for time - and hung, 0937. Tried it repeatedly, same
problem. Tried reinstalling - same problem.
Eventually found a set of VP 2.0 floppies, installed those standalone
- worked perfectly, first time.
Still puzzles me.