mirror of
https://github.com/dreamlayers/netbsd-mopd.git
synced 2026-01-29 13:01:07 +00:00
ANSIfy, sprinkle "const"
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
12
common/dl.c
12
common/dl.c
@@ -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);
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
38
common/get.c
38
common/get.c
@@ -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:
|
||||
|
||||
18
common/get.h
18
common/get.h
@@ -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_ */
|
||||
|
||||
36
common/pf.c
36
common/pf.c
@@ -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;
|
||||
}
|
||||
|
||||
14
common/pf.h
14
common/pf.h
@@ -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_ */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
42
common/put.c
42
common/put.c
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
Reference in New Issue
Block a user