From b8ec8425708cc90376f3cfc16c6e0f0b3cc6e2f2 Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Sun, 8 Feb 1998 20:02:51 +0000 Subject: [PATCH] New port: cnet - a graphical network simulator. --- net/cnet/Makefile | 28 ++++++++++++ net/cnet/distinfo | 1 + net/cnet/files/Makefile.freebsd | 54 +++++++++++++++++++++++ net/cnet/files/compile.c | 77 +++++++++++++++++++++++++++++++++ net/cnet/pkg-comment | 1 + net/cnet/pkg-descr | 3 ++ net/cnet/pkg-plist | 38 ++++++++++++++++ 7 files changed, 202 insertions(+) create mode 100644 net/cnet/Makefile create mode 100644 net/cnet/distinfo create mode 100644 net/cnet/files/Makefile.freebsd create mode 100644 net/cnet/files/compile.c create mode 100644 net/cnet/pkg-comment create mode 100644 net/cnet/pkg-descr create mode 100644 net/cnet/pkg-plist diff --git a/net/cnet/Makefile b/net/cnet/Makefile new file mode 100644 index 000000000000..ca75bb2b471c --- /dev/null +++ b/net/cnet/Makefile @@ -0,0 +1,28 @@ +# New ports collection makefile for: cnet +# Version required: 1.4 +# Date created: Feb 8th, 1988 +# Whom: jkh +# +# $Id$ +# + +DISTNAME= cnet-1.4-3 +PKGNAME= cnet-1.4p3 +CATEGORIES= net +MASTER_SITES= http://www.cs.uwa.edu.au/pls/cnet/ + +DEPENDS= ${PORTSDIR}/x11/xview-lib + +WRKSRC= ${WRKDIR}/cnet-1.4 +ALL_TARGET= +MAN1= cnet.1 + +pre-build: + cp ${FILESDIR}/Makefile.freebsd ${WRKSRC}/src + mkdir -p ${WRKSRC}/src/freebsd + cp ${FILESDIR}/compile.c ${WRKSRC}/src/freebsd + +pre-install: + mkdir -p ${PREFIX}/share/examples/cnet + +.include diff --git a/net/cnet/distinfo b/net/cnet/distinfo new file mode 100644 index 000000000000..04724d32e0aa --- /dev/null +++ b/net/cnet/distinfo @@ -0,0 +1 @@ +MD5 (cnet-1.4-3.tar.gz) = 2037adef9bbeb83b0c7f6792cdba5847 diff --git a/net/cnet/files/Makefile.freebsd b/net/cnet/files/Makefile.freebsd new file mode 100644 index 000000000000..3e8721ffbd2f --- /dev/null +++ b/net/cnet/files/Makefile.freebsd @@ -0,0 +1,54 @@ +# +# The following #defines are for Sun's SunOS, >= SunOS4.1.2 +# CC may be either cc or gcc +# + + + +# Uncomment the following line if you wish Tcl/Tk windowing (see config.h) +# +#XINCLUDES = +#XLIBS = -ltcl -ltk -lXpm -lX11 -lm +# +# Uncomment the following line if you wish XView windowing (see config.h) +# +OPENWINHOME = ${X11BASE} +XINCLUDES = -I$(OPENWINHOME)/include +XLIBS = -L$(OPENWINHOME)/lib -lxview -lolgx -lXpm -lX11 +# +# Uncomment the following lines if you wish Motif windowing (see config.h) +# +#XINCLUDES = -I$(X11BASE)/include +#XLIBS = -L$(X11BASE)/lib -lXm -lXt -lXpm -lX11 + + +#CC = cc +CC = gcc -Wall -ansi + +INCLUDES = +CFLAGS = -O $(INCLUDES) $(XINCLUDES) + +#LD = cc +LD = gcc +LIBDIRS = -L/usr/local/lib +LIBS = -lm -lgnuregex +STRIP = strip + +BINDIR = /usr/local/bin +MANDIR = /usr/local/man/man1 +MANEXT = 1 +INCDIR = /usr/local/include + + +# ---------------------- No user-serviceable code below ----------------- + +include Makefile.common + +kultarr: $(NAME) + chmod 711 $(NAME) + rcp -p $(NAME) kultarr:/usr/kultarr/bin/$(NAME) + rcp -p $(NAME) kultarr:/usr/local/bin/$(NAME) + chmod 644 cnet.h DOC/cnet.man + rcp -p cnet.h kultarr:/usr/local/include/cnet.h + rcp -p DOC/cnet.man kultarr:/usr/local/man/manl/cnet.l + diff --git a/net/cnet/files/compile.c b/net/cnet/files/compile.c new file mode 100644 index 000000000000..8f3c4c2656e1 --- /dev/null +++ b/net/cnet/files/compile.c @@ -0,0 +1,77 @@ +#include +#include + +static int add_compile_args(ac, av, kflag) int ac; char *av[]; int kflag; +{ + av[ac++] = "-fPIC"; + av[ac++] = "-I/usr/local/include"; /* XXX GROSS - should use prefix */ + return(ac); +} + + +static int add_link_args(ac, av, kflag) int ac; char *av[]; int kflag; +{ + av[ac++] = findenv("CNETLD", CNETLD); + av[ac++] = "cc"; + av[ac++] = "-Bshareable"; + return(ac); +} + + +static void data_segments(n, handle, so_filenm) + int n; void *handle; char *so_filenm; +{ + extern int nlist _PARAMS((const char *, struct nlist *)); + + typedef struct _c { + char *so_filenm; + unsigned long length_data; + char *incore_data; + char *original_data; + struct _c *next; + } CACHE; + + static CACHE *chd = (CACHE *)NULL; + CACHE *cp = chd; + + NODE *np = &NP[n]; + struct nlist nls[3]; + + while(cp != (CACHE *)NULL) { + if(strcmp(cp->so_filenm, so_filenm) == 0) + goto found; + cp = cp->next; + } + + nls[0].n_name = "__DYNAMIC"; + nls[1].n_name = "_end"; + nls[2].n_name = (char *)NULL; + + if(nlist(so_filenm, nls) != 0) { + (void)fprintf(stderr,"%s: cannot load symbols from %s\n", + progname,so_filenm); + ++nerrors; + return; + } + + cp = (CACHE *)malloc(sizeof(CACHE)); + cp->so_filenm = strdup(so_filenm); + cp->length_data = (nls[1].n_value - nls[0].n_value); + cp->incore_data = (char *)((long)dlsym(handle,"end") - cp->length_data); + cp->original_data = (char *)malloc(cp->length_data); + (void)memcpy(cp->original_data, cp->incore_data, cp->length_data); + cp->next = chd; + chd = cp; + + if(vflag) + (void)fprintf(stderr,"%s dataseg=0x%08lx len(dataseg)=%ld\n", + so_filenm, (long)cp->incore_data, cp->length_data); +found: + + np->length_data[0] = cp->length_data; + np->incore_data[0] = cp->incore_data; + np->original_data[0] = cp->original_data; + + np->private_data[0] = (char *)malloc(cp->length_data); + (void)memcpy(np->private_data[0], cp->original_data, cp->length_data); +} diff --git a/net/cnet/pkg-comment b/net/cnet/pkg-comment new file mode 100644 index 000000000000..8240d43aff4c --- /dev/null +++ b/net/cnet/pkg-comment @@ -0,0 +1 @@ +A networking simulator diff --git a/net/cnet/pkg-descr b/net/cnet/pkg-descr new file mode 100644 index 000000000000..e39115cddb39 --- /dev/null +++ b/net/cnet/pkg-descr @@ -0,0 +1,3 @@ +cnet is a networking simulator which enables experimentation with various data-link layer, network layer, routing and transport layer networking protocols. +It has been specifically developed for, and used in, undergraduate computer +networking courses by thousands of students since 1991. diff --git a/net/cnet/pkg-plist b/net/cnet/pkg-plist new file mode 100644 index 000000000000..9a3d4a67247f --- /dev/null +++ b/net/cnet/pkg-plist @@ -0,0 +1,38 @@ +bin/cnet.so.1 +man/man1/cnet.1.gz +include/cnet.h +share/examples/cnet/AUSTRALIA.MAP +share/examples/cnet/CLICK +share/examples/cnet/EXAMPLES +share/examples/cnet/FAST +share/examples/cnet/FLOODING1 +share/examples/cnet/FLOODING2 +share/examples/cnet/FLOODING3 +share/examples/cnet/KEYBOARD +share/examples/cnet/LINKSTATE +share/examples/cnet/Makefile +share/examples/cnet/STOPANDWAIT +share/examples/cnet/T2 +share/examples/cnet/TICKTOCK +share/examples/cnet/TOPOLOGY.2a +share/examples/cnet/TOPOLOGY.2b +share/examples/cnet/TOPOLOGY.2c +share/examples/cnet/WORLD +share/examples/cnet/WORLD.MAP +share/examples/cnet/click.c +share/examples/cnet/cnet.h +share/examples/cnet/cnet.tcl +share/examples/cnet/fast.c +share/examples/cnet/flooding.gp +share/examples/cnet/flooding1.c +share/examples/cnet/flooding1.dat +share/examples/cnet/flooding2.c +share/examples/cnet/flooding2.dat +share/examples/cnet/flooding3.c +share/examples/cnet/flooding3.dat +share/examples/cnet/keyboard.c +share/examples/cnet/linkstate.c +share/examples/cnet/protocol.c +share/examples/cnet/stopandwait.c +share/examples/cnet/ticktock.c +@dirrm share/examples/cnet