mirror of
https://github.com/dreamlayers/netbsd-mopd.git
synced 2026-02-04 07:32:39 +00:00
Fix WARNS=4 issues (many -Wshadow, -Wcast-qual)
This commit is contained in:
88
common/dl.c
88
common/dl.c
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dl.c,v 1.4 1999/08/17 12:38:09 simonb Exp $ */
|
||||
/* $NetBSD: dl.c,v 1.5 2009/04/17 04:16:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: dl.c,v 1.4 1999/08/17 12:38:09 simonb Exp $");
|
||||
__RCSID("$NetBSD: dl.c,v 1.5 2009/04/17 04:16:57 lukem Exp $");
|
||||
#endif
|
||||
|
||||
#include "os.h"
|
||||
@@ -46,7 +46,7 @@ mopDumpDL(fd, pkt, trans)
|
||||
u_char *pkt;
|
||||
int trans;
|
||||
{
|
||||
int i,index = 0;
|
||||
int i,idx = 0;
|
||||
u_int32_t tmpl;
|
||||
u_char tmpc,c,program[257],code,*ucp;
|
||||
u_short len,tmps,moplen;
|
||||
@@ -55,23 +55,23 @@ mopDumpDL(fd, pkt, trans)
|
||||
|
||||
switch (trans) {
|
||||
case TRANS_8023:
|
||||
index = 22;
|
||||
idx = 22;
|
||||
moplen = len - 8;
|
||||
break;
|
||||
default:
|
||||
index = 16;
|
||||
idx = 16;
|
||||
moplen = len;
|
||||
}
|
||||
code = mopGetChar(pkt,&index);
|
||||
code = mopGetChar(pkt,&idx);
|
||||
|
||||
switch (code) {
|
||||
case MOP_K_CODE_MLT:
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Load Number */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Load Number */
|
||||
(void)fprintf(fd,"Load Number : %02x\n",tmpc);
|
||||
|
||||
if (moplen > 6) {
|
||||
tmpl = mopGetLong(pkt,&index);/* Load Address */
|
||||
tmpl = mopGetLong(pkt,&idx);/* Load Address */
|
||||
(void)fprintf(fd,"Load Address : %08x\n", tmpl);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ mopDumpDL(fd, pkt, trans)
|
||||
}
|
||||
|
||||
(void)fprintf(fd, "%02x ",
|
||||
mopGetChar(pkt,&index));
|
||||
mopGetChar(pkt,&idx));
|
||||
if ((i % 16) == 15)
|
||||
(void)fprintf(fd,"\n");
|
||||
}
|
||||
@@ -98,11 +98,11 @@ mopDumpDL(fd, pkt, trans)
|
||||
if ((i % 16) != 15)
|
||||
(void)fprintf(fd,"\n");
|
||||
#else
|
||||
index = index + moplen - 10;
|
||||
idx = idx + moplen - 10;
|
||||
#endif
|
||||
}
|
||||
|
||||
tmpl = mopGetLong(pkt,&index); /* Load Address */
|
||||
tmpl = mopGetLong(pkt,&idx); /* Load Address */
|
||||
(void)fprintf(fd,"Xfer Address : %08x\n", tmpl);
|
||||
|
||||
break;
|
||||
@@ -113,10 +113,10 @@ mopDumpDL(fd, pkt, trans)
|
||||
break;
|
||||
case MOP_K_CODE_MLD:
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Load Number */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Load Number */
|
||||
(void)fprintf(fd,"Load Number : %02x\n",tmpc);
|
||||
|
||||
tmpl = mopGetLong(pkt,&index); /* Load Address */
|
||||
tmpl = mopGetLong(pkt,&idx); /* Load Address */
|
||||
(void)fprintf(fd,"Load Address : %08x\n", tmpl);
|
||||
|
||||
if (moplen > 6) {
|
||||
@@ -133,7 +133,7 @@ mopDumpDL(fd, pkt, trans)
|
||||
}
|
||||
}
|
||||
(void)fprintf(fd,"%02x ",
|
||||
mopGetChar(pkt,&index));
|
||||
mopGetChar(pkt,&idx));
|
||||
if ((i % 16) == 15)
|
||||
(void)fprintf(fd,"\n");
|
||||
}
|
||||
@@ -141,7 +141,7 @@ mopDumpDL(fd, pkt, trans)
|
||||
if ((i % 16) != 15)
|
||||
(void)fprintf(fd,"\n");
|
||||
#else
|
||||
index = index + moplen - 6;
|
||||
idx = idx + moplen - 6;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -153,48 +153,48 @@ mopDumpDL(fd, pkt, trans)
|
||||
break;
|
||||
case MOP_K_CODE_RMD:
|
||||
|
||||
tmpl = mopGetLong(pkt,&index); /* Memory Address */
|
||||
tmpl = mopGetLong(pkt,&idx); /* Memory Address */
|
||||
(void)fprintf(fd,"Mem Address : %08x\n", tmpl);
|
||||
|
||||
tmps = mopGetShort(pkt,&index); /* Count */
|
||||
tmps = mopGetShort(pkt,&idx); /* Count */
|
||||
(void)fprintf(fd,"Count : %04x (%d)\n",tmps,tmps);
|
||||
|
||||
break;
|
||||
case MOP_K_CODE_RPR:
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Device Type */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Device Type */
|
||||
(void)fprintf(fd, "Device Type : %02x ",tmpc);
|
||||
mopPrintDevice(fd, tmpc); (void)fprintf(fd, "\n");
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Format Version */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Format Version */
|
||||
(void)fprintf(fd,"Format : %02x\n",tmpc);
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Program Type */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Program Type */
|
||||
(void)fprintf(fd,"Program Type : %02x ",tmpc);
|
||||
mopPrintPGTY(fd, tmpc); (void)fprintf(fd, "\n");
|
||||
|
||||
program[0] = 0;
|
||||
tmpc = mopGetChar(pkt,&index); /* Software ID Len */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Software ID Len */
|
||||
for (i = 0; i < tmpc; i++) {
|
||||
program[i] = mopGetChar(pkt,&index);
|
||||
program[i] = mopGetChar(pkt,&idx);
|
||||
program[i+1] = '\0';
|
||||
}
|
||||
|
||||
(void)fprintf(fd,"Software : %02x '%s'\n",tmpc,program);
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Processor */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Processor */
|
||||
(void)fprintf(fd,"Processor : %02x ",tmpc);
|
||||
mopPrintBPTY(fd, tmpc); (void)fprintf(fd, "\n");
|
||||
|
||||
mopPrintInfo(fd, pkt, &index, moplen, code, trans);
|
||||
mopPrintInfo(fd, pkt, &idx, moplen, code, trans);
|
||||
|
||||
break;
|
||||
case MOP_K_CODE_RML:
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Load Number */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Load Number */
|
||||
(void)fprintf(fd,"Load Number : %02x\n",tmpc);
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Error */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Error */
|
||||
(void)fprintf(fd,"Error : %02x (",tmpc);
|
||||
if ((tmpc == 0)) {
|
||||
(void)fprintf(fd,"no error)\n");
|
||||
@@ -205,25 +205,25 @@ mopDumpDL(fd, pkt, trans)
|
||||
break;
|
||||
case MOP_K_CODE_RDS:
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Device Type */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Device Type */
|
||||
(void)fprintf(fd, "Device Type : %02x ",tmpc);
|
||||
mopPrintDevice(fd, tmpc); (void)fprintf(fd, "\n");
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Format Version */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Format Version */
|
||||
(void)fprintf(fd,"Format : %02x\n",tmpc);
|
||||
|
||||
tmpl = mopGetLong(pkt,&index); /* Memory Size */
|
||||
tmpl = mopGetLong(pkt,&idx); /* Memory Size */
|
||||
(void)fprintf(fd,"Memory Size : %08x\n", tmpl);
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Bits */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Bits */
|
||||
(void)fprintf(fd,"Bits : %02x\n",tmpc);
|
||||
|
||||
mopPrintInfo(fd, pkt, &index, moplen, code, trans);
|
||||
mopPrintInfo(fd, pkt, &idx, moplen, code, trans);
|
||||
|
||||
break;
|
||||
case MOP_K_CODE_MDD:
|
||||
|
||||
tmpl = mopGetLong(pkt,&index); /* Memory Address */
|
||||
tmpl = mopGetLong(pkt,&idx); /* Memory Address */
|
||||
(void)fprintf(fd,"Mem Address : %08x\n", tmpl);
|
||||
|
||||
if (moplen > 5) {
|
||||
@@ -240,33 +240,33 @@ mopDumpDL(fd, pkt, trans)
|
||||
}
|
||||
}
|
||||
(void)fprintf(fd,"%02x ",
|
||||
mopGetChar(pkt,&index));
|
||||
mopGetChar(pkt,&idx));
|
||||
if ((i % 16) == 15)
|
||||
(void)fprintf(fd,"\n");
|
||||
}
|
||||
if ((i % 16) != 15)
|
||||
(void)fprintf(fd,"\n");
|
||||
#else
|
||||
index = index + moplen - 5;
|
||||
idx = idx + moplen - 5;
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
case MOP_K_CODE_PLT:
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Load Number */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Load Number */
|
||||
(void)fprintf(fd,"Load Number : %02x\n",tmpc);
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Parameter Type */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Parameter Type */
|
||||
while (tmpc != MOP_K_PLTP_END) {
|
||||
c = mopGetChar(pkt,&index); /* Parameter Length */
|
||||
c = mopGetChar(pkt,&idx); /* Parameter Length */
|
||||
switch(tmpc) {
|
||||
case MOP_K_PLTP_TSN: /* Target Name */
|
||||
(void)fprintf(fd,"Target Name : %02x '",
|
||||
tmpc);
|
||||
for (i = 0; i < ((int) c); i++) {
|
||||
(void)fprintf(fd,"%c",
|
||||
mopGetChar(pkt,&index));
|
||||
mopGetChar(pkt,&idx));
|
||||
}
|
||||
(void)fprintf(fd,"'\n");
|
||||
break;
|
||||
@@ -274,7 +274,7 @@ mopDumpDL(fd, pkt, trans)
|
||||
(void)fprintf(fd,"Target Addr : %02x ",c);
|
||||
for (i = 0; i < ((int) c); i++) {
|
||||
(void)fprintf(fd,"%02x ",
|
||||
mopGetChar(pkt,&index));
|
||||
mopGetChar(pkt,&idx));
|
||||
}
|
||||
(void)fprintf(fd,"\n");
|
||||
break;
|
||||
@@ -283,7 +283,7 @@ mopDumpDL(fd, pkt, trans)
|
||||
tmpc);
|
||||
for (i = 0; i < ((int) c); i++) {
|
||||
(void)fprintf(fd,"%c",
|
||||
mopGetChar(pkt,&index));
|
||||
mopGetChar(pkt,&idx));
|
||||
}
|
||||
(void)fprintf(fd,"'\n");
|
||||
break;
|
||||
@@ -291,12 +291,12 @@ mopDumpDL(fd, pkt, trans)
|
||||
(void)fprintf(fd,"Host Addr : %02x ",c);
|
||||
for (i = 0; i < ((int) c); i++) {
|
||||
(void)fprintf(fd,"%02x ",
|
||||
mopGetChar(pkt,&index));
|
||||
mopGetChar(pkt,&idx));
|
||||
}
|
||||
(void)fprintf(fd,"\n");
|
||||
break;
|
||||
case MOP_K_PLTP_HST: /* Host Time */
|
||||
ucp = pkt + index; index = index + 10;
|
||||
ucp = pkt + idx; idx = idx + 10;
|
||||
(void)fprintf(fd,"Host Time : ");
|
||||
mopPrintTime(fd, ucp);
|
||||
(void)fprintf(fd,"\n");
|
||||
@@ -304,10 +304,10 @@ mopDumpDL(fd, pkt, trans)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
tmpc = mopGetChar(pkt,&index);/* Parameter Type */
|
||||
tmpc = mopGetChar(pkt,&idx);/* Parameter Type */
|
||||
}
|
||||
|
||||
tmpl = mopGetLong(pkt,&index); /* Transfer Address */
|
||||
tmpl = mopGetLong(pkt,&idx); /* Transfer Address */
|
||||
(void)fprintf(fd,"Transfer Addr: %08x\n", tmpl);
|
||||
|
||||
break;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: file.c,v 1.10 2002/11/05 06:08:29 thorpej Exp $ */
|
||||
/* $NetBSD: file.c,v 1.11 2009/04/17 04:16:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995-96 Mats O Jansson. All rights reserved.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: file.c,v 1.10 2002/11/05 06:08:29 thorpej Exp $");
|
||||
__RCSID("$NetBSD: file.c,v 1.11 2009/04/17 04:16:57 lukem Exp $");
|
||||
#endif
|
||||
|
||||
#include "os.h"
|
||||
@@ -86,73 +86,73 @@ FileTypeName(type)
|
||||
}
|
||||
|
||||
void
|
||||
mopFilePutLX(buf, index, value, cnt)
|
||||
mopFilePutLX(buf, idx, value, cnt)
|
||||
u_char *buf;
|
||||
int index, cnt;
|
||||
int idx, cnt;
|
||||
u_int32_t value;
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < cnt; i++) {
|
||||
buf[index+i] = value % 256;
|
||||
buf[idx+i] = value % 256;
|
||||
value = value / 256;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mopFilePutBX(buf, index, value, cnt)
|
||||
mopFilePutBX(buf, idx, value, cnt)
|
||||
u_char *buf;
|
||||
int index, cnt;
|
||||
int idx, cnt;
|
||||
u_int32_t value;
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < cnt; i++) {
|
||||
buf[index+cnt-1-i] = value % 256;
|
||||
buf[idx+cnt-1-i] = value % 256;
|
||||
value = value / 256;
|
||||
}
|
||||
}
|
||||
|
||||
u_int32_t
|
||||
mopFileGetLX(buf, index, cnt)
|
||||
mopFileGetLX(buf, idx, cnt)
|
||||
u_char *buf;
|
||||
int index, cnt;
|
||||
int idx, cnt;
|
||||
{
|
||||
u_int32_t ret = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
ret = ret*256 + buf[index+cnt-1-i];
|
||||
ret = ret*256 + buf[idx+cnt-1-i];
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
u_int32_t
|
||||
mopFileGetBX(buf, index, cnt)
|
||||
mopFileGetBX(buf, idx, cnt)
|
||||
u_char *buf;
|
||||
int index, cnt;
|
||||
int idx, cnt;
|
||||
{
|
||||
u_int32_t ret = 0;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
ret = ret*256 + buf[index+i];
|
||||
ret = ret*256 + buf[idx+i];
|
||||
}
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
void
|
||||
mopFileSwapX(buf, index, cnt)
|
||||
mopFileSwapX(buf, idx, cnt)
|
||||
u_char *buf;
|
||||
int index, cnt;
|
||||
int idx, cnt;
|
||||
{
|
||||
int i;
|
||||
u_char c;
|
||||
|
||||
for (i = 0; i < (cnt / 2); i++) {
|
||||
c = buf[index+i];
|
||||
buf[index+i] = buf[index+cnt-1-i];
|
||||
buf[index+cnt-1-i] = c;
|
||||
c = buf[idx+i];
|
||||
buf[idx+i] = buf[idx+cnt-1-i];
|
||||
buf[idx+cnt-1-i] = c;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -689,14 +689,14 @@ GetAOutFileInfo(dl)
|
||||
|
||||
mid = getMID(mid, N_GETMID (ex));
|
||||
|
||||
if (mid == -1) {
|
||||
if (mid == (uint32_t)-1) {
|
||||
mid = getMID(mid, N_GETMID (ex_swap));
|
||||
if (mid != -1) {
|
||||
if (mid != (uint32_t)-1) {
|
||||
mopFileSwapX((u_char *)&ex, 0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
if (mid == -1) {
|
||||
if (mid == (uint32_t)-1) {
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@@ -871,30 +871,30 @@ int
|
||||
GetFileInfo(dl)
|
||||
struct dllist *dl;
|
||||
{
|
||||
int err;
|
||||
int error;
|
||||
|
||||
err = CheckElfFile(dl->ldfd);
|
||||
if (err == 0) {
|
||||
err = GetElfFileInfo(dl);
|
||||
if (err != 0) {
|
||||
error = CheckElfFile(dl->ldfd);
|
||||
if (error == 0) {
|
||||
error = GetElfFileInfo(dl);
|
||||
if (error != 0) {
|
||||
return(-1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
err = CheckAOutFile(dl->ldfd);
|
||||
if (err == 0) {
|
||||
err = GetAOutFileInfo(dl);
|
||||
if (err != 0) {
|
||||
error = CheckAOutFile(dl->ldfd);
|
||||
if (error == 0) {
|
||||
error = GetAOutFileInfo(dl);
|
||||
if (error != 0) {
|
||||
return(-1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
err = CheckMopFile(dl->ldfd);
|
||||
if (err == 0) {
|
||||
err = GetMopFileInfo(dl);
|
||||
if (err != 0) {
|
||||
error = CheckMopFile(dl->ldfd);
|
||||
if (error == 0) {
|
||||
error = GetMopFileInfo(dl);
|
||||
if (error != 0) {
|
||||
return(-1);
|
||||
}
|
||||
return (0);
|
||||
|
||||
64
common/get.c
64
common/get.c
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: get.c,v 1.3 1997/10/16 23:24:38 lukem Exp $ */
|
||||
/* $NetBSD: get.c,v 1.4 2009/04/17 04:16:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: get.c,v 1.3 1997/10/16 23:24:38 lukem Exp $");
|
||||
__RCSID("$NetBSD: get.c,v 1.4 2009/04/17 04:16:57 lukem Exp $");
|
||||
#endif
|
||||
|
||||
#include "os.h"
|
||||
@@ -39,55 +39,55 @@ __RCSID("$NetBSD: get.c,v 1.3 1997/10/16 23:24:38 lukem Exp $");
|
||||
#include "mopdef.h"
|
||||
|
||||
u_char
|
||||
mopGetChar(pkt, index)
|
||||
mopGetChar(pkt, idx)
|
||||
u_char *pkt;
|
||||
int *index;
|
||||
int *idx;
|
||||
{
|
||||
u_char ret;
|
||||
|
||||
ret = pkt[*index];
|
||||
*index = *index + 1;
|
||||
ret = pkt[*idx];
|
||||
*idx = *idx + 1;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
u_short
|
||||
mopGetShort(pkt, index)
|
||||
mopGetShort(pkt, idx)
|
||||
u_char *pkt;
|
||||
int *index;
|
||||
int *idx;
|
||||
{
|
||||
u_short ret;
|
||||
|
||||
ret = pkt[*index] + pkt[*index+1]*256;
|
||||
*index = *index + 2;
|
||||
ret = pkt[*idx] + pkt[*idx+1]*256;
|
||||
*idx = *idx + 2;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
u_int32_t
|
||||
mopGetLong(pkt, index)
|
||||
mopGetLong(pkt, idx)
|
||||
u_char *pkt;
|
||||
int *index;
|
||||
int *idx;
|
||||
{
|
||||
u_int32_t ret;
|
||||
|
||||
ret = pkt[*index] +
|
||||
pkt[*index+1]*0x100 +
|
||||
pkt[*index+2]*0x10000 +
|
||||
pkt[*index+3]*0x1000000;
|
||||
*index = *index + 4;
|
||||
ret = pkt[*idx] +
|
||||
pkt[*idx+1]*0x100 +
|
||||
pkt[*idx+2]*0x10000 +
|
||||
pkt[*idx+3]*0x1000000;
|
||||
*idx = *idx + 4;
|
||||
return(ret);
|
||||
}
|
||||
|
||||
void
|
||||
mopGetMulti(pkt, index, dest, size)
|
||||
mopGetMulti(pkt, idx, dest, size)
|
||||
u_char *pkt,*dest;
|
||||
int *index,size;
|
||||
int *idx,size;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
dest[i] = pkt[*index+i];
|
||||
dest[i] = pkt[*idx+i];
|
||||
}
|
||||
*index = *index + size;
|
||||
*idx = *idx + size;
|
||||
|
||||
}
|
||||
|
||||
@@ -110,27 +110,27 @@ mopGetTrans(pkt, trans)
|
||||
}
|
||||
|
||||
void
|
||||
mopGetHeader(pkt, index, dst, src, proto, len, trans)
|
||||
mopGetHeader(pkt, idx, dst, src, proto, len, trans)
|
||||
u_char *pkt, **dst, **src;
|
||||
int *index, *len, trans;
|
||||
int *idx, *len, trans;
|
||||
u_short *proto;
|
||||
{
|
||||
*dst = pkt;
|
||||
*src = pkt + 6;
|
||||
*index = *index + 12;
|
||||
*idx = *idx + 12;
|
||||
|
||||
switch(trans) {
|
||||
case TRANS_ETHER:
|
||||
*proto = (u_short)(pkt[*index]*256 + pkt[*index+1]);
|
||||
*index = *index + 2;
|
||||
*len = (int)(pkt[*index+1]*256 + pkt[*index]);
|
||||
*index = *index + 2;
|
||||
*proto = (u_short)(pkt[*idx]*256 + pkt[*idx+1]);
|
||||
*idx = *idx + 2;
|
||||
*len = (int)(pkt[*idx+1]*256 + pkt[*idx]);
|
||||
*idx = *idx + 2;
|
||||
break;
|
||||
case TRANS_8023:
|
||||
*len = (int)(pkt[*index]*256 + pkt[*index+1]);
|
||||
*index = *index + 8;
|
||||
*proto = (u_short)(pkt[*index]*256 + pkt[*index+1]);
|
||||
*index = *index + 2;
|
||||
*len = (int)(pkt[*idx]*256 + pkt[*idx+1]);
|
||||
*idx = *idx + 8;
|
||||
*proto = (u_short)(pkt[*idx]*256 + pkt[*idx+1]);
|
||||
*idx = *idx + 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
12
common/nma.c
12
common/nma.c
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nma.c,v 1.3 1997/10/16 23:24:48 lukem Exp $ */
|
||||
/* $NetBSD: nma.c,v 1.4 2009/04/17 04:16:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Mats O Jansson. All rights reserved.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: nma.c,v 1.3 1997/10/16 23:24:48 lukem Exp $");
|
||||
__RCSID("$NetBSD: nma.c,v 1.4 2009/04/17 04:16:57 lukem Exp $");
|
||||
#endif
|
||||
|
||||
#include "os.h"
|
||||
@@ -40,8 +40,8 @@ __RCSID("$NetBSD: nma.c,v 1.3 1997/10/16 23:24:48 lukem Exp $");
|
||||
|
||||
struct commDev {
|
||||
int val;
|
||||
char *sname;
|
||||
char *name;
|
||||
const char *sname;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
struct commDev nmaCommDev[] = {
|
||||
@@ -192,7 +192,7 @@ struct commDev nmaCommDev[] = {
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
|
||||
char *
|
||||
const char *
|
||||
nmaGetShort(devno)
|
||||
int devno;
|
||||
{
|
||||
@@ -209,7 +209,7 @@ nmaGetShort(devno)
|
||||
return(current->sname);
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
nmaGetDevice(devno)
|
||||
int devno;
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: nma.h,v 1.4 2001/01/16 02:50:31 cgd Exp $ */
|
||||
/* $NetBSD: nma.h,v 1.5 2009/04/17 04:16:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Mats O Jansson. All rights reserved.
|
||||
@@ -28,7 +28,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: nma.h,v 1.4 2001/01/16 02:50:31 cgd Exp $
|
||||
* $NetBSD: nma.h,v 1.5 2009/04/17 04:16:57 lukem Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
#define _NMA_H_
|
||||
|
||||
__BEGIN_DECLS
|
||||
char *nmaGetShort __P((int));
|
||||
char *nmaGetDevice __P((int));
|
||||
const char *nmaGetShort __P((int));
|
||||
const char *nmaGetDevice __P((int));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _NMA_H_ */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: print.c,v 1.3 1997/10/16 23:24:58 lukem Exp $ */
|
||||
/* $NetBSD: print.c,v 1.4 2009/04/17 04:16:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993-96 Mats O Jansson. All rights reserved.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: print.c,v 1.3 1997/10/16 23:24:58 lukem Exp $");
|
||||
__RCSID("$NetBSD: print.c,v 1.4 2009/04/17 04:16:57 lukem Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -110,14 +110,14 @@ mopPrintOneline(fd, pkt, trans)
|
||||
u_char *pkt;
|
||||
int trans;
|
||||
{
|
||||
int index = 0;
|
||||
int idx = 0;
|
||||
u_char *dst, *src, code;
|
||||
u_short proto;
|
||||
int len;
|
||||
|
||||
trans = mopGetTrans(pkt, trans);
|
||||
mopGetHeader(pkt, &index, &dst, &src, &proto, &len, trans);
|
||||
code = mopGetChar(pkt, &index);
|
||||
mopGetHeader(pkt, &idx, &dst, &src, &proto, &len, trans);
|
||||
code = mopGetChar(pkt, &idx);
|
||||
|
||||
switch (proto) {
|
||||
case MOP_K_PROTO_DL:
|
||||
@@ -262,10 +262,10 @@ mopPrintHeader(fd, pkt, trans)
|
||||
{
|
||||
u_char *dst, *src;
|
||||
u_short proto;
|
||||
int len, index = 0;
|
||||
int len, idx = 0;
|
||||
|
||||
trans = mopGetTrans(pkt, trans);
|
||||
mopGetHeader(pkt, &index, &dst, &src, &proto, &len, trans);
|
||||
mopGetHeader(pkt, &idx, &dst, &src, &proto, &len, trans);
|
||||
|
||||
(void)fprintf(fd,"\nDst : ");
|
||||
mopPrintHWA(fd, dst);
|
||||
@@ -326,13 +326,13 @@ mopPrintMopHeader(fd, pkt, trans)
|
||||
{
|
||||
u_char *dst, *src;
|
||||
u_short proto;
|
||||
int len, index = 0;
|
||||
int len, idx = 0;
|
||||
u_char code;
|
||||
|
||||
trans = mopGetTrans(pkt, trans);
|
||||
mopGetHeader(pkt, &index, &dst, &src, &proto, &len, trans);
|
||||
mopGetHeader(pkt, &idx, &dst, &src, &proto, &len, trans);
|
||||
|
||||
code = mopGetChar(pkt, &index);
|
||||
code = mopGetChar(pkt, &idx);
|
||||
|
||||
(void)fprintf(fd, "Code : %02x ",code);
|
||||
|
||||
@@ -435,7 +435,7 @@ mopPrintDevice(fd, device)
|
||||
FILE *fd;
|
||||
u_char device;
|
||||
{
|
||||
char *sname, *name;
|
||||
const char *sname, *name;
|
||||
|
||||
sname = nmaGetShort((int) device);
|
||||
name = nmaGetDevice((int) device);
|
||||
@@ -455,10 +455,10 @@ mopPrintTime(fd, ap)
|
||||
}
|
||||
|
||||
void
|
||||
mopPrintInfo(fd, pkt, index, moplen, mopcode, trans)
|
||||
mopPrintInfo(fd, pkt, idx, moplen, mopcode, trans)
|
||||
FILE *fd;
|
||||
u_char *pkt, mopcode;
|
||||
int *index, trans;
|
||||
int *idx, trans;
|
||||
u_short moplen;
|
||||
{
|
||||
u_short itype,tmps;
|
||||
@@ -477,24 +477,24 @@ mopPrintInfo(fd, pkt, index, moplen, mopcode, trans)
|
||||
break;
|
||||
}
|
||||
|
||||
itype = mopGetShort(pkt,index);
|
||||
itype = mopGetShort(pkt,idx);
|
||||
|
||||
while (*index < (int)(moplen + 2)) {
|
||||
ilen = mopGetChar(pkt,index);
|
||||
while (*idx < (int)(moplen + 2)) {
|
||||
ilen = mopGetChar(pkt,idx);
|
||||
switch (itype) {
|
||||
case 0:
|
||||
tmpc = mopGetChar(pkt,index);
|
||||
*index = *index + tmpc;
|
||||
tmpc = mopGetChar(pkt,idx);
|
||||
*idx = *idx + tmpc;
|
||||
break;
|
||||
case MOP_K_INFO_VER:
|
||||
uc1 = mopGetChar(pkt,index);
|
||||
uc2 = mopGetChar(pkt,index);
|
||||
uc3 = mopGetChar(pkt,index);
|
||||
uc1 = mopGetChar(pkt,idx);
|
||||
uc2 = mopGetChar(pkt,idx);
|
||||
uc3 = mopGetChar(pkt,idx);
|
||||
(void)fprintf(fd,"Maint Version: %d.%d.%d\n",
|
||||
uc1,uc2,uc3);
|
||||
break;
|
||||
case MOP_K_INFO_MFCT:
|
||||
tmps = mopGetShort(pkt,index);
|
||||
tmps = mopGetShort(pkt,idx);
|
||||
(void)fprintf(fd,"Maint Funcion: %04x ( ",tmps);
|
||||
if (tmps & 1) (void)fprintf(fd, "Loop ");
|
||||
if (tmps & 2) (void)fprintf(fd, "Dump ");
|
||||
@@ -507,46 +507,46 @@ mopPrintInfo(fd, pkt, index, moplen, mopcode, trans)
|
||||
(void)fprintf(fd, ")\n");
|
||||
break;
|
||||
case MOP_K_INFO_CNU:
|
||||
ucp = pkt + *index; *index = *index + 6;
|
||||
ucp = pkt + *idx; *idx = *idx + 6;
|
||||
(void)fprintf(fd,"Console User : ");
|
||||
mopPrintHWA(fd, ucp);
|
||||
(void)fprintf(fd, "\n");
|
||||
break;
|
||||
case MOP_K_INFO_RTM:
|
||||
tmps = mopGetShort(pkt,index);
|
||||
tmps = mopGetShort(pkt,idx);
|
||||
(void)fprintf(fd,"Reserv Timer : %04x (%d)\n",
|
||||
tmps,tmps);
|
||||
break;
|
||||
case MOP_K_INFO_CSZ:
|
||||
tmps = mopGetShort(pkt,index);
|
||||
tmps = mopGetShort(pkt,idx);
|
||||
(void)fprintf(fd,"Cons Cmd Size: %04x (%d)\n",
|
||||
tmps,tmps);
|
||||
break;
|
||||
case MOP_K_INFO_RSZ:
|
||||
tmps = mopGetShort(pkt,index);
|
||||
tmps = mopGetShort(pkt,idx);
|
||||
(void)fprintf(fd,"Cons Res Size: %04x (%d)\n",
|
||||
tmps,tmps);
|
||||
break;
|
||||
case MOP_K_INFO_HWA:
|
||||
ucp = pkt + *index; *index = *index + 6;
|
||||
ucp = pkt + *idx; *idx = *idx + 6;
|
||||
(void)fprintf(fd,"Hardware Addr: ");
|
||||
mopPrintHWA(fd, ucp);
|
||||
(void)fprintf(fd, "\n");
|
||||
break;
|
||||
case MOP_K_INFO_TIME:
|
||||
ucp = pkt + *index; *index = *index + 10;
|
||||
ucp = pkt + *idx; *idx = *idx + 10;
|
||||
(void)fprintf(fd,"System Time: ");
|
||||
mopPrintTime(fd, ucp);
|
||||
(void)fprintf(fd,"\n");
|
||||
break;
|
||||
case MOP_K_INFO_SOFD:
|
||||
device = mopGetChar(pkt,index);
|
||||
device = mopGetChar(pkt,idx);
|
||||
(void)fprintf(fd,"Comm Device : %02x ",device);
|
||||
mopPrintDevice(fd, device);
|
||||
(void)fprintf(fd, "\n");
|
||||
break;
|
||||
case MOP_K_INFO_SFID:
|
||||
tmpc = mopGetChar(pkt,index);
|
||||
tmpc = mopGetChar(pkt,idx);
|
||||
(void)fprintf(fd,"Software ID : %02x ",tmpc);
|
||||
if ((tmpc == 0)) {
|
||||
(void)fprintf(fd,"No software id");
|
||||
@@ -563,14 +563,14 @@ mopPrintInfo(fd, pkt, index, moplen, mopcode, trans)
|
||||
(void)fprintf(fd,"'");
|
||||
for (i = 0; i < ((int) tmpc); i++) {
|
||||
(void)fprintf(fd,"%c",
|
||||
mopGetChar(pkt,index));
|
||||
mopGetChar(pkt,idx));
|
||||
}
|
||||
(void)fprintf(fd,"'");
|
||||
}
|
||||
(void)fprintf(fd,"\n");
|
||||
break;
|
||||
case MOP_K_INFO_PRTY:
|
||||
tmpc = mopGetChar(pkt,index);
|
||||
tmpc = mopGetChar(pkt,idx);
|
||||
(void)fprintf(fd,"System Proc : %02x ",tmpc);
|
||||
switch (tmpc) {
|
||||
case MOP_K_PRTY_11:
|
||||
@@ -598,7 +598,7 @@ mopPrintInfo(fd, pkt, index, moplen, mopcode, trans)
|
||||
};
|
||||
break;
|
||||
case MOP_K_INFO_DLTY:
|
||||
tmpc = mopGetChar(pkt,index);
|
||||
tmpc = mopGetChar(pkt,idx);
|
||||
(void)fprintf(fd,"Data Link Typ: %02x ",tmpc);
|
||||
switch (tmpc) {
|
||||
case MOP_K_DLTY_NI:
|
||||
@@ -616,7 +616,7 @@ mopPrintInfo(fd, pkt, index, moplen, mopcode, trans)
|
||||
};
|
||||
break;
|
||||
case MOP_K_INFO_DLBSZ:
|
||||
tmps = mopGetShort(pkt,index);
|
||||
tmps = mopGetShort(pkt,idx);
|
||||
(void)fprintf(fd,"DL Buff Size : %04x (%d)\n",
|
||||
tmps,tmps);
|
||||
break;
|
||||
@@ -629,8 +629,8 @@ mopPrintInfo(fd, pkt, index, moplen, mopcode, trans)
|
||||
{
|
||||
switch (itype) {
|
||||
case 102:
|
||||
ucp = pkt + *index;
|
||||
*index = *index + ilen;
|
||||
ucp = pkt + *idx;
|
||||
*idx = *idx + ilen;
|
||||
(void)fprintf(fd,
|
||||
"ROM Sftwr Ver: %02x '",
|
||||
ilen);
|
||||
@@ -640,8 +640,8 @@ mopPrintInfo(fd, pkt, index, moplen, mopcode, trans)
|
||||
(void)fprintf(fd, "'\n");
|
||||
break;
|
||||
case 103:
|
||||
ucp = pkt + *index;
|
||||
*index = *index + ilen;
|
||||
ucp = pkt + *idx;
|
||||
*idx = *idx + ilen;
|
||||
(void)fprintf(fd,
|
||||
"Software Ver : %02x '",
|
||||
ilen);
|
||||
@@ -651,7 +651,7 @@ mopPrintInfo(fd, pkt, index, moplen, mopcode, trans)
|
||||
(void)fprintf(fd, "'\n");
|
||||
break;
|
||||
case 104:
|
||||
tmps = mopGetShort(pkt,index);
|
||||
tmps = mopGetShort(pkt,idx);
|
||||
(void)fprintf(fd,
|
||||
"DECnet Addr : %d.%d (%d)\n",
|
||||
tmps / 1024,
|
||||
@@ -659,8 +659,8 @@ mopPrintInfo(fd, pkt, index, moplen, mopcode, trans)
|
||||
tmps);
|
||||
break;
|
||||
case 105:
|
||||
ucp = pkt + *index;
|
||||
*index = *index + ilen;
|
||||
ucp = pkt + *idx;
|
||||
*idx = *idx + ilen;
|
||||
(void)fprintf(fd,
|
||||
"Node Name : %02x '",
|
||||
ilen);
|
||||
@@ -670,8 +670,8 @@ mopPrintInfo(fd, pkt, index, moplen, mopcode, trans)
|
||||
(void)fprintf(fd, "'\n");
|
||||
break;
|
||||
case 106:
|
||||
ucp = pkt + *index;
|
||||
*index = *index + ilen;
|
||||
ucp = pkt + *idx;
|
||||
*idx = *idx + ilen;
|
||||
(void)fprintf(fd,
|
||||
"Node Ident : %02x '",
|
||||
ilen);
|
||||
@@ -682,7 +682,7 @@ mopPrintInfo(fd, pkt, index, moplen, mopcode, trans)
|
||||
break;
|
||||
};
|
||||
} else {
|
||||
ucp = pkt + *index; *index = *index + ilen;
|
||||
ucp = pkt + *idx; *idx = *idx + ilen;
|
||||
(void)fprintf(fd, "Info Type : %04x (%d)\n",
|
||||
itype,
|
||||
itype);
|
||||
@@ -701,7 +701,7 @@ mopPrintInfo(fd, pkt, index, moplen, mopcode, trans)
|
||||
(void)fprintf(fd, "\n");
|
||||
};
|
||||
}
|
||||
itype = mopGetShort(pkt,index);
|
||||
itype = mopGetShort(pkt,idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
119
common/put.c
119
common/put.c
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: put.c,v 1.3 1997/10/16 23:25:01 lukem Exp $ */
|
||||
/* $NetBSD: put.c,v 1.4 2009/04/17 04:16:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: put.c,v 1.3 1997/10/16 23:25:01 lukem Exp $");
|
||||
__RCSID("$NetBSD: put.c,v 1.4 2009/04/17 04:16:57 lukem Exp $");
|
||||
#endif
|
||||
|
||||
#include "os.h"
|
||||
@@ -39,60 +39,61 @@ __RCSID("$NetBSD: put.c,v 1.3 1997/10/16 23:25:01 lukem Exp $");
|
||||
#include "put.h"
|
||||
|
||||
void
|
||||
mopPutChar(pkt, index, value)
|
||||
mopPutChar(pkt, idx, value)
|
||||
u_char *pkt;
|
||||
int *index;
|
||||
int *idx;
|
||||
u_char value;
|
||||
{
|
||||
pkt[*index] = value;
|
||||
*index = *index + 1;
|
||||
pkt[*idx] = value;
|
||||
*idx = *idx + 1;
|
||||
}
|
||||
|
||||
void
|
||||
mopPutShort(pkt, index, value)
|
||||
mopPutShort(pkt, idx, value)
|
||||
u_char *pkt;
|
||||
int *index;
|
||||
int *idx;
|
||||
u_short value;
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 2; i++) {
|
||||
pkt[*index+i] = value % 256;
|
||||
pkt[*idx+i] = value % 256;
|
||||
value = value / 256;
|
||||
}
|
||||
*index = *index + 2;
|
||||
*idx = *idx + 2;
|
||||
}
|
||||
|
||||
void
|
||||
mopPutLong(pkt, index, value)
|
||||
mopPutLong(pkt, idx, value)
|
||||
u_char *pkt;
|
||||
int *index;
|
||||
int *idx;
|
||||
u_int32_t value;
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
pkt[*index+i] = value % 256;
|
||||
pkt[*idx+i] = value % 256;
|
||||
value = value / 256;
|
||||
}
|
||||
*index = *index + 4;
|
||||
*idx = *idx + 4;
|
||||
}
|
||||
|
||||
void
|
||||
mopPutMulti(pkt, index, value, size)
|
||||
u_char *pkt,*value;
|
||||
int *index,size;
|
||||
mopPutMulti(pkt, idx, value, size)
|
||||
u_char *pkt;
|
||||
int *idx,size;
|
||||
const u_char *value;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
pkt[*index+i] = value[i];
|
||||
pkt[*idx+i] = value[i];
|
||||
}
|
||||
*index = *index + size;
|
||||
*idx = *idx + size;
|
||||
}
|
||||
|
||||
void
|
||||
mopPutTime(pkt, index, value)
|
||||
mopPutTime(pkt, idx, value)
|
||||
u_char *pkt;
|
||||
int *index;
|
||||
int *idx;
|
||||
time_t value;
|
||||
{
|
||||
time_t tnow;
|
||||
@@ -106,53 +107,53 @@ mopPutTime(pkt, index, value)
|
||||
|
||||
timenow = localtime(&tnow);
|
||||
|
||||
mopPutChar (pkt,index,10);
|
||||
mopPutChar (pkt,index,(timenow->tm_year / 100) + 19);
|
||||
mopPutChar (pkt,index,(timenow->tm_year % 100));
|
||||
mopPutChar (pkt,index,(timenow->tm_mon + 1));
|
||||
mopPutChar (pkt,index,(timenow->tm_mday));
|
||||
mopPutChar (pkt,index,(timenow->tm_hour));
|
||||
mopPutChar (pkt,index,(timenow->tm_min));
|
||||
mopPutChar (pkt,index,(timenow->tm_sec));
|
||||
mopPutChar (pkt,index,0x00);
|
||||
mopPutChar (pkt,index,0x00);
|
||||
mopPutChar (pkt,index,0x00);
|
||||
mopPutChar (pkt,idx,10);
|
||||
mopPutChar (pkt,idx,(timenow->tm_year / 100) + 19);
|
||||
mopPutChar (pkt,idx,(timenow->tm_year % 100));
|
||||
mopPutChar (pkt,idx,(timenow->tm_mon + 1));
|
||||
mopPutChar (pkt,idx,(timenow->tm_mday));
|
||||
mopPutChar (pkt,idx,(timenow->tm_hour));
|
||||
mopPutChar (pkt,idx,(timenow->tm_min));
|
||||
mopPutChar (pkt,idx,(timenow->tm_sec));
|
||||
mopPutChar (pkt,idx,0x00);
|
||||
mopPutChar (pkt,idx,0x00);
|
||||
mopPutChar (pkt,idx,0x00);
|
||||
}
|
||||
|
||||
void
|
||||
mopPutHeader(pkt, index, dst, src, proto, trans)
|
||||
mopPutHeader(pkt, idx, dst, src, proto, trans)
|
||||
u_char *pkt;
|
||||
int *index;
|
||||
int *idx;
|
||||
u_char dst[], src[];
|
||||
u_short proto;
|
||||
int trans;
|
||||
{
|
||||
|
||||
mopPutMulti(pkt, index, dst, 6);
|
||||
mopPutMulti(pkt, index, src, 6);
|
||||
mopPutMulti(pkt, idx, dst, 6);
|
||||
mopPutMulti(pkt, idx, src, 6);
|
||||
if (trans == TRANS_8023) {
|
||||
mopPutShort(pkt, index, 0);
|
||||
mopPutChar (pkt, index, MOP_K_PROTO_802_DSAP);
|
||||
mopPutChar (pkt, index, MOP_K_PROTO_802_SSAP);
|
||||
mopPutChar (pkt, index, MOP_K_PROTO_802_CNTL);
|
||||
mopPutChar (pkt, index, 0x08);
|
||||
mopPutChar (pkt, index, 0x00);
|
||||
mopPutChar (pkt, index, 0x2b);
|
||||
mopPutShort(pkt, idx, 0);
|
||||
mopPutChar (pkt, idx, MOP_K_PROTO_802_DSAP);
|
||||
mopPutChar (pkt, idx, MOP_K_PROTO_802_SSAP);
|
||||
mopPutChar (pkt, idx, MOP_K_PROTO_802_CNTL);
|
||||
mopPutChar (pkt, idx, 0x08);
|
||||
mopPutChar (pkt, idx, 0x00);
|
||||
mopPutChar (pkt, idx, 0x2b);
|
||||
}
|
||||
#if !defined(__FreeBSD__)
|
||||
mopPutChar(pkt, index, (proto / 256));
|
||||
mopPutChar(pkt, index, (proto % 256));
|
||||
mopPutChar(pkt, idx, (proto / 256));
|
||||
mopPutChar(pkt, idx, (proto % 256));
|
||||
#else
|
||||
if (trans == TRANS_8023) {
|
||||
mopPutChar(pkt, index, (proto / 256));
|
||||
mopPutChar(pkt, index, (proto % 256));
|
||||
mopPutChar(pkt, idx, (proto / 256));
|
||||
mopPutChar(pkt, idx, (proto % 256));
|
||||
} else {
|
||||
mopPutChar(pkt, index, (proto % 256));
|
||||
mopPutChar(pkt, index, (proto / 256));
|
||||
mopPutChar(pkt, idx, (proto % 256));
|
||||
mopPutChar(pkt, idx, (proto / 256));
|
||||
}
|
||||
#endif
|
||||
if (trans == TRANS_ETHER)
|
||||
mopPutShort(pkt, index, 0);
|
||||
mopPutShort(pkt, idx, 0);
|
||||
|
||||
}
|
||||
|
||||
@@ -162,22 +163,22 @@ mopPutLength(pkt, trans, len)
|
||||
int trans;
|
||||
u_short len;
|
||||
{
|
||||
int index = 0;
|
||||
int idx = 0;
|
||||
|
||||
switch(trans) {
|
||||
case TRANS_ETHER:
|
||||
index = 14;
|
||||
mopPutChar(pkt, &index, ((len - 16) % 256));
|
||||
mopPutChar(pkt, &index, ((len - 16) / 256));
|
||||
idx = 14;
|
||||
mopPutChar(pkt, &idx, ((len - 16) % 256));
|
||||
mopPutChar(pkt, &idx, ((len - 16) / 256));
|
||||
break;
|
||||
case TRANS_8023:
|
||||
index = 12;
|
||||
idx = 12;
|
||||
#if !defined(__FreeBSD__)
|
||||
mopPutChar(pkt, &index, ((len - 14) / 256));
|
||||
mopPutChar(pkt, &index, ((len - 14) % 256));
|
||||
mopPutChar(pkt, &idx, ((len - 14) / 256));
|
||||
mopPutChar(pkt, &idx, ((len - 14) % 256));
|
||||
#else
|
||||
mopPutChar(pkt, &index, ((len - 14) % 256));
|
||||
mopPutChar(pkt, &index, ((len - 14) / 256));
|
||||
mopPutChar(pkt, &idx, ((len - 14) % 256));
|
||||
mopPutChar(pkt, &idx, ((len - 14) / 256));
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: put.h,v 1.3 1997/10/16 23:25:03 lukem Exp $ */
|
||||
/* $NetBSD: put.h,v 1.4 2009/04/17 04:16:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
|
||||
@@ -28,7 +28,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: put.h,v 1.3 1997/10/16 23:25:03 lukem Exp $
|
||||
* $NetBSD: put.h,v 1.4 2009/04/17 04:16:57 lukem Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,7 @@ __BEGIN_DECLS
|
||||
void mopPutChar __P((u_char *, int *, u_char));
|
||||
void mopPutShort __P((u_char *, int *, u_short));
|
||||
void mopPutLong __P((u_char *, int *, u_int32_t));
|
||||
void mopPutMulti __P((u_char *, int *, u_char *, int));
|
||||
void mopPutMulti __P((u_char *, int *, const u_char *, int));
|
||||
void mopPutTime __P((u_char *, int *, time_t));
|
||||
void mopPutHeader __P((u_char *, int *, u_char *, u_char *, u_short, int));
|
||||
void mopPutLength __P((u_char *, int, u_short));
|
||||
|
||||
92
common/rc.c
92
common/rc.c
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rc.c,v 1.3 1997/10/16 23:25:04 lukem Exp $ */
|
||||
/* $NetBSD: rc.c,v 1.4 2009/04/17 04:16:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: rc.c,v 1.3 1997/10/16 23:25:04 lukem Exp $");
|
||||
__RCSID("$NetBSD: rc.c,v 1.4 2009/04/17 04:16:57 lukem Exp $");
|
||||
#endif
|
||||
|
||||
#include "os.h"
|
||||
@@ -46,7 +46,7 @@ mopDumpRC(fd, pkt, trans)
|
||||
u_char *pkt;
|
||||
int trans;
|
||||
{
|
||||
int i,index = 0;
|
||||
int i,idx = 0;
|
||||
int32_t tmpl;
|
||||
u_char tmpc,code,control;
|
||||
u_short len,tmps,moplen;
|
||||
@@ -55,40 +55,40 @@ mopDumpRC(fd, pkt, trans)
|
||||
|
||||
switch (trans) {
|
||||
case TRANS_8023:
|
||||
index = 22;
|
||||
idx = 22;
|
||||
moplen = len - 8;
|
||||
break;
|
||||
default:
|
||||
index = 16;
|
||||
idx = 16;
|
||||
moplen = len;
|
||||
}
|
||||
code = mopGetChar(pkt,&index);
|
||||
code = mopGetChar(pkt,&idx);
|
||||
|
||||
switch (code) {
|
||||
case MOP_K_CODE_RID:
|
||||
|
||||
tmpc = mopGetChar(pkt,&index);
|
||||
tmpc = mopGetChar(pkt,&idx);
|
||||
(void)fprintf(fd,"Reserved : %02x\n",tmpc);
|
||||
|
||||
tmps = mopGetShort(pkt,&index);
|
||||
tmps = mopGetShort(pkt,&idx);
|
||||
(void)fprintf(fd,"Receipt Nbr : %04x\n",tmps);
|
||||
|
||||
break;
|
||||
case MOP_K_CODE_BOT:
|
||||
|
||||
if ((moplen == 5)) {
|
||||
tmps = mopGetShort(pkt,&index);
|
||||
tmps = mopGetShort(pkt,&idx);
|
||||
(void)fprintf(fd,"Verification : %04x\n",tmps);
|
||||
} else {
|
||||
|
||||
tmpl = mopGetLong(pkt,&index);
|
||||
tmpl = mopGetLong(pkt,&idx);
|
||||
(void)fprintf(fd,"Verification : %08x\n",tmpl);
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Processor */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Processor */
|
||||
(void)fprintf(fd,"Processor : %02x ",tmpc);
|
||||
mopPrintBPTY(fd, tmpc); (void)fprintf(fd, "\n");
|
||||
|
||||
control = mopGetChar(pkt,&index); /* Control */
|
||||
control = mopGetChar(pkt,&idx); /* Control */
|
||||
(void)fprintf(fd,"Control : %02x ",control);
|
||||
if ((control & (1>>MOP_K_BOT_CNTL_SERVER))) {
|
||||
(void)fprintf(fd,
|
||||
@@ -107,17 +107,17 @@ mopDumpRC(fd, pkt, trans)
|
||||
(void)fprintf(fd,"\n");
|
||||
|
||||
if ((control & (1>>MOP_K_BOT_CNTL_DEVICE))) {
|
||||
tmpc = mopGetChar(pkt,&index);/* Device ID */
|
||||
tmpc = mopGetChar(pkt,&idx);/* Device ID */
|
||||
(void)fprintf(fd,
|
||||
"Device ID : %02x '",tmpc);
|
||||
for (i = 0; i < ((int) tmpc); i++) {
|
||||
(void)fprintf(fd,"%c",
|
||||
mopGetChar(pkt,&index));
|
||||
mopGetChar(pkt,&idx));
|
||||
}
|
||||
(void)fprintf(fd,"'\n");
|
||||
}
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Software ID */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Software ID */
|
||||
(void)fprintf(fd,"Software ID : %02x ",tmpc);
|
||||
if ((tmpc == 0)) {
|
||||
(void)fprintf(fd,"No software id");
|
||||
@@ -134,7 +134,7 @@ mopDumpRC(fd, pkt, trans)
|
||||
(void)fprintf(fd,"'");
|
||||
for (i = 0; i < ((int) tmpc); i++) {
|
||||
(void)fprintf(fd,"%c",
|
||||
mopGetChar(pkt,&index));
|
||||
mopGetChar(pkt,&idx));
|
||||
}
|
||||
(void)fprintf(fd,"'");
|
||||
}
|
||||
@@ -144,60 +144,60 @@ mopDumpRC(fd, pkt, trans)
|
||||
break;
|
||||
case MOP_K_CODE_SID:
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Reserved */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Reserved */
|
||||
(void)fprintf(fd, "Reserved : %02x\n",tmpc);
|
||||
|
||||
tmps = mopGetShort(pkt,&index); /* Receipt # */
|
||||
tmps = mopGetShort(pkt,&idx); /* Receipt # */
|
||||
(void)fprintf(fd, "Receipt Nbr : %04x\n",tmpc);
|
||||
|
||||
mopPrintInfo(fd, pkt, &index, moplen, code, trans);
|
||||
mopPrintInfo(fd, pkt, &idx, moplen, code, trans);
|
||||
|
||||
break;
|
||||
case MOP_K_CODE_RQC:
|
||||
|
||||
tmps = mopGetShort(pkt,&index);
|
||||
tmps = mopGetShort(pkt,&idx);
|
||||
(void)fprintf(fd,"Receipt Nbr : %04x\n",tmps);
|
||||
|
||||
break;
|
||||
case MOP_K_CODE_CNT:
|
||||
|
||||
tmps = mopGetShort(pkt,&index);
|
||||
tmps = mopGetShort(pkt,&idx);
|
||||
(void)fprintf(fd,"Receipt Nbr : %04x %d\n",tmps,tmps);
|
||||
|
||||
tmps = mopGetShort(pkt,&index);
|
||||
tmps = mopGetShort(pkt,&idx);
|
||||
(void)fprintf(fd,"Last Zeroed : %04x %d\n",tmps,tmps);
|
||||
|
||||
tmpl = mopGetLong(pkt,&index);
|
||||
tmpl = mopGetLong(pkt,&idx);
|
||||
(void)fprintf(fd,"Bytes rec : %08x %d\n",tmpl,tmpl);
|
||||
|
||||
tmpl = mopGetLong(pkt,&index);
|
||||
tmpl = mopGetLong(pkt,&idx);
|
||||
(void)fprintf(fd,"Bytes snd : %08x %d\n",tmpl,tmpl);
|
||||
|
||||
tmpl = mopGetLong(pkt,&index);
|
||||
tmpl = mopGetLong(pkt,&idx);
|
||||
(void)fprintf(fd,"Frames rec : %08x %d\n",tmpl,tmpl);
|
||||
|
||||
tmpl = mopGetLong(pkt,&index);
|
||||
tmpl = mopGetLong(pkt,&idx);
|
||||
(void)fprintf(fd,"Frames snd : %08x %d\n",tmpl,tmpl);
|
||||
|
||||
tmpl = mopGetLong(pkt,&index);
|
||||
tmpl = mopGetLong(pkt,&idx);
|
||||
(void)fprintf(fd,"Mcst Bytes re: %08x %d\n",tmpl,tmpl);
|
||||
|
||||
tmpl = mopGetLong(pkt,&index);
|
||||
tmpl = mopGetLong(pkt,&idx);
|
||||
(void)fprintf(fd,"Mcst Frame re: %08x %d\n",tmpl,tmpl);
|
||||
|
||||
tmpl = mopGetLong(pkt,&index);
|
||||
tmpl = mopGetLong(pkt,&idx);
|
||||
(void)fprintf(fd,"Frame snd,def: %08x %d\n",tmpl,tmpl);
|
||||
|
||||
tmpl = mopGetLong(pkt,&index);
|
||||
tmpl = mopGetLong(pkt,&idx);
|
||||
(void)fprintf(fd,"Frame snd,col: %08x %d\n",tmpl,tmpl);
|
||||
|
||||
tmpl = mopGetLong(pkt,&index);
|
||||
tmpl = mopGetLong(pkt,&idx);
|
||||
(void)fprintf(fd,"Frame snd,mcl: %08x %d\n",tmpl,tmpl);
|
||||
|
||||
tmps = mopGetShort(pkt,&index);
|
||||
tmps = mopGetShort(pkt,&idx);
|
||||
(void)fprintf(fd,"Snd failure : %04x %d\n",tmps,tmps);
|
||||
|
||||
tmps = mopGetShort(pkt,&index);
|
||||
tmps = mopGetShort(pkt,&idx);
|
||||
(void)fprintf(fd,"Snd fail reas: %04x ",tmps);
|
||||
if ((tmps & 1)) (void)fprintf(fd,"Excess col ");
|
||||
if ((tmps & 2)) (void)fprintf(fd,"Carrier chk fail ");
|
||||
@@ -207,32 +207,32 @@ mopDumpRC(fd, pkt, trans)
|
||||
if ((tmps & 32)) (void)fprintf(fd,"Rem fail to defer ");
|
||||
(void)fprintf(fd,"\n");
|
||||
|
||||
tmps = mopGetShort(pkt,&index);
|
||||
tmps = mopGetShort(pkt,&idx);
|
||||
(void)fprintf(fd,"Rec failure : %04x %d\n",tmps,tmps);
|
||||
|
||||
tmps = mopGetShort(pkt,&index);
|
||||
tmps = mopGetShort(pkt,&idx);
|
||||
(void)fprintf(fd,"Rec fail reas: %04x ",tmps);
|
||||
if ((tmps & 1)) (void)fprintf(fd,"Block chk err ");
|
||||
if ((tmps & 2)) (void)fprintf(fd,"Framing err ");
|
||||
if ((tmps & 4)) (void)fprintf(fd,"Frm to long ");
|
||||
(void)fprintf(fd,"\n");
|
||||
|
||||
tmps = mopGetShort(pkt,&index);
|
||||
tmps = mopGetShort(pkt,&idx);
|
||||
(void)fprintf(fd,"Unrec frm dst: %04x %d\n",tmps,tmps);
|
||||
|
||||
tmps = mopGetShort(pkt,&index);
|
||||
tmps = mopGetShort(pkt,&idx);
|
||||
(void)fprintf(fd,"Data overrun : %04x %d\n",tmps,tmps);
|
||||
|
||||
tmps = mopGetShort(pkt,&index);
|
||||
tmps = mopGetShort(pkt,&idx);
|
||||
(void)fprintf(fd,"Sys Buf Unava: %04x %d\n",tmps,tmps);
|
||||
|
||||
tmps = mopGetShort(pkt,&index);
|
||||
tmps = mopGetShort(pkt,&idx);
|
||||
(void)fprintf(fd,"Usr Buf Unava: %04x %d\n",tmps,tmps);
|
||||
|
||||
break;
|
||||
case MOP_K_CODE_RVC:
|
||||
|
||||
tmpl = mopGetLong(pkt,&index);
|
||||
tmpl = mopGetLong(pkt,&idx);
|
||||
(void)fprintf(fd,"Verification : %08x\n",tmpl);
|
||||
|
||||
break;
|
||||
@@ -243,7 +243,7 @@ mopDumpRC(fd, pkt, trans)
|
||||
break;
|
||||
case MOP_K_CODE_CCP:
|
||||
|
||||
tmpc = mopGetChar(pkt,&index);
|
||||
tmpc = mopGetChar(pkt,&idx);
|
||||
(void)fprintf(fd,
|
||||
"Control Flags: %02x Message %d ",tmpc,tmpc & 1);
|
||||
if ((tmpc & 2))
|
||||
@@ -264,21 +264,21 @@ mopDumpRC(fd, pkt, trans)
|
||||
}
|
||||
}
|
||||
(void)fprintf(fd,"%02x ",
|
||||
mopGetChar(pkt,&index));
|
||||
mopGetChar(pkt,&idx));
|
||||
if ((i % 16) == 15)
|
||||
(void)fprintf(fd,"\n");
|
||||
}
|
||||
if ((i % 16) != 15)
|
||||
(void)fprintf(fd,"\n");
|
||||
#else
|
||||
index = index + moplen - 2;
|
||||
idx = idx + moplen - 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
break;
|
||||
case MOP_K_CODE_CRA:
|
||||
|
||||
tmpc = mopGetChar(pkt,&index);
|
||||
tmpc = mopGetChar(pkt,&idx);
|
||||
(void)fprintf(fd,
|
||||
"Control Flags: %02x Message %d ",tmpc,tmpc & 1);
|
||||
if ((tmpc & 2))
|
||||
@@ -301,14 +301,14 @@ mopDumpRC(fd, pkt, trans)
|
||||
}
|
||||
}
|
||||
(void)fprintf(fd,"%02x ",
|
||||
mopGetChar(pkt,&index));
|
||||
mopGetChar(pkt,&idx));
|
||||
if ((i % 16) == 15)
|
||||
(void)fprintf(fd,"\n");
|
||||
}
|
||||
if ((i % 16) != 15)
|
||||
(void)fprintf(fd,"\n");
|
||||
#else
|
||||
index = index + moplen - 2;
|
||||
idx = idx + moplen - 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mopchk.c,v 1.10 2003/04/20 00:19:56 christos Exp $ */
|
||||
/* $NetBSD: mopchk.c,v 1.11 2009/04/17 04:16:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995-96 Mats O Jansson. All rights reserved.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: mopchk.c,v 1.10 2003/04/20 00:19:56 christos Exp $");
|
||||
__RCSID("$NetBSD: mopchk.c,v 1.11 2009/04/17 04:16:57 lukem Exp $");
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -73,7 +73,7 @@ main(argc, argv)
|
||||
int op, i;
|
||||
char *filename;
|
||||
struct if_info *ii;
|
||||
int err;
|
||||
int error;
|
||||
|
||||
mopInteractive = 1;
|
||||
|
||||
@@ -126,17 +126,17 @@ main(argc, argv)
|
||||
if (dl.ldfd == -1)
|
||||
printf("Unknown file.\n");
|
||||
else {
|
||||
if ((err = CheckElfFile(dl.ldfd)) == 0) {
|
||||
if ((error = CheckElfFile(dl.ldfd)) == 0) {
|
||||
if (GetElfFileInfo(&dl) < 0) {
|
||||
printf(
|
||||
"Some failure in GetElfFileInfo\n");
|
||||
}
|
||||
} else if ((err = CheckAOutFile(dl.ldfd)) == 0) {
|
||||
} else if ((error = CheckAOutFile(dl.ldfd)) == 0) {
|
||||
if (GetAOutFileInfo(&dl) < 0) {
|
||||
printf(
|
||||
"Some failure in GetAOutFileInfo\n");
|
||||
}
|
||||
} else if ((err = CheckMopFile(dl.ldfd)) == 0) {
|
||||
} else if ((error = CheckMopFile(dl.ldfd)) == 0) {
|
||||
if (GetMopFileInfo(&dl) < 0) {
|
||||
printf(
|
||||
"Some failure in GetMopFileInfo\n");
|
||||
|
||||
16
mopd/mopd.c
16
mopd/mopd.c
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mopd.c,v 1.10 2002/11/05 14:18:05 thorpej Exp $ */
|
||||
/* $NetBSD: mopd.c,v 1.11 2009/04/17 04:16:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993-96 Mats O Jansson. All rights reserved.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: mopd.c,v 1.10 2002/11/05 14:18:05 thorpej Exp $");
|
||||
__RCSID("$NetBSD: mopd.c,v 1.11 2009/04/17 04:16:57 lukem Exp $");
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -72,7 +72,7 @@ int VersionFlag = 0; /* print version */
|
||||
int Not3Flag = 0; /* Not MOP V3 messages. */
|
||||
int Not4Flag = 0; /* Not MOP V4 messages. */
|
||||
int promisc = 1; /* Need promisc mode */
|
||||
char *MopdDir = MOP_FILE_PATH; /* Path to mop directory */
|
||||
const char *MopdDir = MOP_FILE_PATH; /* Path to mop directory */
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
@@ -181,7 +181,7 @@ mopProcess(ii, pkt)
|
||||
{
|
||||
u_char *dst, *src;
|
||||
u_short ptype;
|
||||
int index, trans, len;
|
||||
int idx, trans, len;
|
||||
|
||||
/* We don't known with transport, Guess! */
|
||||
|
||||
@@ -192,8 +192,8 @@ mopProcess(ii, pkt)
|
||||
if ((trans == TRANS_ETHER) && Not3Flag) return;
|
||||
if ((trans == TRANS_8023) && Not4Flag) return;
|
||||
|
||||
index = 0;
|
||||
mopGetHeader(pkt, &index, &dst, &src, &ptype, &len, trans);
|
||||
idx = 0;
|
||||
mopGetHeader(pkt, &idx, &dst, &src, &ptype, &len, trans);
|
||||
|
||||
/*
|
||||
* Ignore our own transmissions
|
||||
@@ -204,10 +204,10 @@ mopProcess(ii, pkt)
|
||||
|
||||
switch(ptype) {
|
||||
case MOP_K_PROTO_DL:
|
||||
mopProcessDL(stdout, ii, pkt, &index, dst, src, trans, len);
|
||||
mopProcessDL(stdout, ii, pkt, &idx, dst, src, trans, len);
|
||||
break;
|
||||
case MOP_K_PROTO_RC:
|
||||
mopProcessRC(stdout, ii, pkt, &index, dst, src, trans, len);
|
||||
mopProcessRC(stdout, ii, pkt, &idx, dst, src, trans, len);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
198
mopd/process.c
198
mopd/process.c
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: process.c,v 1.14 2006/05/12 01:54:32 mrg Exp $ */
|
||||
/* $NetBSD: process.c,v 1.15 2009/04/17 04:16:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: process.c,v 1.14 2006/05/12 01:54:32 mrg Exp $");
|
||||
__RCSID("$NetBSD: process.c,v 1.15 2009/04/17 04:16:57 lukem Exp $");
|
||||
#endif
|
||||
|
||||
#include "os.h"
|
||||
@@ -63,9 +63,9 @@ void mopSendASV __P((u_char *, u_char *, struct if_info *, int));
|
||||
void mopStartLoad __P((u_char *, u_char *, struct dllist *, int));
|
||||
|
||||
void
|
||||
mopProcessInfo(pkt, index, moplen, dl_rpr, trans)
|
||||
mopProcessInfo(pkt, idx, moplen, dl_rpr, trans)
|
||||
u_char *pkt;
|
||||
int *index;
|
||||
int *idx;
|
||||
u_short moplen;
|
||||
struct dllist *dl_rpr;
|
||||
int trans;
|
||||
@@ -85,56 +85,56 @@ mopProcessInfo(pkt, index, moplen, dl_rpr, trans)
|
||||
break;
|
||||
}
|
||||
|
||||
itype = mopGetShort(pkt,index);
|
||||
itype = mopGetShort(pkt,idx);
|
||||
|
||||
while (*index < (int)(moplen)) {
|
||||
ilen = mopGetChar(pkt,index);
|
||||
while (*idx < (int)(moplen)) {
|
||||
ilen = mopGetChar(pkt,idx);
|
||||
switch (itype) {
|
||||
case 0:
|
||||
tmpc = mopGetChar(pkt,index);
|
||||
*index = *index + tmpc;
|
||||
tmpc = mopGetChar(pkt,idx);
|
||||
*idx = *idx + tmpc;
|
||||
break;
|
||||
case MOP_K_INFO_VER:
|
||||
uc1 = mopGetChar(pkt,index);
|
||||
uc2 = mopGetChar(pkt,index);
|
||||
uc3 = mopGetChar(pkt,index);
|
||||
uc1 = mopGetChar(pkt,idx);
|
||||
uc2 = mopGetChar(pkt,idx);
|
||||
uc3 = mopGetChar(pkt,idx);
|
||||
break;
|
||||
case MOP_K_INFO_MFCT:
|
||||
tmps = mopGetShort(pkt,index);
|
||||
tmps = mopGetShort(pkt,idx);
|
||||
break;
|
||||
case MOP_K_INFO_CNU:
|
||||
ucp = pkt + *index; *index = *index + 6;
|
||||
ucp = pkt + *idx; *idx = *idx + 6;
|
||||
break;
|
||||
case MOP_K_INFO_RTM:
|
||||
tmps = mopGetShort(pkt,index);
|
||||
tmps = mopGetShort(pkt,idx);
|
||||
break;
|
||||
case MOP_K_INFO_CSZ:
|
||||
tmps = mopGetShort(pkt,index);
|
||||
tmps = mopGetShort(pkt,idx);
|
||||
break;
|
||||
case MOP_K_INFO_RSZ:
|
||||
tmps = mopGetShort(pkt,index);
|
||||
tmps = mopGetShort(pkt,idx);
|
||||
break;
|
||||
case MOP_K_INFO_HWA:
|
||||
ucp = pkt + *index; *index = *index + 6;
|
||||
ucp = pkt + *idx; *idx = *idx + 6;
|
||||
break;
|
||||
case MOP_K_INFO_TIME:
|
||||
ucp = pkt + *index; *index = *index + 10;
|
||||
ucp = pkt + *idx; *idx = *idx + 10;
|
||||
break;
|
||||
case MOP_K_INFO_SOFD:
|
||||
device = mopGetChar(pkt,index);
|
||||
device = mopGetChar(pkt,idx);
|
||||
break;
|
||||
case MOP_K_INFO_SFID:
|
||||
tmpc = mopGetChar(pkt,index);
|
||||
ucp = pkt + *index; *index = *index + tmpc;
|
||||
tmpc = mopGetChar(pkt,idx);
|
||||
ucp = pkt + *idx; *idx = *idx + tmpc;
|
||||
break;
|
||||
case MOP_K_INFO_PRTY:
|
||||
tmpc = mopGetChar(pkt,index);
|
||||
tmpc = mopGetChar(pkt,idx);
|
||||
break;
|
||||
case MOP_K_INFO_DLTY:
|
||||
tmpc = mopGetChar(pkt,index);
|
||||
tmpc = mopGetChar(pkt,idx);
|
||||
break;
|
||||
case MOP_K_INFO_DLBSZ:
|
||||
tmps = mopGetShort(pkt,index);
|
||||
tmps = mopGetShort(pkt,idx);
|
||||
dl_rpr->dl_bsz = tmps;
|
||||
break;
|
||||
default:
|
||||
@@ -146,30 +146,30 @@ mopProcessInfo(pkt, index, moplen, dl_rpr, trans)
|
||||
{
|
||||
switch (itype) {
|
||||
case 102:
|
||||
ucp = pkt + *index;
|
||||
*index = *index + ilen;
|
||||
ucp = pkt + *idx;
|
||||
*idx = *idx + ilen;
|
||||
break;
|
||||
case 103:
|
||||
ucp = pkt + *index;
|
||||
*index = *index + ilen;
|
||||
ucp = pkt + *idx;
|
||||
*idx = *idx + ilen;
|
||||
break;
|
||||
case 104:
|
||||
tmps = mopGetShort(pkt,index);
|
||||
tmps = mopGetShort(pkt,idx);
|
||||
break;
|
||||
case 105:
|
||||
ucp = pkt + *index;
|
||||
*index = *index + ilen;
|
||||
ucp = pkt + *idx;
|
||||
*idx = *idx + ilen;
|
||||
break;
|
||||
case 106:
|
||||
ucp = pkt + *index;
|
||||
*index = *index + ilen;
|
||||
ucp = pkt + *idx;
|
||||
*idx = *idx + ilen;
|
||||
break;
|
||||
};
|
||||
} else {
|
||||
ucp = pkt + *index; *index = *index + ilen;
|
||||
ucp = pkt + *idx; *idx = *idx + ilen;
|
||||
};
|
||||
}
|
||||
itype = mopGetShort(pkt,index);
|
||||
itype = mopGetShort(pkt,idx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,17 +180,17 @@ mopSendASV(dst, src, ii, trans)
|
||||
int trans;
|
||||
{
|
||||
u_char pkt[200], *p;
|
||||
int index;
|
||||
int idx;
|
||||
u_char mopcode = MOP_K_CODE_ASV;
|
||||
u_short newlen = 0,ptype = MOP_K_PROTO_DL;
|
||||
|
||||
index = 0;
|
||||
mopPutHeader(pkt, &index, dst, src, ptype, trans);
|
||||
idx = 0;
|
||||
mopPutHeader(pkt, &idx, dst, src, ptype, trans);
|
||||
|
||||
p = &pkt[index];
|
||||
mopPutChar(pkt,&index,mopcode);
|
||||
p = &pkt[idx];
|
||||
mopPutChar(pkt,&idx,mopcode);
|
||||
|
||||
mopPutLength(pkt, trans, index);
|
||||
mopPutLength(pkt, trans, idx);
|
||||
newlen = mopGetLength(pkt, trans);
|
||||
|
||||
if ((DebugFlag == DEBUG_ONELINE)) {
|
||||
@@ -206,7 +206,7 @@ mopSendASV(dst, src, ii, trans)
|
||||
mopDumpDL(stdout, pkt, trans);
|
||||
}
|
||||
|
||||
if (pfWrite(ii->fd, pkt, index, trans) != index) {
|
||||
if (pfWrite(ii->fd, pkt, idx, trans) != idx) {
|
||||
if (DebugFlag) {
|
||||
(void)fprintf(stderr, "error pfWrite()\n");
|
||||
}
|
||||
@@ -224,7 +224,7 @@ mopStartLoad(dst, src, dl_rpr, trans)
|
||||
int len;
|
||||
int i, slot;
|
||||
u_char pkt[BUFSIZE], *p;
|
||||
int index;
|
||||
int idx;
|
||||
u_char mopcode = MOP_K_CODE_MLD;
|
||||
u_short newlen,ptype = MOP_K_PROTO_DL;
|
||||
struct dllist *dle;
|
||||
@@ -284,20 +284,20 @@ mopStartLoad(dst, src, dl_rpr, trans)
|
||||
if (trans == TRANS_8023)
|
||||
dle->dl_bsz = dle->dl_bsz - 8;
|
||||
|
||||
index = 0;
|
||||
mopPutHeader(pkt, &index, dst, src, ptype, trans);
|
||||
p = &pkt[index];
|
||||
mopPutChar (pkt, &index, mopcode);
|
||||
idx = 0;
|
||||
mopPutHeader(pkt, &idx, dst, src, ptype, trans);
|
||||
p = &pkt[idx];
|
||||
mopPutChar (pkt, &idx, mopcode);
|
||||
|
||||
mopPutChar (pkt, &index, dle->count);
|
||||
mopPutLong (pkt, &index, dle->loadaddr);
|
||||
mopPutChar (pkt, &idx, dle->count);
|
||||
mopPutLong (pkt, &idx, dle->loadaddr);
|
||||
|
||||
len = mopFileRead(dle, &pkt[index]);
|
||||
len = mopFileRead(dle, &pkt[idx]);
|
||||
|
||||
dle->nloadaddr = dle->loadaddr + len;
|
||||
index = index + len;
|
||||
idx = idx + len;
|
||||
|
||||
mopPutLength(pkt, trans, index);
|
||||
mopPutLength(pkt, trans, idx);
|
||||
newlen = mopGetLength(pkt, trans);
|
||||
|
||||
if ((DebugFlag == DEBUG_ONELINE)) {
|
||||
@@ -313,7 +313,7 @@ mopStartLoad(dst, src, dl_rpr, trans)
|
||||
mopDumpDL(stdout, pkt, trans);
|
||||
}
|
||||
|
||||
if (pfWrite(dle->ii->fd, pkt, index, trans) != index) {
|
||||
if (pfWrite(dle->ii->fd, pkt, idx, trans) != idx) {
|
||||
if (DebugFlag) {
|
||||
(void)fprintf(stderr, "error pfWrite()\n");
|
||||
}
|
||||
@@ -330,7 +330,7 @@ mopNextLoad(dst, src, new_count, trans)
|
||||
int len;
|
||||
int i, slot;
|
||||
u_char pkt[BUFSIZE], *p;
|
||||
int index, pindex;
|
||||
int idx, pindex;
|
||||
char line[100];
|
||||
u_short newlen = 0,ptype = MOP_K_PROTO_DL;
|
||||
u_char mopcode;
|
||||
@@ -375,43 +375,43 @@ mopNextLoad(dst, src, new_count, trans)
|
||||
if (dle->dl_bsz >= MAX_ETH_PAYLOAD)
|
||||
dle->dl_bsz = MAX_ETH_PAYLOAD;
|
||||
|
||||
index = 0;
|
||||
mopPutHeader(pkt, &index, dst, src, ptype, trans);
|
||||
p = &pkt[index];
|
||||
idx = 0;
|
||||
mopPutHeader(pkt, &idx, dst, src, ptype, trans);
|
||||
p = &pkt[idx];
|
||||
mopcode = MOP_K_CODE_MLD;
|
||||
pindex = index;
|
||||
mopPutChar (pkt,&index, mopcode);
|
||||
mopPutChar (pkt,&index, dle->count);
|
||||
mopPutLong (pkt,&index, dle->loadaddr);
|
||||
pindex = idx;
|
||||
mopPutChar (pkt,&idx, mopcode);
|
||||
mopPutChar (pkt,&idx, dle->count);
|
||||
mopPutLong (pkt,&idx, dle->loadaddr);
|
||||
|
||||
len = mopFileRead(dle, &pkt[index]);
|
||||
len = mopFileRead(dle, &pkt[idx]);
|
||||
|
||||
if (len > 0 ) {
|
||||
|
||||
dle->nloadaddr = dle->loadaddr + len;
|
||||
index = index + len;
|
||||
idx = idx + len;
|
||||
|
||||
mopPutLength(pkt, trans, index);
|
||||
mopPutLength(pkt, trans, idx);
|
||||
newlen = mopGetLength(pkt, trans);
|
||||
|
||||
} else {
|
||||
if (len == 0) {
|
||||
index = pindex;
|
||||
idx = pindex;
|
||||
mopcode = MOP_K_CODE_PLT;
|
||||
mopPutChar (pkt, &index, mopcode);
|
||||
mopPutChar (pkt, &index, dle->count);
|
||||
mopPutChar (pkt, &index, MOP_K_PLTP_HSN);
|
||||
mopPutChar (pkt, &index, 3);
|
||||
mopPutMulti(pkt, &index, "ipc", 3);
|
||||
mopPutChar (pkt, &index, MOP_K_PLTP_HSA);
|
||||
mopPutChar (pkt, &index, 6);
|
||||
mopPutMulti(pkt, &index, src, 6);
|
||||
mopPutChar (pkt, &index, MOP_K_PLTP_HST);
|
||||
mopPutTime (pkt, &index, 0);
|
||||
mopPutChar (pkt, &index, 0);
|
||||
mopPutLong (pkt, &index, dle->xferaddr);
|
||||
mopPutChar (pkt, &idx, mopcode);
|
||||
mopPutChar (pkt, &idx, dle->count);
|
||||
mopPutChar (pkt, &idx, MOP_K_PLTP_HSN);
|
||||
mopPutChar (pkt, &idx, 3);
|
||||
mopPutMulti(pkt, &idx, "ipc", 3);
|
||||
mopPutChar (pkt, &idx, MOP_K_PLTP_HSA);
|
||||
mopPutChar (pkt, &idx, 6);
|
||||
mopPutMulti(pkt, &idx, src, 6);
|
||||
mopPutChar (pkt, &idx, MOP_K_PLTP_HST);
|
||||
mopPutTime (pkt, &idx, 0);
|
||||
mopPutChar (pkt, &idx, 0);
|
||||
mopPutLong (pkt, &idx, dle->xferaddr);
|
||||
|
||||
mopPutLength(pkt, trans, index);
|
||||
mopPutLength(pkt, trans, idx);
|
||||
newlen = mopGetLength(pkt, trans);
|
||||
|
||||
dle->status = DL_STATUS_SENT_PLT;
|
||||
@@ -434,7 +434,7 @@ mopNextLoad(dst, src, new_count, trans)
|
||||
mopDumpDL(stdout, pkt, trans);
|
||||
}
|
||||
|
||||
if (pfWrite(dle->ii->fd, pkt, index, trans) != index) {
|
||||
if (pfWrite(dle->ii->fd, pkt, idx, trans) != idx) {
|
||||
if (DebugFlag) {
|
||||
(void)fprintf(stderr, "error pfWrite()\n");
|
||||
}
|
||||
@@ -442,11 +442,11 @@ mopNextLoad(dst, src, new_count, trans)
|
||||
}
|
||||
|
||||
void
|
||||
mopProcessDL(fd, ii, pkt, index, dst, src, trans, len)
|
||||
mopProcessDL(fd, ii, pkt, idx, dst, src, trans, len)
|
||||
FILE *fd;
|
||||
struct if_info *ii;
|
||||
u_char *pkt;
|
||||
int *index;
|
||||
int *idx;
|
||||
u_char *dst, *src;
|
||||
int trans;
|
||||
u_short len;
|
||||
@@ -474,7 +474,7 @@ mopProcessDL(fd, ii, pkt, index, dst, src, trans, len)
|
||||
}
|
||||
|
||||
moplen = mopGetLength(pkt, trans);
|
||||
mopcode = mopGetChar(pkt,index);
|
||||
mopcode = mopGetChar(pkt,idx);
|
||||
|
||||
switch (mopcode) {
|
||||
case MOP_K_CODE_MLT:
|
||||
@@ -489,9 +489,9 @@ mopProcessDL(fd, ii, pkt, index, dst, src, trans, len)
|
||||
break;
|
||||
case MOP_K_CODE_RPR:
|
||||
|
||||
tmpc = mopGetChar(pkt,index); /* Device Type */
|
||||
tmpc = mopGetChar(pkt,idx); /* Device Type */
|
||||
|
||||
tmpc = mopGetChar(pkt,index); /* Format Version */
|
||||
tmpc = mopGetChar(pkt,idx); /* Format Version */
|
||||
if ((tmpc != MOP_K_RPR_FORMAT) &&
|
||||
(tmpc != MOP_K_RPR_FORMAT_V3)) {
|
||||
(void)fprintf(stderr,"mopd: Unknown RPR Format (%d) from ",tmpc);
|
||||
@@ -499,13 +499,13 @@ mopProcessDL(fd, ii, pkt, index, dst, src, trans, len)
|
||||
(void)fprintf(stderr,"\n");
|
||||
}
|
||||
|
||||
rpr_pgty = mopGetChar(pkt,index); /* Program Type */
|
||||
rpr_pgty = mopGetChar(pkt,idx); /* Program Type */
|
||||
|
||||
tmpc = mopGetChar(pkt,index); /* Software ID Len */
|
||||
tmpc = mopGetChar(pkt,idx); /* Software ID Len */
|
||||
if (tmpc > sizeof(pfile) - 1)
|
||||
return;
|
||||
for (i = 0; i < tmpc; i++) {
|
||||
pfile[i] = mopGetChar(pkt,index);
|
||||
pfile[i] = mopGetChar(pkt,idx);
|
||||
pfile[i+1] = '\0';
|
||||
}
|
||||
|
||||
@@ -522,14 +522,14 @@ mopProcessDL(fd, ii, pkt, index, dst, src, trans, len)
|
||||
src[0],src[1],src[2],src[3],src[4],src[5],0);
|
||||
}
|
||||
|
||||
tmpc = mopGetChar(pkt,index); /* Processor */
|
||||
tmpc = mopGetChar(pkt,idx); /* Processor */
|
||||
|
||||
iindex = *index;
|
||||
iindex = *idx;
|
||||
dl_rpr = &dl;
|
||||
memset(dl_rpr, 0, sizeof(*dl_rpr));
|
||||
dl_rpr->ii = ii;
|
||||
memmove((char *)(dl_rpr->eaddr), (char *)src, 6);
|
||||
mopProcessInfo(pkt,index,moplen,dl_rpr,trans);
|
||||
mopProcessInfo(pkt,idx,moplen,dl_rpr,trans);
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/%s.SYS",
|
||||
MopdDir, pfile);
|
||||
@@ -563,9 +563,9 @@ mopProcessDL(fd, ii, pkt, index, dst, src, trans, len)
|
||||
break;
|
||||
case MOP_K_CODE_RML:
|
||||
|
||||
load = mopGetChar(pkt,index); /* Load Number */
|
||||
load = mopGetChar(pkt,idx); /* Load Number */
|
||||
|
||||
tmpc = mopGetChar(pkt,index); /* Error */
|
||||
tmpc = mopGetChar(pkt,idx); /* Error */
|
||||
|
||||
if ((mopCmpEAddr(dst,ii->eaddr) == 0)) {
|
||||
mopNextLoad(src, ii->eaddr, load, trans);
|
||||
@@ -586,11 +586,11 @@ mopProcessDL(fd, ii, pkt, index, dst, src, trans, len)
|
||||
}
|
||||
|
||||
void
|
||||
mopProcessRC(fd, ii, pkt, index, dst, src, trans, len)
|
||||
mopProcessRC(fd, ii, pkt, idx, dst, src, trans, len)
|
||||
FILE *fd;
|
||||
struct if_info *ii;
|
||||
u_char *pkt;
|
||||
int *index;
|
||||
int *idx;
|
||||
u_char *dst, *src;
|
||||
int trans;
|
||||
u_short len;
|
||||
@@ -614,7 +614,7 @@ mopProcessRC(fd, ii, pkt, index, dst, src, trans, len)
|
||||
}
|
||||
|
||||
moplen = mopGetLength(pkt, trans);
|
||||
mopcode = mopGetChar(pkt,index);
|
||||
mopcode = mopGetChar(pkt,idx);
|
||||
|
||||
switch (mopcode) {
|
||||
case MOP_K_CODE_RID:
|
||||
@@ -623,13 +623,13 @@ mopProcessRC(fd, ii, pkt, index, dst, src, trans, len)
|
||||
break;
|
||||
case MOP_K_CODE_SID:
|
||||
|
||||
tmpc = mopGetChar(pkt,index); /* Reserved */
|
||||
tmpc = mopGetChar(pkt,idx); /* Reserved */
|
||||
|
||||
if ((DebugFlag >= DEBUG_INFO)) {
|
||||
(void)fprintf(stderr, "Reserved : %02x\n",tmpc);
|
||||
}
|
||||
|
||||
tmps = mopGetShort(pkt,index); /* Receipt # */
|
||||
tmps = mopGetShort(pkt,idx); /* Receipt # */
|
||||
if ((DebugFlag >= DEBUG_INFO)) {
|
||||
(void)fprintf(stderr, "Receipt Nbr : %04x\n",tmpc);
|
||||
}
|
||||
@@ -638,7 +638,7 @@ mopProcessRC(fd, ii, pkt, index, dst, src, trans, len)
|
||||
memset(dl_rpr, 0, sizeof(*dl_rpr));
|
||||
dl_rpr->ii = ii;
|
||||
memmove((char *)(dl_rpr->eaddr), (char *)src, 6);
|
||||
mopProcessInfo(pkt,index,moplen,dl_rpr,trans);
|
||||
mopProcessInfo(pkt,idx,moplen,dl_rpr,trans);
|
||||
|
||||
break;
|
||||
case MOP_K_CODE_RQC:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mopprobe.c,v 1.8 2003/04/20 00:18:33 christos Exp $ */
|
||||
/* $NetBSD: mopprobe.c,v 1.9 2009/04/17 04:16:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993-96 Mats O Jansson. All rights reserved.
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: mopprobe.c,v 1.8 2003/04/20 00:18:33 christos Exp $");
|
||||
__RCSID("$NetBSD: mopprobe.c,v 1.9 2009/04/17 04:16:57 lukem Exp $");
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -139,12 +139,12 @@ mopProcess(ii, pkt)
|
||||
{
|
||||
u_char *dst, *src, *p, mopcode, tmpc, ilen;
|
||||
u_short *ptype, moplen, tmps, itype, len;
|
||||
int index, i, device, trans;
|
||||
int idx, i, device, trans;
|
||||
|
||||
dst = pkt;
|
||||
src = pkt+6;
|
||||
ptype = (u_short *)(pkt+12);
|
||||
index = 0;
|
||||
idx = 0;
|
||||
|
||||
if (*ptype < 1600) {
|
||||
len = *ptype;
|
||||
@@ -176,9 +176,9 @@ mopProcess(ii, pkt)
|
||||
moplen = len;
|
||||
break;
|
||||
default:
|
||||
moplen = mopGetShort(pkt,&index);
|
||||
moplen = mopGetShort(pkt,&idx);
|
||||
}
|
||||
mopcode = mopGetChar(p,&index);
|
||||
mopcode = mopGetChar(p,&idx);
|
||||
|
||||
/* Just process System Information */
|
||||
|
||||
@@ -186,60 +186,60 @@ mopProcess(ii, pkt)
|
||||
return;
|
||||
}
|
||||
|
||||
tmpc = mopGetChar(pkt,&index); /* Reserved */
|
||||
tmps = mopGetShort(pkt,&index); /* Receipt # */
|
||||
tmpc = mopGetChar(pkt,&idx); /* Reserved */
|
||||
tmps = mopGetShort(pkt,&idx); /* Receipt # */
|
||||
|
||||
device = 0; /* Unknown Device */
|
||||
|
||||
itype = mopGetShort(pkt,&index);
|
||||
itype = mopGetShort(pkt,&idx);
|
||||
|
||||
while (index < (int)(moplen + 2)) {
|
||||
ilen = mopGetChar(pkt,&index);
|
||||
while (idx < (int)(moplen + 2)) {
|
||||
ilen = mopGetChar(pkt,&idx);
|
||||
switch (itype) {
|
||||
case 0:
|
||||
tmpc = mopGetChar(pkt,&index);
|
||||
index = index + tmpc;
|
||||
tmpc = mopGetChar(pkt,&idx);
|
||||
idx = idx + tmpc;
|
||||
break;
|
||||
case MOP_K_INFO_VER:
|
||||
index = index + 3;
|
||||
idx = idx + 3;
|
||||
break;
|
||||
case MOP_K_INFO_MFCT:
|
||||
index = index + 2;
|
||||
idx = idx + 2;
|
||||
break;
|
||||
case MOP_K_INFO_CNU:
|
||||
index = index + 6;
|
||||
idx = idx + 6;
|
||||
break;
|
||||
case MOP_K_INFO_RTM:
|
||||
index = index + 2;
|
||||
idx = idx + 2;
|
||||
break;
|
||||
case MOP_K_INFO_CSZ:
|
||||
index = index + 2;
|
||||
idx = idx + 2;
|
||||
break;
|
||||
case MOP_K_INFO_RSZ:
|
||||
index = index + 2;
|
||||
idx = idx + 2;
|
||||
break;
|
||||
case MOP_K_INFO_HWA:
|
||||
index = index + 6;
|
||||
idx = idx + 6;
|
||||
break;
|
||||
case MOP_K_INFO_TIME:
|
||||
index = index + 10;
|
||||
idx = idx + 10;
|
||||
break;
|
||||
case MOP_K_INFO_SOFD:
|
||||
device = mopGetChar(pkt,&index);
|
||||
device = mopGetChar(pkt,&idx);
|
||||
break;
|
||||
case MOP_K_INFO_SFID:
|
||||
tmpc = mopGetChar(pkt,&index);
|
||||
if ((index > 0) && (index < 17))
|
||||
index = index + tmpc;
|
||||
tmpc = mopGetChar(pkt,&idx);
|
||||
if ((idx > 0) && (idx < 17))
|
||||
idx = idx + tmpc;
|
||||
break;
|
||||
case MOP_K_INFO_PRTY:
|
||||
index = index + 1;
|
||||
idx = idx + 1;
|
||||
break;
|
||||
case MOP_K_INFO_DLTY:
|
||||
index = index + 1;
|
||||
idx = idx + 1;
|
||||
break;
|
||||
case MOP_K_INFO_DLBSZ:
|
||||
index = index + 2;
|
||||
idx = idx + 2;
|
||||
break;
|
||||
default:
|
||||
if (((device = NMA_C_SOFD_LCS) || /* DECserver 100 */
|
||||
@@ -250,32 +250,32 @@ mopProcess(ii, pkt)
|
||||
{
|
||||
switch (itype) {
|
||||
case 102:
|
||||
index = index + ilen;
|
||||
idx = idx + ilen;
|
||||
break;
|
||||
case 103:
|
||||
index = index + ilen;
|
||||
idx = idx + ilen;
|
||||
break;
|
||||
case 104:
|
||||
index = index + 2;
|
||||
idx = idx + 2;
|
||||
break;
|
||||
case 105:
|
||||
(void)fprintf(stdout,"%x:%x:%x:%x:%x:%x\t",
|
||||
src[0],src[1],src[2],src[3],src[4],src[5]);
|
||||
for (i = 0; i < ilen; i++) {
|
||||
(void)fprintf(stdout, "%c",pkt[index+i]);
|
||||
(void)fprintf(stdout, "%c",pkt[idx+i]);
|
||||
}
|
||||
index = index + ilen;
|
||||
idx = idx + ilen;
|
||||
(void)fprintf(stdout, "\n");
|
||||
break;
|
||||
case 106:
|
||||
index = index + ilen;
|
||||
idx = idx + ilen;
|
||||
break;
|
||||
};
|
||||
} else {
|
||||
index = index + ilen;
|
||||
idx = idx + ilen;
|
||||
};
|
||||
}
|
||||
itype = mopGetShort(pkt,&index);
|
||||
itype = mopGetShort(pkt,&idx);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user