/
CDC-1.2b/
CDC-1.2b/src/
parent $has_commands
parent $network_root
object $connection_interfaces

var $root dbref 'connection_interfaces
var $root child_index 3
var $root fertile 0
var $root manager $connection_interfaces
var $root owned [$connection_interfaces]
var $root owners [$connection_interfaces]
var $root writable []
var $root readable ['parameters, 'methods, 'code]
var $has_commands commands []
var $has_commands shortcuts []
var $root inited 1
var $connection_interfaces connection 0
var $old_command_environment verb_cache #[]
var $old_command_environment command_cache []
var $old_command_environment shortcuts_cache []

method timeout
    // the connection is asking the interface if it should timeout
    // and close the connection.
    return 1;
.

method parse_line
    arg line;
    var cmd;
    
    // don't use the normal parsing system because it involves
    // a bit of overhead.
    catch any {
        while (line && ((line[1]) == " "))
            line = substr(line, 2);
        if (!line) {
            return .null_cmd(line);
        } else {
            cmd = .match_command(line);
            if (cmd)
                return (> .(cmd[1])(@cmd[2]) <);
            else
                return (> .invalid_cmd(line) <);
        }
    } with handler {
        if (((traceback()[1])[3]) != 'no_traceback) {
            .send($parse.traceback(traceback()));
            return 'disconnect;
        }
    }
.

method init_connection_interface
    (> .perms(caller(), $root) <);
    connection = 0;
.

method uninit_connection_interface
    (> .perms(caller(), $root) <);
    connection = 0;
.

method connection_going_away
    arg addr, port;
    
    (> .perms(caller(), $connection) <);
    (> .perms(sender(), connection) <);
    (> .destroy() <);
.

method linelen
    return 79;
.

method new_connection
    arg addr;
    
    (> .perms(caller(), $connection) <);
    connection = sender();
.

method send
    arg what;
    
    connection.send(what);
.

method null_cmd
    arg line;
    
    return 'disconnect;
.

method invalid_cmd
    arg line;
    
    return 'disconnect;
.

method connection
    return connection;
.

method connection_starting
    // called by connection.connect()
.

method tell
    arg line;
    
    // this is redundant, but .tell() is standard in the core, and things break
    // without it.
    (> .send(line) <);
.