ANSIfy, sprinkle "const"

This commit is contained in:
drochner 2009-11-17 18:58:07 +00:00
parent f1a1ad338d
commit 86b474fa0d
20 changed files with 146 additions and 248 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmp.c,v 1.4 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: cmp.c,v 1.5 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -26,15 +26,14 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: cmp.c,v 1.4 2009/10/20 00:51:13 snj Exp $");
__RCSID("$NetBSD: cmp.c,v 1.5 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
#include "cmp.h"
int
mopCmpEAddr(addr1, addr2)
u_char *addr1, *addr2;
mopCmpEAddr(const u_char *addr1, const u_char *addr2)
{
return(memcmp((char *)addr1, (char *)addr2, 6));
return(memcmp(addr1, addr2, 6));
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmp.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: cmp.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -23,7 +23,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: cmp.h,v 1.5 2009/10/20 00:51:13 snj Exp $
* $NetBSD: cmp.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@ -31,7 +31,7 @@
#define _CMP_H_
__BEGIN_DECLS
int mopCmpEAddr __P((u_char *, u_char *));
int mopCmpEAddr __P((const u_char *, const u_char *));
__END_DECLS
#endif /* _CMP_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: common.h,v 1.7 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: common.h,v 1.8 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -23,7 +23,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: common.h,v 1.7 2009/10/20 00:51:13 snj Exp $
* $NetBSD: common.h,v 1.8 2009/11/17 18:58:07 drochner Exp $
*
*/
@ -53,9 +53,9 @@ struct if_info {
int trans; /* Transport type Ethernet/802.3 */
u_char eaddr[6]; /* Ethernet addr of this interface */
char if_name[IFNAME_SIZE]; /* Interface Name */
int (*iopen) __P((char *, int, u_short, int));
int (*iopen) __P((const char *, int, u_short, int));
/* Interface Open Routine */
int (*write) __P((int, u_char *, int, int));
int (*write) __P((int, const u_char *, int, int));
/* Interface Write Routine */
void (*read) __P((void)); /* Interface Read Routine */
struct if_info *next; /* Next Interface */

View File

@ -1,4 +1,4 @@
/* $NetBSD: device.c,v 1.10 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: device.c,v 1.11 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: device.c,v 1.10 2009/10/20 00:51:13 snj Exp $");
__RCSID("$NetBSD: device.c,v 1.11 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@ -38,7 +38,7 @@ __RCSID("$NetBSD: device.c,v 1.10 2009/10/20 00:51:13 snj Exp $");
struct if_info *iflist; /* Interface List */
void deviceOpen __P((char *, u_short, int));
void deviceOpen(const char *, u_short, int);
#ifdef DEV_NEW_CONF
/*
@ -46,9 +46,7 @@ void deviceOpen __P((char *, u_short, int));
*/
void
deviceEthAddr(ifname, eaddr)
char *ifname;
u_char *eaddr;
deviceEthAddr(const char *ifname, u_char *eaddr)
{
struct sockaddr_dl *sdl;
struct ifaddrs *ifap, *ifa;
@ -74,10 +72,7 @@ deviceEthAddr(ifname, eaddr)
#endif /* DEV_NEW_CONF */
void
deviceOpen(ifname, proto, trans)
char *ifname;
u_short proto;
int trans;
deviceOpen(const char *ifname, u_short proto, int trans)
{
struct if_info *p, tmp;
@ -127,8 +122,7 @@ deviceOpen(ifname, proto, trans)
}
void
deviceInitOne(ifname)
char *ifname;
deviceInitOne(const char *ifname)
{
char interface[IFNAME_SIZE];
struct if_info *p;

View File

@ -1,4 +1,4 @@
/* $NetBSD: device.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: device.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -23,7 +23,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: device.h,v 1.5 2009/10/20 00:51:13 snj Exp $
* $NetBSD: device.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@ -32,9 +32,9 @@
__BEGIN_DECLS
#ifdef DEV_NEW_CONF
void deviceEthAddr __P((char *, u_char *));
void deviceEthAddr __P((const char *, u_char *));
#endif
void deviceInitOne __P((char *));
void deviceInitOne __P((const char *));
void deviceInitAll __P((void));
/* from loop-bsd.c */

View File

@ -1,4 +1,4 @@
/* $NetBSD: dl.c,v 1.6 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: dl.c,v 1.7 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: dl.c,v 1.6 2009/10/20 00:51:13 snj Exp $");
__RCSID("$NetBSD: dl.c,v 1.7 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@ -36,14 +36,12 @@ __RCSID("$NetBSD: dl.c,v 1.6 2009/10/20 00:51:13 snj Exp $");
#include "print.h"
void
mopDumpDL(fd, pkt, trans)
FILE *fd;
u_char *pkt;
int trans;
mopDumpDL(FILE *fd, const u_char *pkt, int trans)
{
int i,idx = 0;
u_int32_t tmpl;
u_char tmpc,c,program[257],code,*ucp;
u_char tmpc,c,program[257],code;
const u_char *ucp;
u_short len,tmps,moplen;
len = mopGetLength(pkt, trans);

View File

@ -1,4 +1,4 @@
/* $NetBSD: dl.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: dl.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -23,7 +23,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: dl.h,v 1.5 2009/10/20 00:51:13 snj Exp $
* $NetBSD: dl.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@ -31,7 +31,7 @@
#define _DL_H_
__BEGIN_DECLS
void mopDumpDL __P((FILE *, u_char *, int));
void mopDumpDL __P((FILE *, const u_char *, int));
__END_DECLS
#endif /* _DL_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: get.c,v 1.5 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: get.c,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: get.c,v 1.5 2009/10/20 00:51:13 snj Exp $");
__RCSID("$NetBSD: get.c,v 1.6 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@ -34,9 +34,7 @@ __RCSID("$NetBSD: get.c,v 1.5 2009/10/20 00:51:13 snj Exp $");
#include "mopdef.h"
u_char
mopGetChar(pkt, idx)
u_char *pkt;
int *idx;
mopGetChar(const u_char *pkt, int *idx)
{
u_char ret;
@ -46,9 +44,7 @@ mopGetChar(pkt, idx)
}
u_short
mopGetShort(pkt, idx)
u_char *pkt;
int *idx;
mopGetShort(const u_char *pkt, int *idx)
{
u_short ret;
@ -58,9 +54,7 @@ mopGetShort(pkt, idx)
}
u_int32_t
mopGetLong(pkt, idx)
u_char *pkt;
int *idx;
mopGetLong(const u_char *pkt, int *idx)
{
u_int32_t ret;
@ -73,9 +67,7 @@ mopGetLong(pkt, idx)
}
void
mopGetMulti(pkt, idx, dest, size)
u_char *pkt,*dest;
int *idx,size;
mopGetMulti(const u_char *pkt, int *idx, u_char *dest, int size)
{
int i;
@ -87,14 +79,12 @@ mopGetMulti(pkt, idx, dest, size)
}
int
mopGetTrans(pkt, trans)
u_char *pkt;
int trans;
mopGetTrans(const u_char *pkt, int trans)
{
u_short *ptype;
const u_short *ptype;
if (trans == 0) {
ptype = (u_short *)(pkt+12);
ptype = (const u_short *)(pkt+12);
if (ntohs(*ptype) < 1600) {
trans = TRANS_8023;
} else {
@ -105,10 +95,8 @@ mopGetTrans(pkt, trans)
}
void
mopGetHeader(pkt, idx, dst, src, proto, len, trans)
u_char *pkt, **dst, **src;
int *idx, *len, trans;
u_short *proto;
mopGetHeader(const u_char *pkt, int *idx, const u_char **dst, const u_char **src,
u_short *proto, int *len, int trans)
{
*dst = pkt;
*src = pkt + 6;
@ -131,9 +119,7 @@ mopGetHeader(pkt, idx, dst, src, proto, len, trans)
}
u_short
mopGetLength(pkt, trans)
u_char *pkt;
int trans;
mopGetLength(const u_char *pkt, int trans)
{
switch(trans) {
case TRANS_ETHER:

View File

@ -1,4 +1,4 @@
/* $NetBSD: get.h,v 1.4 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: get.h,v 1.5 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -23,7 +23,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: get.h,v 1.4 2009/10/20 00:51:13 snj Exp $
* $NetBSD: get.h,v 1.5 2009/11/17 18:58:07 drochner Exp $
*
*/
@ -31,14 +31,14 @@
#define _GET_H_
__BEGIN_DECLS
u_char mopGetChar __P((u_char *, int *));
u_short mopGetShort __P((u_char *, int *));
u_int32_t mopGetLong __P((u_char *, int *));
void mopGetMulti __P((u_char *, int *, u_char *, int));
int mopGetTrans __P((u_char *, int));
void mopGetHeader __P((u_char *, int *, u_char **, u_char **,
u_char mopGetChar __P((const u_char *, int *));
u_short mopGetShort __P((const u_char *, int *));
u_int32_t mopGetLong __P((const u_char *, int *));
void mopGetMulti __P((const u_char *, int *, u_char *, int));
int mopGetTrans __P((const u_char *, int));
void mopGetHeader __P((const u_char *, int *, const u_char **, const u_char **,
u_short *, int *, int));
u_short mopGetLength __P((u_char *, int));
u_short mopGetLength __P((const u_char *, int));
__END_DECLS
#endif /* _GET_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pf.c,v 1.11 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: pf.c,v 1.12 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -32,7 +32,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: pf.c,v 1.11 2009/10/20 00:51:13 snj Exp $");
__RCSID("$NetBSD: pf.c,v 1.12 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@ -58,8 +58,7 @@ extern int promisc;
*/
int
pfTrans(interface)
char *interface;
pfTrans(const char *interface)
{
return TRANS_ETHER+TRANS_8023+TRANS_AND;
}
@ -69,10 +68,7 @@ pfTrans(interface)
*/
int
pfInit(interface, mode, protocol, typ)
char *interface;
u_short protocol;
int typ, mode;
pfInit(const char *interface, int mode, u_short protocol, int typ)
{
int fd;
struct ifreq ifr;
@ -150,9 +146,7 @@ pfInit(interface, mode, protocol, typ)
*/
int
pfAddMulti(s, interface, addr)
int s;
char *interface, *addr;
pfAddMulti(int s, const char *interface, const char *addr)
{
struct ifreq ifr;
int fd;
@ -185,9 +179,7 @@ pfAddMulti(s, interface, addr)
*/
int
pfDelMulti(s, interface, addr)
int s;
char *interface, *addr;
pfDelMulti(int s, const char *interface, const char *addr)
{
struct ifreq ifr;
int fd;
@ -220,9 +212,7 @@ pfDelMulti(s, interface, addr)
*/
int
pfRead(fd, buf, len)
int fd, len;
u_char *buf;
pfRead(int fd, u_char *buf, int len)
{
return(read(fd, buf, len));
}
@ -232,24 +222,22 @@ pfRead(fd, buf, len)
*/
int
pfWrite(fd, buf, len, trans)
int fd, len, trans;
u_char *buf;
pfWrite(int fd, const u_char *buf, int len, int trans)
{
struct iovec iov[2];
switch (trans) {
case TRANS_8023:
iov[0].iov_base = (caddr_t)buf;
iov[0].iov_base = (caddr_t)__UNCONST(buf);
iov[0].iov_len = 22;
iov[1].iov_base = (caddr_t)buf+22;
iov[1].iov_base = (caddr_t)__UNCONST(buf+22);
iov[1].iov_len = len-22;
break;
default:
iov[0].iov_base = (caddr_t)buf;
iov[0].iov_base = (caddr_t)__UNCONST(buf);
iov[0].iov_len = 14;
iov[1].iov_base = (caddr_t)buf+14;
iov[1].iov_base = (caddr_t)__UNCONST(buf+14);
iov[1].iov_len = len-14;
break;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pf.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: pf.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -23,7 +23,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: pf.h,v 1.5 2009/10/20 00:51:13 snj Exp $
* $NetBSD: pf.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@ -31,13 +31,13 @@
#define _PF_H_
__BEGIN_DECLS
int pfTrans __P((char *));
int pfInit __P((char *, int, u_short, int));
int pfTrans __P((const char *));
int pfInit __P((const char *, int, u_short, int));
int pfEthAddr __P((int, u_char *));
int pfAddMulti __P((int, char *, char *));
int pfDelMulti __P((int, char *, char *));
int pfAddMulti __P((int, const char *, const char *));
int pfDelMulti __P((int, const char *, const char *));
int pfRead __P((int, u_char *, int));
int pfWrite __P((int, u_char *, int, int));
int pfWrite __P((int, const u_char *, int, int));
__END_DECLS
#endif /* _PF_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: print.c,v 1.5 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: print.c,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-96 Mats O Jansson. All rights reserved.
@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: print.c,v 1.5 2009/10/20 00:51:13 snj Exp $");
__RCSID("$NetBSD: print.c,v 1.6 2009/11/17 18:58:07 drochner Exp $");
#endif
#include <sys/types.h>
@ -43,9 +43,7 @@ __RCSID("$NetBSD: print.c,v 1.5 2009/10/20 00:51:13 snj Exp $");
#define SHORT_PRINT
void
mopPrintHWA(fd, ap)
FILE *fd;
u_char *ap;
mopPrintHWA(FILE *fd, const u_char *ap)
{
(void)fprintf(fd, "%x:%x:%x:%x:%x:%x",
ap[0],ap[1],ap[2],ap[3],ap[4],ap[5]);
@ -58,9 +56,7 @@ mopPrintHWA(fd, ap)
}
void
mopPrintBPTY(fd, bpty)
FILE *fd;
u_char bpty;
mopPrintBPTY(FILE *fd, u_char bpty)
{
switch(bpty) {
case MOP_K_BPTY_SYS:
@ -76,9 +72,7 @@ mopPrintBPTY(fd, bpty)
};
void
mopPrintPGTY(fd, pgty)
FILE *fd;
u_char pgty;
mopPrintPGTY(FILE *fd, u_char pgty)
{
switch(pgty) {
case MOP_K_PGTY_SECLDR:
@ -100,13 +94,11 @@ mopPrintPGTY(fd, pgty)
}
void
mopPrintOneline(fd, pkt, trans)
FILE *fd;
u_char *pkt;
int trans;
mopPrintOneline(FILE *fd, const u_char *pkt, int trans)
{
int idx = 0;
u_char *dst, *src, code;
const u_char *dst, *src;
u_char code;
u_short proto;
int len;
@ -250,12 +242,9 @@ mopPrintOneline(fd, pkt, trans)
}
void
mopPrintHeader(fd, pkt, trans)
FILE *fd;
u_char *pkt;
int trans;
mopPrintHeader(FILE *fd, const u_char *pkt, int trans)
{
u_char *dst, *src;
const u_char *dst, *src;
u_short proto;
int len, idx = 0;
@ -314,12 +303,9 @@ mopPrintHeader(fd, pkt, trans)
}
void
mopPrintMopHeader(fd, pkt, trans)
FILE *fd;
u_char *pkt;
int trans;
mopPrintMopHeader(FILE *fd, const u_char *pkt, int trans)
{
u_char *dst, *src;
const u_char *dst, *src;
u_short proto;
int len, idx = 0;
u_char code;
@ -426,9 +412,7 @@ mopPrintMopHeader(fd, pkt, trans)
}
void
mopPrintDevice(fd, device)
FILE *fd;
u_char device;
mopPrintDevice(FILE *fd, u_char device)
{
const char *sname, *name;
@ -439,9 +423,7 @@ mopPrintDevice(fd, device)
}
void
mopPrintTime(fd, ap)
FILE *fd;
u_char *ap;
mopPrintTime(FILE *fd, const u_char *ap)
{
(void)fprintf(fd,
"%04d-%02d-%02d %02d:%02d:%02d.%02d %d:%02d",
@ -450,15 +432,13 @@ mopPrintTime(fd, ap)
}
void
mopPrintInfo(fd, pkt, idx, moplen, mopcode, trans)
FILE *fd;
u_char *pkt, mopcode;
int *idx, trans;
u_short moplen;
mopPrintInfo(FILE *fd, const u_char *pkt, int *idx,
u_short moplen, u_char mopcode, int trans)
{
u_short itype,tmps;
u_char ilen ,tmpc,device;
u_char uc1,uc2,uc3,*ucp;
u_char uc1,uc2,uc3;
const u_char *ucp;
int i;
device = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: print.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: print.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -23,7 +23,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: print.h,v 1.5 2009/10/20 00:51:13 snj Exp $
* $NetBSD: print.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@ -31,15 +31,15 @@
#define _PRINT_H_
__BEGIN_DECLS
void mopPrintHWA __P((FILE *, u_char *));
void mopPrintHWA __P((FILE *, const u_char *));
void mopPrintBPTY __P((FILE *, u_char));
void mopPrintPGTY __P((FILE *, u_char));
void mopPrintOneline __P((FILE *, u_char *, int));
void mopPrintHeader __P((FILE *, u_char *, int));
void mopPrintMopHeader __P((FILE *, u_char *, int));
void mopPrintOneline __P((FILE *, const u_char *, int));
void mopPrintHeader __P((FILE *, const u_char *, int));
void mopPrintMopHeader __P((FILE *, const u_char *, int));
void mopPrintDevice __P((FILE *, u_char));
void mopPrintTime __P((FILE *, u_char *));
void mopPrintInfo __P((FILE *, u_char *, int *, u_short,
void mopPrintTime __P((FILE *, const u_char *));
void mopPrintInfo __P((FILE *, const u_char *, int *, u_short,
u_char, int));
__END_DECLS

View File

@ -1,4 +1,4 @@
/* $NetBSD: put.c,v 1.5 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: put.c,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: put.c,v 1.5 2009/10/20 00:51:13 snj Exp $");
__RCSID("$NetBSD: put.c,v 1.6 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@ -34,20 +34,14 @@ __RCSID("$NetBSD: put.c,v 1.5 2009/10/20 00:51:13 snj Exp $");
#include "put.h"
void
mopPutChar(pkt, idx, value)
u_char *pkt;
int *idx;
u_char value;
mopPutChar(u_char *pkt, int *idx, u_char value)
{
pkt[*idx] = value;
*idx = *idx + 1;
}
void
mopPutShort(pkt, idx, value)
u_char *pkt;
int *idx;
u_short value;
mopPutShort(u_char *pkt, int *idx, u_short value)
{
int i;
for (i = 0; i < 2; i++) {
@ -58,10 +52,7 @@ mopPutShort(pkt, idx, value)
}
void
mopPutLong(pkt, idx, value)
u_char *pkt;
int *idx;
u_int32_t value;
mopPutLong(u_char *pkt, int *idx, u_int32_t value)
{
int i;
for (i = 0; i < 4; i++) {
@ -72,10 +63,7 @@ mopPutLong(pkt, idx, value)
}
void
mopPutMulti(pkt, idx, value, size)
u_char *pkt;
int *idx,size;
const u_char *value;
mopPutMulti(u_char *pkt, int *idx, const u_char *value, int size)
{
int i;
@ -86,10 +74,7 @@ mopPutMulti(pkt, idx, value, size)
}
void
mopPutTime(pkt, idx, value)
u_char *pkt;
int *idx;
time_t value;
mopPutTime(u_char *pkt, int *idx, time_t value)
{
time_t tnow;
struct tm *timenow;
@ -116,12 +101,8 @@ mopPutTime(pkt, idx, value)
}
void
mopPutHeader(pkt, idx, dst, src, proto, trans)
u_char *pkt;
int *idx;
u_char dst[], src[];
u_short proto;
int trans;
mopPutHeader(u_char *pkt, int *idx, const u_char *dst, const u_char *src,
u_short proto, int trans)
{
mopPutMulti(pkt, idx, dst, 6);
@ -153,10 +134,7 @@ mopPutHeader(pkt, idx, dst, src, proto, trans)
}
void
mopPutLength(pkt, trans, len)
u_char *pkt;
int trans;
u_short len;
mopPutLength(u_char *pkt, int trans, u_short len)
{
int idx = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: put.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: put.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -23,7 +23,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.5 2009/10/20 00:51:13 snj Exp $
* $NetBSD: put.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@ -36,7 +36,7 @@ void mopPutShort __P((u_char *, int *, u_short));
void mopPutLong __P((u_char *, int *, u_int32_t));
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 mopPutHeader __P((u_char *, int *, const u_char *, const u_char *, u_short, int));
void mopPutLength __P((u_char *, int, u_short));
__END_DECLS

View File

@ -1,4 +1,4 @@
/* $NetBSD: rc.c,v 1.5 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: rc.c,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: rc.c,v 1.5 2009/10/20 00:51:13 snj Exp $");
__RCSID("$NetBSD: rc.c,v 1.6 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@ -36,10 +36,7 @@ __RCSID("$NetBSD: rc.c,v 1.5 2009/10/20 00:51:13 snj Exp $");
#include "rc.h"
void
mopDumpRC(fd, pkt, trans)
FILE *fd;
u_char *pkt;
int trans;
mopDumpRC(FILE *fd, const u_char *pkt, int trans)
{
int i,idx = 0;
int32_t tmpl;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rc.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: rc.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -23,7 +23,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: rc.h,v 1.5 2009/10/20 00:51:13 snj Exp $
* $NetBSD: rc.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@ -31,7 +31,7 @@
#define _RC_H_
__BEGIN_DECLS
void mopDumpRC __P((FILE *, u_char *, int));
void mopDumpRC __P((FILE *, const u_char *, int));
__END_DECLS
#endif /* _RC_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mopd.c,v 1.12 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: mopd.c,v 1.13 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-96 Mats O Jansson. All rights reserved.
@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: mopd.c,v 1.12 2009/10/20 00:51:13 snj Exp $");
__RCSID("$NetBSD: mopd.c,v 1.13 2009/11/17 18:58:07 drochner Exp $");
#endif
/*
@ -174,7 +174,7 @@ mopProcess(ii, pkt)
struct if_info *ii;
u_char *pkt;
{
u_char *dst, *src;
const u_char *dst, *src;
u_short ptype;
int idx, trans, len;

View File

@ -1,4 +1,4 @@
/* $NetBSD: process.c,v 1.16 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: process.c,v 1.17 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -26,7 +26,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: process.c,v 1.16 2009/10/20 00:51:13 snj Exp $");
__RCSID("$NetBSD: process.c,v 1.17 2009/11/17 18:58:07 drochner Exp $");
#endif
#include "os.h"
@ -48,26 +48,23 @@ extern char *MopdDir;
struct dllist dllist[MAXDL]; /* dump/load list */
void mopNextLoad __P((u_char *, u_char *, u_char, int));
void mopProcessDL __P((FILE *, struct if_info *, u_char *, int *,
u_char *, u_char *, int, u_short));
void mopProcessRC __P((FILE *, struct if_info *, u_char *, int *,
u_char *, u_char *, int, u_short));
void mopProcessInfo __P((u_char *, int *, u_short, struct dllist *, int));
void mopSendASV __P((u_char *, u_char *, struct if_info *, int));
void mopStartLoad __P((u_char *, u_char *, struct dllist *, int));
void mopNextLoad(const u_char *, const u_char *, u_char, int);
void mopProcessDL(FILE *, struct if_info *, const u_char *, int *,
const u_char *, const u_char *, int, u_short);
void mopProcessRC(FILE *, struct if_info *, const u_char *, int *,
const u_char *, const u_char *, int, u_short);
void mopProcessInfo(const u_char *, int *, u_short, struct dllist *, int);
void mopSendASV(const u_char *, const u_char *, struct if_info *, int);
void mopStartLoad(const u_char *, const u_char *, struct dllist *, int);
void
mopProcessInfo(pkt, idx, moplen, dl_rpr, trans)
u_char *pkt;
int *idx;
u_short moplen;
struct dllist *dl_rpr;
int trans;
mopProcessInfo(const u_char *pkt, int *idx, u_short moplen, struct dllist *dl_rpr,
int trans)
{
u_short itype,tmps;
u_char ilen ,tmpc,device;
u_char uc1,uc2,uc3,*ucp;
u_char uc1,uc2,uc3;
const u_char *ucp;
device = 0;
@ -169,10 +166,7 @@ mopProcessInfo(pkt, idx, moplen, dl_rpr, trans)
}
void
mopSendASV(dst, src, ii, trans)
u_char *dst,*src;
struct if_info *ii;
int trans;
mopSendASV(const u_char *dst, const u_char *src, struct if_info *ii, int trans)
{
u_char pkt[200], *p;
int idx;
@ -211,10 +205,8 @@ mopSendASV(dst, src, ii, trans)
#define MAX_ETH_PAYLOAD 1492
void
mopStartLoad(dst, src, dl_rpr, trans)
u_char *dst,*src;
struct dllist *dl_rpr;
int trans;
mopStartLoad(const u_char *dst, const u_char *src, struct dllist *dl_rpr,
int trans)
{
int len;
int i, slot;
@ -244,7 +236,7 @@ mopStartLoad(dst, src, dl_rpr, trans)
if (slot == -1) {
slot = i;
memmove((char *)dle->eaddr,
(char *)dst, 6);
(const char *)dst, 6);
}
}
}
@ -318,9 +310,7 @@ mopStartLoad(dst, src, dl_rpr, trans)
}
void
mopNextLoad(dst, src, new_count, trans)
u_char *dst, *src, new_count;
int trans;
mopNextLoad(const u_char *dst, const u_char *src, u_char new_count, int trans)
{
int len;
int i, slot;
@ -437,14 +427,8 @@ mopNextLoad(dst, src, new_count, trans)
}
void
mopProcessDL(fd, ii, pkt, idx, dst, src, trans, len)
FILE *fd;
struct if_info *ii;
u_char *pkt;
int *idx;
u_char *dst, *src;
int trans;
u_short len;
mopProcessDL(FILE *fd, struct if_info *ii, const u_char *pkt, int *idx,
const u_char *dst, const u_char *src, int trans, u_short len)
{
u_char tmpc;
u_short moplen;
@ -523,7 +507,7 @@ mopProcessDL(fd, ii, pkt, idx, dst, src, trans, len)
dl_rpr = &dl;
memset(dl_rpr, 0, sizeof(*dl_rpr));
dl_rpr->ii = ii;
memmove((char *)(dl_rpr->eaddr), (char *)src, 6);
memmove((char *)(dl_rpr->eaddr), (const char *)src, 6);
mopProcessInfo(pkt,idx,moplen,dl_rpr,trans);
snprintf(filename, sizeof(filename), "%s/%s.SYS",
@ -581,14 +565,8 @@ mopProcessDL(fd, ii, pkt, idx, dst, src, trans, len)
}
void
mopProcessRC(fd, ii, pkt, idx, dst, src, trans, len)
FILE *fd;
struct if_info *ii;
u_char *pkt;
int *idx;
u_char *dst, *src;
int trans;
u_short len;
mopProcessRC(FILE *fd, struct if_info *ii, const u_char *pkt, int *idx,
const u_char *dst, const u_char *src, int trans, u_short len)
{
u_char tmpc;
u_short tmps, moplen = 0;
@ -632,7 +610,7 @@ mopProcessRC(fd, ii, pkt, idx, dst, src, trans, len)
dl_rpr = &dl;
memset(dl_rpr, 0, sizeof(*dl_rpr));
dl_rpr->ii = ii;
memmove((char *)(dl_rpr->eaddr), (char *)src, 6);
memmove((char *)(dl_rpr->eaddr), (const char *)src, 6);
mopProcessInfo(pkt,idx,moplen,dl_rpr,trans);
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: process.h,v 1.5 2009/10/20 00:51:13 snj Exp $ */
/* $NetBSD: process.h,v 1.6 2009/11/17 18:58:07 drochner Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -23,7 +23,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: process.h,v 1.5 2009/10/20 00:51:13 snj Exp $
* $NetBSD: process.h,v 1.6 2009/11/17 18:58:07 drochner Exp $
*
*/
@ -32,9 +32,9 @@
__BEGIN_DECLS
void mopProcessDL __P((FILE *, struct if_info *, u_char *, int *,
u_char *, u_char *, int, u_short));
const u_char *, const u_char *, int, u_short));
void mopProcessRC __P((FILE *, struct if_info *, u_char *, int *,
u_char *, u_char *, int, u_short));
const u_char *, const u_char *, int, u_short));
__END_DECLS
#endif /* _PROCESS_H_ */