[DGD]Object manager released
Chris Kaczor
zor at mediaone.net
Thu Sep 21 23:42:04 CEST 2000
Okay - after some hair pulling I think I got this working. =)
Here is my initd.c:
static void create()
{
compile_object("obj/user");
compile_object("sys/telnet");
"/kernel/sys/userd"->set_telnet_manager(find_object("sys/telnet"));
}
And here is my telnet.c:
void create()
{
}
object select(string str)
{
object user;
user = clone_object("/usr/System/obj/user");
return user;
}
int query_timeout(object connection)
{
return 15;
}
string query_banner(object connection)
{
return "Login: ";
}
Does that look right? Is the telnet manager supposed to keep track of the
user object it gives out so it can return them for another select later on?
It doesn't seem that it should as userd.c appears to be doing that.
Right now I'm using a copy of the default kernel library user.c for
testing - but now that I've got my own copy running I can create a new one
from scratch.
One thing that threw me for awhile is the fact that clone_object for the
user wouldn't work if I didn't do a compile_object first - but that makes
sense now. I'm just used to clone doing all the work for me. =)
Thanks everyone for the help - I think I've got enough to chew on for
awhile.
Zor
-----Original Message-----
From: dgd-admin at list.imaginary.com
[mailto:dgd-admin at list.imaginary.com]On Behalf Of Felix A. Croes
Sent: Thursday, September 21, 2000 8:09 AM
To: dgd at list.imaginary.com
Subject: RE: [DGD]Object manager released
"Chris Kaczor" <zor at mediaone.net> wrote:
> Yeah - I learn best from examples which is why I latched onto Melville -
it
> was already working in a way that I could map to my understanding of 2.4.5
> and work from there.
>
> The kernel lib is so basic I'm just lost on where to start - I have a
vague
> understanding of the basics but I'm not sure how to start even after
reading
> the documentation.
Try to approach the kernel lib as an operating system rather than
a 2.4.5-like mudlib. The best way to start may be to login as
admin, and trying out all the commands in /kernel/lib/wiztool.c
(other than those, all commands you have are "say", "tell", "users"
and "quit").
There are no rooms or typical other mud-things, but there are admins,
wizards and unprivileged users. The kernel lib is a combination of
a minimal programming environment -- the wiztool is actually quite
powerful -- and a core mudlib that something bigger can be built
on top of. It enforces a difference between inherited objects and
other ("used") objects that is essential for upgrading entire trees
of objects.
> It seems the core of starting is in this paragraph:
>
> When you begin building, start with making a new user object. This object
> should reside in /usr/System/obj and must save user information in /save,
if
> it saves at all. The user object must inherit /kernel/lib/user. Next,
> create a telnet connection manager which can be installed using
> "/kernel/sys/userd"->set_telnet_manager(obj). Finally, create
> /usr/System/initd.c which handles system-specific initialization (for
> instance, the telnet connection manager must be installed from the
create()
> function).
The overview document is rather out of date (it was created prior to
the first release in 1997). Creating better kernel lib documentation
has a high priority now, I will probably start on it during the next
few weeks.
> The first part about creating a new /usr/System/obj/user.c and inheriting
> user from the kernel lib seems pretty straightforward. After that I'm
> lost...
>
> For example - "create a telnet connection manager" - does that mean I need
> to load one that already exists or write my own? It seems this is what
> "\dgd\mud\kernel\obj\telnet.c" is for?
You must write your own telnet connection manager so you can use
actually use your non-kernel user object. The telnet connection
manager doles out user objects for incoming telnet connections.
> The creation of /usr/System/initd.c seems much like the first part - it
> seems I need to give it a create function and install the telnet manager
in
> there - something like the following?
>
> static void create()
> {
> compile_object("/kernel/obj/telnet");
>
>
>
"/kernel/sys/userd"->set_telnet_manager(find_object("/kernel/obj/telnet"));
> }
You don't have to compile /kernel/obj/telnet; it is already compiled
by the kernel library :) It also has a purpose already; it is the
connection object for a telnet connection. You should write a new
telnet manager which gives out user objects that, by inheriting
/kernel/lib/user, will communicate with such a telnet object.
> This seems to actually load but I get errors when I try to connect...maybe
> that's not really the telnet manager?
>
> If someone has some small files or code snippets to share that I could
learn
> from I would appreciate it. It seems I am on the right track because I
can
> insert the error daemon code from Erwin in that create function above and
I
> get differently formatted error information when I try to connect - so at
> least something is working - even though it is an error. =)
See /doc/kernel/hook/userd for the specifications of telnet connection
manager.
Regards,
Dworkin
List config page: http://list.imaginary.com/mailman/listinfo/dgd
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list