From: Hemang L. <hl...@ci...> - 2006-08-11 04:29:48
|
Hi Andreas, What is the main purpose of this library? If I understand correctly, it seems like a wrapper utility to create the (safe) interpreter and a comm channel within it. For example: ::comm::comm::interp::safe ?-option val...? can be coded as: set i [interp create -safe] $i eval { package require comm ::comm::comm new ?-option val...? } And comm::interp::link is probably same as "interp transfer {} <comm_chan> $i". At first, I thought this package provides safe interp restrictions on the commands sent over the comm wire and that the filtered set of remote commands received would still be executed in the main interpreter. However, on further thought, such a functionality (if developed) should not be called interp and your current approach of creating new interp for each channel looks reasonable. For comm::interp::safe and safeBasic commands you may also want to support optional ?exeip? argument. Also, for comm::interp::protocol API, will it internally create <exeip> or are users expected to create it before calling it? BTW, ::comm::comm::interp looks too long. You may want to drop one "comm" and call it ::comm::interp. Hemang. Andreas Kupries wrote: > comm::interp - Remote communication > Generated from file './modules/comm/interp.man' by tcllib/doctools with format > 'text' > comm::interp(n) 0.1 comm "Remote communication" > > NAME > ==== > > comm::interp - Linking communication channels to interpreters > > SYNOPSIS > ======== > > package require Tcl 8.4 > package require comm ?0.1? > > ::comm::comm::interp::protocol ?-option val...? cmds ?exeip? > ::comm::comm::interp::safeBasic ?-option val...? > ::comm::comm::interp::safe ?-option val...? > ::comm::comm::interp::link comm ip > > DESCRIPTION > =========== > > The package *comm::interp* is a supplement to the package *comm* providing > facilities to easily link comm channels to Tcl interpreters. By default the > scripts received by a comm channel are executed in the main interpreter of the > receiving process, making for a very insecure model of execution. Something to > be used only in a very secure and/or trusted environment. For everyone else this > package was written, allowing the easy compartmentalization of execution, > restriction to a safe environment, to specific commands, etc. Together with the > ability of *comm* to create multiple channels, non-listening channels, local > channels, etc. it is possible to handle a very wide range of security > requirements. > > API > === > > ::comm::comm::interp::protocol ?-option val...? cmds ?exeip? > > This command creates a new communication channel which understands only > the commands listed as the keys of the dictionary cmds. The associated > values are the actual commands executed in their lieu, in the > interpreter exeip. This interpreter defaults to the main interpreter of > the thread this command is executed in. > > To facilitate the above the command creates an internal interpreter > which aliases the commands to the execution interpreter on the one hand, > and is linked to the communication channel on the other hand. > > The command returns the path of the internal interpreter to enable the > caller to perform additional intializations. Using an empty cmds mapping > for example leaves us with an empty interpreter to be initialized at > will. > > The options and their values coming before the cmds mapping are > delegated to the new communication channel. The known options are -port, > -local, and -silent, with the same meaning as explained in the > documentation for the package *comm*. The option -listen is not > recognized, as the new communication channel will always listen for > incoming scripts, this cannot be deactivated. > > ::comm::comm::interp::safeBasic ?-option val...? > > This command a new communication channel which understands all the > commands of a basic safe interpreter. The safe interpreter used for the > execution of the received scripts is created by the command and returned > as its result, to enable the caller to perform additional initialization > at will. > > The term _basic_ means that the created interpreter is the plain result > of invoking interp create -safe. > > The options and their values are delegated to the new communication > channel. See comm::interp::protocol for the in-depth explanation of the > recognized options. > > ::comm::comm::interp::safe ?-option val...? > > This command a new communication channel which understands all the > commands of a safe interpreter crated by the *safe* package of the Tcl > core. The safe interpreter used for the execution of the received > scripts is created by the command using the command ::safe::interpCreate > and returned as its result, to enable the caller to perform additional > initialization at will. > > The options and their values are delegated to the new communication > channel. See comm::interp::protocol for the in-depth explanation of the > recognized options. > > ::comm::comm::interp::link comm ip > > This command takes an existing communication channel/object comm, and an > existing interpreter ip and links them together. Afterward all scripts > received by the channel are executed within the interpreter ip. > > This is the core functionality of this package, used by all preceding > commands. It allows the most flexibility as both communication channel > and executing interpreter can be created and configured at will. Thereas > for the preceding commands the communication channel is restricted to a > listener, and the interpreters are various forms of safe environments. > > SEE ALSO > ======== > > comm > > KEYWORDS > ======== > > communication, ipc, message, remote communication, rpc, socket > > COPYRIGHT > ========= > > Copyright (c) 2006 Andreas Kupries. > > -- > Andreas Kupries <and...@Ac...> > Developer @ http://www.ActiveState.com > Tel: +1 778-786-1122 > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Tcllib-devel mailing list > Tcl...@li... > https://lists.sourceforge.net/lists/listinfo/tcllib-devel > |