diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/dgd/Makefile | 52 | ||||
-rw-r--r-- | net/dgd/distinfo | 18 | ||||
-rw-r--r-- | net/dgd/files/extrapatch-kernellib-net | 996 | ||||
-rw-r--r-- | net/dgd/files/patch-comp.c | 19 | ||||
-rw-r--r-- | net/dgd/files/patch-mud.dgd | 13 | ||||
-rw-r--r-- | net/dgd/pkg-plist | 3 |
6 files changed, 1043 insertions, 58 deletions
diff --git a/net/dgd/Makefile b/net/dgd/Makefile index 2a183facef23..b7a44182b471 100644 --- a/net/dgd/Makefile +++ b/net/dgd/Makefile @@ -6,16 +6,19 @@ # PORTNAME= dgd -PORTVERSION= 1.3 +PORTVERSION= 1.4 CATEGORIES= net lang games -MASTER_SITES= ${MASTER_SITE_LOCAL:S|%SUBDIR%|glewis/dgd|} \ - http://ftp.dworkin.nl/dgd/ +MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:S|%SUBDIR%|${PORTNAME}-osr|}:1 \ + http://ftp.dworkin.nl/kernellib/:2 \ + http://ftp.dworkin.nl/kernellib/patches/:3 +DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:1 \ + kernellib-${KERNELLIB_VERSION}${EXTRACT_SUFX}:2 \ + ${KERNELLIB_VERSION}-${KERNELLIB_VERSION}.1.gz:3 +EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX} \ + kernellib-${KERNELLIB_VERSION}${EXTRACT_SUFX} MAINTAINER= glewis@FreeBSD.org -COMMENT= Dworkin's Generic Driver (network server) - -NO_CDROM= no distribution to corporate environment -RESTRICTED= license required for commercial use +COMMENT= Dworkin's Game Driver OPTIONS= NETWORKING "With networking kfuns" off @@ -25,6 +28,9 @@ PATCH_WRKSRC= ${WRKDIR}/dgd ALL_TARGET= install MAKE_JOBS_UNSAFE= yes +KERNELLIB_VERSION= 1.3 +EXTRA_PATCHES= ${WRKDIR}/${KERNELLIB_VERSION}-${KERNELLIB_VERSION}.1 + .if !defined(NOPORTDOCS) PORTDOCS= * .endif @@ -32,26 +38,31 @@ PORTDOCS= * .include <bsd.port.pre.mk> .if defined(WITH_NETWORKING) -PATCH_SITES+= http://ftp.dworkin.nl/dgd/pkg/ -PATCHFILES+= Network-6-DGD-1.3.patch.gz +MASTER_SITES+= http://wotf.org/downloads/${PORTNAME}/:4 +DIST_FILES+= Network-0.8-dgd-${PORTVERSION}.patch.gz:4 +EXTRA_PATCHES+= ${WRKDIR}/Network-0.8-dgd-${PORTVERSION}.patch \ + ${FILESDIR}/extrapatch-kernellib-net PLIST_SUB+= NETWORKING="" -PATCH_DIST_STRIP= -p1 -PATCH_STRIP= -p0 -F 3 .else PLIST_SUB+= NETWORKING="@comment " .endif +post-extract: + @${MV} ${WRKDIR}/kernellib ${WRKDIR}/dgd/ + +pre-patch: + @${GZCAT} ${DISTDIR}/${DIST_SUBDIR}/${KERNELLIB_VERSION}-${KERNELLIB_VERSION}.1.gz > ${WRKDIR}/${KERNELLIB_VERSION}-${KERNELLIB_VERSION}.1 +.if defined(WITH_NETWORKING) + @${GZCAT} ${DISTDIR}/${DIST_SUBDIR}/Network-0.8-dgd-${PORTVERSION}.patch.gz | ${SED} -e 's:^\*\*\* dgd/:*** :' -e 's:^--- dgd-net/:--- :'> ${WRKDIR}/Network-0.8-dgd-${PORTVERSION}.patch +.endif + post-patch: @${MV} ${WRKSRC}/host/Makefile.bsd ${WRKSRC}/host/Makefile @# There are here since the networking package modifies either these @# lines or lines near them so they cannot be applied as patches. - @${REINPLACE_CMD} -e "s:^directory\([[:space:]]\)=\([[:space:]]\)\"[^\"]*\":directory\1=\2\"${DATADIR}/kernel\":" ${WRKDIR}/dgd/mud.dgd + @${REINPLACE_CMD} -e "s:^directory\([[:space:]]\)=\([[:space:]]\)\"[^\"]*\":directory\1=\2\"${DATADIR}/kernel\":" -e "s:tmp/swap:tmp/dgd.swap:" ${WRKDIR}/dgd/mud.dgd @${REINPLACE_CMD} -e "/^DEBUG/d" ${WRKSRC}/Makefile - -.ifdef (WITH_NETWORKING) -post-configure: - cd ${WRKDIR}/dgd/ && ${FIND} . -name '*.orig' -delete -.endif + @cd ${WRKDIR}/dgd/ && ${FIND} . -name '*.orig' -delete do-install: ${INSTALL_PROGRAM} ${WRKDIR}/dgd/bin/driver ${PREFIX}/sbin/dgd @@ -60,9 +71,9 @@ do-install: ${INSTALL_DATA} ${WRKDIR}/dgd/mud.dgd \ ${PREFIX}/etc/${PORTNAME}/kernel.dgd ${MKDIR} ${DATADIR}/kernel - cd ${WRKDIR}/dgd/mud && ${FIND} . \ + cd ${WRKDIR}/dgd/kernellib && ${FIND} . \ | ${CPIO} -pdmu -R ${SHAREOWN}:${SHAREGRP} ${DATADIR}/kernel - # Install an RC script for DGD + @# Install an RC script for DGD ${CAT} ${FILESDIR}/dgd.sh | ${SED} -e "s:%%PREFIX%%:${PREFIX}:" \ -e "s:%%DATADIR%%:${DATADIR}:" > \ ${PREFIX}/etc/rc.d/dgd.sh.sample @@ -72,8 +83,9 @@ do-install: .ifdef (WITH_NETWORKING) ${INSTALL_DATA} ${WRKDIR}/dgd/Changelog.NET ${DOCSDIR} .endif - ${INSTALL_DATA} ${WRKDIR}/dgd/Copyright ${DOCSDIR} + ${INSTALL_DATA} ${WRKDIR}/dgd/COPYING ${DOCSDIR} .ifdef (WITH_NETWORKING) + ${INSTALL_DATA} ${WRKDIR}/dgd/COPYING.NET ${DOCSDIR} ${INSTALL_DATA} ${WRKDIR}/dgd/Copyright.NET ${DOCSDIR} .endif ${INSTALL_DATA} ${WRKDIR}/dgd/Credits ${DOCSDIR} diff --git a/net/dgd/distinfo b/net/dgd/distinfo index 18cc5623c930..268576df4399 100644 --- a/net/dgd/distinfo +++ b/net/dgd/distinfo @@ -1,6 +1,12 @@ -MD5 (dgd/dgd-1.3.tar.gz) = e7dc3bbc4fe416b2ee400c549b1470b7 -SHA256 (dgd/dgd-1.3.tar.gz) = 3aec104d65dd63484c5450c5b35145f378127d83605196a342ff0f5ee7a7a31c -SIZE (dgd/dgd-1.3.tar.gz) = 518082 -MD5 (dgd/Network-6-DGD-1.3.patch.gz) = af63408d813965457ab865c8401a721e -SHA256 (dgd/Network-6-DGD-1.3.patch.gz) = c90a96d5d58bb53d62044b3c3b09747cac1aebeb9ba07e56c2564c373a8d83d5 -SIZE (dgd/Network-6-DGD-1.3.patch.gz) = 21144 +MD5 (dgd/dgd-1.4.tar.gz) = 7c2f6c213db9e51b0443c85129a17ff8 +SHA256 (dgd/dgd-1.4.tar.gz) = e9b5050845f348ca6f76b491d752120a51d0d58f40885d47dacf75dd5b866e05 +SIZE (dgd/dgd-1.4.tar.gz) = 439293 +MD5 (dgd/kernellib-1.3.tar.gz) = a388b467537dd148d69525e7d31399c1 +SHA256 (dgd/kernellib-1.3.tar.gz) = e78b9e2e6d72206d89b9bb1841bb5e47e5b835df29879acd1eb72cb10d778fe6 +SIZE (dgd/kernellib-1.3.tar.gz) = 44225 +MD5 (dgd/1.3-1.3.1.gz) = baf6781e216271dbd815014ce0ef4359 +SHA256 (dgd/1.3-1.3.1.gz) = 46e8cb08b920845077fcb8e50584d57e7898502a678a9308e8b8f597cac15423 +SIZE (dgd/1.3-1.3.1.gz) = 1793 +MD5 (dgd/Network-0.8-dgd-1.4.patch.gz) = a005d5c8eaa91dff798ae028b3e4af39 +SHA256 (dgd/Network-0.8-dgd-1.4.patch.gz) = 54da8dc063ab362c4247dd1a0576acefbd148edca4c28ff8ae7be4d10d7154ac +SIZE (dgd/Network-0.8-dgd-1.4.patch.gz) = 28339 diff --git a/net/dgd/files/extrapatch-kernellib-net b/net/dgd/files/extrapatch-kernellib-net new file mode 100644 index 000000000000..7cb125bc7a99 --- /dev/null +++ b/net/dgd/files/extrapatch-kernellib-net @@ -0,0 +1,996 @@ +*** kernellib/include/config.h Thu May 21 15:10:42 2009 +--- kernellib/include/config.h Thu May 21 15:10:52 2009 +*************** +*** 6,8 **** +--- 6,15 ---- + # undef SYS_PERSISTENT /* off by default */ + + # define CALLOUTRSRC FALSE /* don't have callouts as a resource */ ++ ++ # ifdef SYS_NETWORKING ++ # define TELNET_PORT 6047 /* default telnet port */ ++ # define BINARY_PORT 6048 /* default binary port */ ++ # define EMERGENCY_PORT 6049 /* emergency binary port */ ++ # endif ++ +*** kernellib/include/kernel/kernel.h Thu May 21 15:10:42 2009 +--- kernellib/include/kernel/kernel.h Thu May 21 15:10:52 2009 +*************** +*** 1,4 **** +--- 1,7 ---- + # include <config.h> ++ # ifndef SYS_NETWORKING ++ # define SYS_NETWORKING ++ # endif + + # define DRIVER "/kernel/sys/driver" + # define AUTO ("/kernel" + INHERITABLE_SUBDIR + "auto") +*** kernellib/include/kernel/net.h Thu Jan 1 00:00:00 1970 +--- kernellib/include/kernel/net.h Thu May 21 15:10:52 2009 +*************** +*** 0 **** +--- 1,10 ---- ++ # ifdef SYS_NETWORKING ++ # define LIB_PORT "/kernel/lib/network/port" ++ # define PORT_OBJECT "/kernel/obj/port" ++ # define PORT_TELNET "/kernel/sys/telnet_port" ++ # define PORT_BINARY "/kernel/sys/binary_port" ++ # define PORT_EMERGENCY "/kernel/sys/emergency_port" ++ # define PORT_UDP "/kernel/obj/udp" ++ # else ++ # error networking capabilities required ++ # endif +*** kernellib/include/kernel/user.h Thu May 21 15:10:42 2009 +--- kernellib/include/kernel/user.h Thu May 21 15:10:52 2009 +*************** +*** 6,11 **** +--- 6,15 ---- + # define BINARY_CONN ("/kernel" + CLONABLE_SUBDIR + "binary") + # define API_USER ("/kernel" + INHERITABLE_SUBDIR + "api/user") + ++ #ifdef __NETWORK_PACKAGE__ ++ #define LIB_PORT "/kernel/lib/network/port" ++ #endif ++ + # define DEFAULT_USER ("/kernel" + CLONABLE_SUBDIR + "user") + # define DEFAULT_WIZTOOL ("/kernel" + CLONABLE_SUBDIR + "wiztool") + # define DEFAULT_USER_DIR "/kernel/data" +*** kernellib/include/std.h Thu May 21 15:10:42 2009 +--- kernellib/include/std.h Thu May 21 15:10:52 2009 +*************** +*** 1,2 **** +--- 1,8 ---- ++ #ifdef __NETWORK_PACKAGE__ ++ #ifndef SYS_NETWORKING ++ #define SYS_NETWORKING ++ #endif ++ #endif ++ + # define TRUE 1 + # define FALSE 0 +*** kernellib/kernel/lib/auto.c Thu May 21 15:10:42 2009 +--- kernellib/kernel/lib/auto.c Thu May 21 15:10:52 2009 +*************** +*** 3,8 **** +--- 3,12 ---- + # include <kernel/rsrc.h> + # include <kernel/access.h> + # include <kernel/user.h> ++ # ifdef SYS_NETWORKING ++ # include <kernel/net.h> ++ # endif ++ + # include <status.h> + # include <type.h> + # include <trace.h> +*************** +*** 1547,1549 **** +--- 1551,1614 ---- + } : error(TLSVAR2); + return result; + } ++ ++ # ifdef SYS_NETWORKING ++ /* ++ * NAME: connect() ++ * DESCRIPTION: open an outbound connection ++ */ ++ static void connect(string destination, int port,varargs string proto) ++ { ++ object conn; ++ string err; ++ ++ if (previous_program() == LIB_CONN) { ++ if(!proto) proto = "tcp"; ++ ::connect(destination, port,proto); ++ } else { ++ CHECKARG(destination, 1, "connect"); ++ ++ if (creator == "System" && this_object()) { ++ if (function_object("query_conn", this_object()) != LIB_USER) { ++ error("Not a user object"); ++ } ++ conn = clone_object(BINARY_CONN, "System"); ++ call_other(this_object(),"connection",conn); ++ conn->connect(destination, port,proto); ++ if(err) { ++ rlimits (-1; -1) { ++ destruct_object(conn); ++ } ++ error(err); ++ } ++ } ++ } ++ } ++ ++ static object port_object; ++ ++ /* ++ * NAME: open_port() ++ * DESCRIPTION: open a port to listen on ++ */ ++ static void open_port(string protocol, varargs int port) ++ { ++ CHECKARG(protocol, 1, "open_port"); ++ ++ if (KERNEL() && this_object()) { ++ ::open_port(protocol, port); ++ } ++ } ++ ++ /* ++ * NAME: ports() ++ * DESCRIPTION: return list of open ports ++ */ ++ static object *ports() ++ { ++ if (creator == "System") { ++ return ::ports(); ++ } ++ } ++ # endif /* SYS_NETWORKING */ ++ +*** kernellib/kernel/lib/connection.c Thu May 21 15:10:42 2009 +--- kernellib/kernel/lib/connection.c Thu May 21 15:10:52 2009 +*************** +*** 6,11 **** +--- 6,12 ---- + private object user; /* user object */ + private string conntype; /* connection type */ + private int mode; /* connection mode */ ++ private int outgoing; + private int blocked; /* connection blocked? */ + private string buffer; /* buffered output string */ + +*************** +*** 66,71 **** +--- 67,77 ---- + int timeout; + string banner; + ++ if(outgoing) { ++ user->login("now"); ++ return; ++ } ++ + banner = call_other(userd, "query_" + conntype + "_banner", port, + this_object()); + if (banner) { +*************** +*** 74,80 **** + + timeout = call_other(userd, "query_" + conntype + "_timeout", port, + this_object()); +! if (timeout < 0) { + /* disconnect immediately */ + destruct_object(this_object()); + return; +--- 80,86 ---- + + timeout = call_other(userd, "query_" + conntype + "_timeout", port, + this_object()); +! if (timeout < 0 && !outgoing) { + /* disconnect immediately */ + destruct_object(this_object()); + return; +*************** +*** 83,88 **** +--- 89,99 ---- + if (!user && timeout != 0) { + call_out("timeout", timeout); + } ++ # ifdef SYS_NETWORKING ++ else { ++ set_mode(user->login(nil)); ++ } ++ # endif + } + + /* +*************** +*** 136,142 **** + */ + void set_port(int num) + { +! if (previous_object() == userd) { + port = num; + } + } +--- 147,154 ---- + */ + void set_port(int num) + { +! if(num == 0) error("port is 0\n"); +! if (previous_object() == userd || SYSTEM()) { + port = num; + } + } +*************** +*** 194,200 **** + user = call_other(userd, conntype + "_user", port, str); + set_mode(mode = user->login(str)); + } else { +! set_mode(mode = user->receive_message(str)); + } + return mode; + } +--- 206,216 ---- + user = call_other(userd, conntype + "_user", port, str); + set_mode(mode = user->login(str)); + } else { +! mixed m; +! m = user->receive_message(str); +! if(m) mode = m; +! else mode = 0; +! set_mode(mode); + } + return mode; + } +*************** +*** 223,228 **** +--- 239,246 ---- + return TRUE; + } + } ++ } else { ++ error(object_name(previous_object())+" is not allowed to do that"); + } + } + +*************** +*** 240,245 **** +--- 258,264 ---- + } + } + ++ #ifndef SYS_NETWORKING + /* + * NAME: datagram_challenge() + * DESCRIPTION: set the challenge for the datagram channel +*************** +*** 283,285 **** +--- 302,324 ---- + return (send_datagram(str) == strlen(str)); + } + } ++ #else ++ /* ++ * NAME: connect() ++ * DESCRIPTION: establish an outbount connection ++ */ ++ void connect(string destination, int n,varargs string protocol) ++ { ++ if (previous_program() == AUTO || previous_program() == LIB_USER) { ++ outgoing = 1; ++ user = previous_object(); ++ port = n; ++ ::connect(destination, n, protocol); ++ } ++ } ++ ++ void receive_error(string str) { ++ DRIVER->message("NETWORK ERROR: "+str+"\n"); ++ } ++ # endif ++ +*** kernellib/kernel/lib/network/port.c Thu Jan 1 00:00:00 1970 +--- kernellib/kernel/lib/network/port.c Thu May 21 15:10:52 2009 +*************** +*** 0 **** +--- 1,68 ---- ++ # include <kernel/kernel.h> ++ # include <kernel/user.h> ++ # include <trace.h> ++ # include <type.h> ++ ++ private object driver; /* driver object */ ++ private object userd; /* user manager object */ ++ private string protocol; /* telnet, tcp or udp */ ++ ++ /* ++ * NAME: create() ++ * DESCRIPTION: initialize port object ++ */ ++ static void create() ++ { ++ driver = find_object(DRIVER); ++ userd = find_object(USERD); ++ } ++ ++ /* ++ * NAME: open_port() ++ * DESCRIPTION: start listening on a port ++ */ ++ static ++ void open_port(string prot, varargs int port) ++ { ++ rlimits (-1; -1) { ++ /* catch {*/ ++ if (typeof(port)==T_INT && port !=0) { ++ ::open_port(prot, port); ++ } else { ++ ::open_port(prot); ++ } ++ protocol = prot; ++ return; ++ /* } : { ++ error(::call_trace()[1][TRACE_FIRSTARG][1]); ++ return; ++ }*/ ++ } ++ } ++ ++ object ++ connection(mixed *tls, string ip, int port) ++ { ++ object conn; ++ ++ switch(protocol) { ++ case "telnet" : conn = clone_object(TELNET_CONN); ++ break; ++ default : conn = clone_object(BINARY_CONN); ++ break; ++ } ++ conn->set_port(port); ++ return conn; ++ } ++ ++ int ++ open(mixed *tls,int port) ++ { ++ return FALSE; ++ } ++ ++ void ++ close(mixed *tls, int force) ++ { ++ } ++ +*** kernellib/kernel/obj/binary.c Thu May 21 15:10:42 2009 +--- kernellib/kernel/obj/binary.c Thu May 21 15:10:52 2009 +*************** +*** 1,5 **** +--- 1,9 ---- + # include <kernel/kernel.h> + # include <kernel/user.h> ++ # ifdef SYS_NETWORKING ++ # include <kernel/net.h> ++ # endif ++ + + inherit LIB_CONN; /* basic connection object */ + +*************** +*** 25,33 **** + * NAME: open() + * DESCRIPTION: open the connection + */ +! static void open() + { + ::open(allocate(driver->query_tls_size())); + } + + /* +--- 29,42 ---- + * NAME: open() + * DESCRIPTION: open the connection + */ +! static int open() + { + ::open(allocate(driver->query_tls_size())); ++ # ifdef SYS_NETWORKING ++ return TRUE; ++ # else ++ return FALSE; ++ # endif + } + + /* +*************** +*** 153,158 **** +--- 162,168 ---- + ::message_done(allocate(driver->query_tls_size())); + } + ++ #ifndef SYS_NETWORKING + /* + * NAME: open_datagram() + * DESCRIPTION: open a datagram channel for this connection +*************** +*** 170,172 **** +--- 180,229 ---- + { + ::receive_datagram(allocate(driver->query_tls_size()), str); + } ++ #endif ++ ++ #ifdef SYS_NETWORKING ++ ++ object udpchannel; /* UDP channel object */ ++ ++ /* ++ * NAME: set_udpchannel() ++ * DESCRIPTION: set the UDP channel for this connection ++ */ ++ void set_udpchannel(object udp, string host, int port) ++ { ++ if (previous_program() == LIB_PORT) { ++ udpchannel = udp; ++ udp->add_connection(this_object(), host, port); ++ } ++ } ++ ++ /* ++ * NAME: receive_datagram() ++ * DESCRIPTION: receive a datagram ++ */ ++ void receive_datagram(mixed *tls, string str) ++ { ++ if (previous_object() == udpchannel) { ++ object user; ++ ++ user = query_user(); ++ if (user) { ++ user->receive_datagram(str); ++ } ++ } ++ } ++ ++ /* ++ * NAME: datagram() ++ * DESCRIPTION: send a datagram on the UDP channel ++ */ ++ int datagram(string str) ++ { ++ if (previous_object() == query_user() && udpchannel) { ++ return udpchannel->datagram(str); ++ } ++ } ++ ++ #endif ++ +*** kernellib/kernel/obj/port.c Thu Jan 1 00:00:00 1970 +--- kernellib/kernel/obj/port.c Thu May 21 15:10:52 2009 +*************** +*** 0 **** +--- 1,49 ---- ++ # include <kernel/kernel.h> ++ # include <kernel/user.h> ++ # include <kernel/net.h> ++ ++ inherit LIB_PORT; ++ ++ /* ++ * NAME: create() ++ * DESCRIPTION: initialize port object ++ */ ++ static void create(int clone) ++ { ++ if (clone) { ++ ::create(); ++ } ++ } ++ ++ /* ++ * NAME: listen() ++ * DESCRIPTION: start listening on a port ++ */ ++ void listen(string protocol, int port) ++ { ++ #ifndef SYS_NETWORKING ++ if (previous_program() == DRIVER) { ++ #else ++ if (previous_program() == DRIVER || previous_program() == USERD) { ++ #endif ++ ::open_port(protocol, port); ++ } ++ } ++ ++ /* ++ * NAME: open_connection() ++ * DESCRIPTION: don't return a user object, select it by first line of input ++ */ ++ static object open_connection(string ipaddr, int port) ++ { ++ return nil; ++ } ++ ++ void open(int port) { ++ ::open(allocate(DRIVER->query_tls_size()),port); ++ } ++ ++ object connection(string ip, int port) { ++ ::connection(allocate(DRIVER->query_tls_size()),ip,port); ++ } ++ +*** kernellib/kernel/sys/binary_port.c Thu Jan 1 00:00:00 1970 +--- kernellib/kernel/sys/binary_port.c Thu May 21 15:10:52 2009 +*************** +*** 0 **** +--- 1,47 ---- ++ #include <kernel/net.h> ++ #include <kernel/user.h> ++ #include <kernel/kernel.h> ++ ++ inherit LIB_PORT; /* basic port object */ ++ ++ object driver; /* driver object */ ++ ++ void ++ create() ++ { ++ ::create(); ++ driver = find_object(DRIVER); ++ open_port("tcp", BINARY_PORT); ++ } ++ ++ object ++ connection(string ip, int port) ++ { ++ return ::connection(allocate(driver->query_tls_size()), ip, port); ++ } ++ ++ void ++ done() ++ { ++ close_user(); ++ } ++ ++ /* ++ * NAME: open() ++ * DESCRIPTION: open the connection ++ */ ++ static int open(int port) ++ { ++ ::open(allocate(driver->query_tls_size()), port); ++ return FALSE; ++ } ++ ++ /* ++ * NAME: close() ++ * DESCRIPTION: close the connection ++ */ ++ static void close(int force) ++ { ++ ::close(allocate(driver->query_tls_size()), force); ++ } ++ +*** kernellib/kernel/sys/driver.c Thu May 21 15:10:42 2009 +--- kernellib/kernel/sys/driver.c Thu May 21 15:10:52 2009 +*************** +*** 4,9 **** +--- 4,15 ---- + # include <kernel/access.h> + # include <kernel/user.h> + # include <kernel/tls.h> ++ # ifdef __NETWORK_PACKAGE__ ++ # ifndef SYS_NETWORKING ++ # define SYS_NETWORKING ++ # endif ++ # include <kernel/net.h> ++ # endif + # include <status.h> + # include <trace.h> + +*************** +*** 16,23 **** +--- 22,38 ---- + object initd; /* init manager object */ + object objectd; /* object manager object */ + object errord; /* error manager object */ ++ # ifdef SYS_NETWORKING ++ static object port_master; /* port master object */ ++ static object telnet; /* default telnet port object */ ++ static object binary; /* default binary port object */ ++ static object emergency; /* emergency port object */ ++ # endif ++ + int tls_size; /* thread local storage size */ + ++ ++ + /* + * NAME: creator() + * DESCRIPTION: get creator of file +*************** +*** 408,413 **** +--- 423,432 ---- + call_other(accessd = load(ACCESSD), "???"); + call_other(userd = load(USERD), "???"); + call_other(load(DEFAULT_WIZTOOL), "???"); ++ # ifdef SYS_NETWORKING ++ call_other(port_master = load(PORT_OBJECT), "???"); ++ call_other(emergency = load(PORT_EMERGENCY), "???"); ++ # endif + + /* initialize other users as resource owners */ + users = (accessd->query_users() - ({ "System" })) | ({ "admin" }); +*************** +*** 432,439 **** + shutdown(); + return; + } + } +- + message("Initialization complete.\n\n"); + } + +--- 451,463 ---- + shutdown(); + return; + } ++ # ifdef SYS_NETWORKING ++ } else { ++ call_other(telnet = load(PORT_TELNET),"???"); ++ call_other(binary = load(PORT_BINARY),"???"); ++ rsrcd->rsrc_incr("System", "objects", nil, 2, 1); ++ #endif + } + message("Initialization complete.\n\n"); + } + +*************** +*** 477,483 **** + initd->reboot(); + } + } +! + message("State restored.\n\n"); + } + +--- 501,519 ---- + initd->reboot(); + } + } +! # ifdef SYS_NETWORKING +! if (telnet) { +! telnet->listen("telnet", TELNET_PORT); +! } +! if (binary) { +! binary->listen("tcp", BINARY_PORT); +! } +! if(!emergency) { +! emergency = clone_object(port_master); +! rsrcd->rsrc_incr("System", "objects", nil, 1, 1); +! } +! emergency->listen("tcp", EMERGENCY_PORT); +! # endif + message("State restored.\n\n"); + } + +*** kernellib/kernel/sys/emergency_port.c Thu Jan 1 00:00:00 1970 +--- kernellib/kernel/sys/emergency_port.c Thu May 21 15:10:52 2009 +*************** +*** 0 **** +--- 1,47 ---- ++ #include <kernel/net.h> ++ #include <kernel/user.h> ++ #include <kernel/kernel.h> ++ ++ inherit LIB_PORT; /* basic port object */ ++ ++ object driver; /* driver object */ ++ ++ void ++ create() ++ { ++ ::create(); ++ driver = find_object(DRIVER); ++ open_port("tcp", EMERGENCY_PORT); ++ } ++ ++ object ++ connection(string ip, int port) ++ { ++ return ::connection(allocate(driver->query_tls_size()), ip, port); ++ } ++ ++ void ++ done() ++ { ++ close_user(); ++ } ++ ++ /* ++ * NAME: open() ++ * DESCRIPTION: open the connection ++ */ ++ static int open(int port) ++ { ++ ::open(allocate(driver->query_tls_size()), port); ++ return FALSE; ++ } ++ ++ /* ++ * NAME: close() ++ * DESCRIPTION: close the connection ++ */ ++ static void close(int force) ++ { ++ ::close(allocate(driver->query_tls_size()), force); ++ } ++ +*** kernellib/kernel/sys/telnet_port.c Thu Jan 1 00:00:00 1970 +--- kernellib/kernel/sys/telnet_port.c Thu May 21 15:10:52 2009 +*************** +*** 0 **** +--- 1,47 ---- ++ #include <kernel/net.h> ++ #include <kernel/user.h> ++ #include <kernel/kernel.h> ++ ++ inherit LIB_PORT; /* basic port object */ ++ ++ object driver; /* driver object */ ++ ++ void ++ create() ++ { ++ ::create(); ++ driver = find_object(DRIVER); ++ open_port("telnet", TELNET_PORT); ++ } ++ ++ object ++ connection(string ip, int port) ++ { ++ return ::connection(allocate(driver->query_tls_size()), ip, port); ++ } ++ ++ void ++ done() ++ { ++ close_user(); ++ } ++ ++ /* ++ * NAME: open() ++ * DESCRIPTION: open the connection ++ */ ++ static int open(int port) ++ { ++ ::open(allocate(driver->query_tls_size()), port); ++ return FALSE; ++ } ++ ++ /* ++ * NAME: close() ++ * DESCRIPTION: close the connection ++ */ ++ static void close(int force) ++ { ++ ::close(allocate(driver->query_tls_size()), force); ++ } ++ +*** kernellib/kernel/sys/userd.c Thu May 21 15:10:42 2009 +--- kernellib/kernel/sys/userd.c Thu May 21 15:10:52 2009 +*************** +*** 1,11 **** +--- 1,18 ---- + # include <kernel/kernel.h> + # include <kernel/user.h> ++ # ifdef SYS_NETWORKING ++ # include <kernel/net.h> ++ # define PORT PORT_OBJECT ++ # else ++ # define PORT DRIVER ++ # endif + # include <status.h> + + + object *users; /* user mappings */ + mapping names; /* name : connection object */ + object *connections; /* saved connections */ ++ mapping listeners_telnet, listeners_tcp; /* port objects */ + mapping telnet, binary; /* port managers */ + + /* +*************** +*** 18,23 **** +--- 25,31 ---- + if (!find_object(TELNET_CONN)) { compile_object(TELNET_CONN); } + if (!find_object(BINARY_CONN)) { compile_object(BINARY_CONN); } + if (!find_object(DEFAULT_USER)) { compile_object(DEFAULT_USER); } ++ if (!find_object(PORT_OBJECT)) { compile_object(PORT_OBJECT); } + + /* initialize user arrays */ + users = ({ }); +*************** +*** 32,38 **** + */ + object telnet_connection(mixed *tls, int port) + { +! if (previous_program() == DRIVER) { + object conn; + + conn = clone_object(TELNET_CONN); +--- 40,46 ---- + */ + object telnet_connection(mixed *tls, int port) + { +! if (previous_program() == PORT) { + object conn; + + conn = clone_object(TELNET_CONN); +*************** +*** 47,53 **** + */ + object binary_connection(mixed *tls, int port) + { +! if (previous_program() == DRIVER) { + object conn; + + conn = clone_object(BINARY_CONN); +--- 55,61 ---- + */ + object binary_connection(mixed *tls, int port) + { +! if (previous_program() == PORT) { + object conn; + + conn = clone_object(BINARY_CONN); +*************** +*** 57,62 **** +--- 65,113 ---- + } + + /* ++ * NAME: ++ * DESCRIPTION: ++ */ ++ private void start_telnet_listener(int port) ++ { ++ if(!listeners_telnet) { ++ listeners_telnet = ([ ]); ++ } ++ if(!listeners_tcp) { ++ listeners_tcp = ([ ]); ++ } ++ ++ if(!listeners_telnet[port] && !listeners_tcp[port]) { ++ listeners_telnet[port] = clone_object(PORT_OBJECT); ++ listeners_telnet[port]->listen("telnet",port); ++ } else { ++ error("Port "+port+" is already in use."); ++ } ++ } ++ ++ /* ++ * NAME: ++ * DESCRIPTION: ++ */ ++ private void start_tcp_listener(int port) ++ { ++ if(!listeners_telnet) { ++ listeners_telnet = ([ ]); ++ } ++ ++ if(!listeners_tcp) { ++ listeners_tcp = ([ ]); ++ } ++ ++ if(!listeners_telnet[port] && !listeners_tcp[port]) { ++ listeners_tcp[port] = clone_object(PORT_OBJECT); ++ listeners_tcp[port]->listen("tcp",port); ++ } else { ++ error("Port "+port+" is already in use."); ++ } ++ } ++ ++ /* + * NAME: set_telnet_manager() + * DESCRIPTION: set the telnet manager object, which determines what the + * user object is, based on the first line of input +*************** +*** 67,73 **** +--- 118,128 ---- + void set_telnet_manager(int port, object manager) + { + if (SYSTEM()) { ++ if(!port) port = TELNET_PORT; + telnet[port] = manager; ++ DRIVER->message("telnet manager for port "+port+ " is now "+ ++ object_name(manager)+"\n"); ++ start_telnet_listener(port); + } + } + +*************** +*** 82,88 **** +--- 137,147 ---- + void set_binary_manager(int port, object manager) + { + if (SYSTEM()) { ++ if(!port) port = BINARY_PORT; + binary[port] = manager; ++ DRIVER->message("binary manager for port "+port+ " is now "+ ++ object_name(manager)+"\n"); ++ start_tcp_listener(port); + } + } + +*************** +*** 100,105 **** +--- 159,165 ---- + user = names[str]; + if (!user) { + user = telnet[port]; ++ if(!user) user = binary[port]; + if (user) { + user = (object LIB_USER) user->select(str); + } else { +*************** +*** 123,129 **** + user = names[str]; + if (!user) { + user = binary[port]; +! if (user && (str != "admin" || port != 0)) { + user = (object LIB_USER) user->select(str); + } else { + user = clone_object(DEFAULT_USER); +--- 183,190 ---- + user = names[str]; + if (!user) { + user = binary[port]; +! if(!user) user = telnet[port]; +! if (user && (str != "admin" || port != EMERGENCY_PORT)) { + user = (object LIB_USER) user->select(str); + } else { + user = clone_object(DEFAULT_USER); +*** kernellib/usr/System/initd.c Thu Jan 1 00:00:00 1970 +--- kernellib/usr/System/initd.c Thu May 21 15:10:52 2009 +*************** +*** 0 **** +--- 1,32 ---- ++ # include <kernel/kernel.h> ++ ++ private void ++ load(string filename) ++ { ++ if (!find_object(filename)) { ++ compile_object(filename); ++ } ++ } ++ ++ static void ++ create() ++ { ++ load("/kernel/sys/telnet_port"); ++ load("/kernel/sys/binary_port"); ++ } ++ ++ void ++ prepare_reboot() ++ { ++ if (previous_program() == DRIVER) { ++ /* ... */ ++ } ++ } ++ ++ void ++ reboot() ++ { ++ if (previous_program() == DRIVER) { ++ /* ... */ ++ } ++ } diff --git a/net/dgd/files/patch-comp.c b/net/dgd/files/patch-comp.c deleted file mode 100644 index 42e2c320c7db..000000000000 --- a/net/dgd/files/patch-comp.c +++ /dev/null @@ -1,19 +0,0 @@ -$FreeBSD$ - ---- src/comp/comp.c.orig 2009-07-03 21:10:25.000000000 -0700 -+++ src/comp/comp.c 2009-07-03 21:12:26.000000000 -0700 -@@ -699,6 +699,14 @@ - return (string *) NULL; - } - -+#ifdef NETWORK_PACKAGE -+bool comm_is_connection(obj) -+object *obj; -+{ -+ return FALSE; -+} -+#endif -+ - /* - * NAME: comm->close() - * DESCRIPTION: pretend to remove a user diff --git a/net/dgd/files/patch-mud.dgd b/net/dgd/files/patch-mud.dgd deleted file mode 100644 index 8cb2e73831a3..000000000000 --- a/net/dgd/files/patch-mud.dgd +++ /dev/null @@ -1,13 +0,0 @@ -$FreeBSD$ - ---- mud.dgd.orig 2003-12-30 18:58:57.000000000 -0800 -+++ mud.dgd 2009-05-24 22:28:04.000000000 -0700 -@@ -4,7 +4,7 @@ - users = 40; /* max # of users */ - editors = 40; /* max # of editor sessions */ - ed_tmpfile = "../tmp/ed"; /* proto editor tmpfile */ --swap_file = "../tmp/swap"; /* swap file */ -+swap_file = "../tmp/dgd.swap"; /* swap file */ - swap_size = 1024; /* # sectors in swap file */ - cache_size = 50; /* # sectors in swap cache */ - sector_size = 512; /* swap sector size */ diff --git a/net/dgd/pkg-plist b/net/dgd/pkg-plist index afa891bef11d..1b513cb69ab0 100644 --- a/net/dgd/pkg-plist +++ b/net/dgd/pkg-plist @@ -2,6 +2,8 @@ bin/precomp etc/dgd/kernel.dgd etc/rc.d/dgd.sh.sample sbin/dgd +%%DATADIR%%/kernel/doc/README.kernel +%%DATADIR%%/kernel/doc/kernel/Changelog %%DATADIR%%/kernel/doc/kernel/efun/add_event %%DATADIR%%/kernel/doc/kernel/efun/call_limited %%DATADIR%%/kernel/doc/kernel/efun/call_other @@ -24,6 +26,7 @@ sbin/dgd %%DATADIR%%/kernel/doc/kernel/hook/driver %%DATADIR%%/kernel/doc/kernel/hook/rsrcd %%DATADIR%%/kernel/doc/kernel/hook/userd +%%DATADIR%%/kernel/doc/kernel/kernel.dgd %%DATADIR%%/kernel/doc/kernel/lfun/allow_subscribe %%DATADIR%%/kernel/doc/kernel/lfun/create %%DATADIR%%/kernel/doc/kernel/lfun/query_owner |