[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [DISC] Escaping #$#



>> Another item missing from the spec:
>> 
>>   How do you escape/quote a line beginning with #$#  ?
> 
> A while ago we talked about having an MCP message that was
> equivalent to sending an "in-band" line (i.e., one without MCP
> message syntax).  I don't know if this made it into the spec, but it
> could be used to solve the quoting problem as well as the problem it
> was proposed to solve:
> 
>   #$#mcp-verbatim line: "#$# says, \"I've got a stupid name!\""
>
> This would, again, be impossible on the current MOO server (unless
> you were already using in-db parsing).  For commands, you could use
> 
>    force_input(player, " " + line);
> 
> but this wouldn't be quite right when the line is to be read().

I think the problem with the MOO server is, in fact, going to be a
general one with other clients/servers as well, i.e., that by the time a
"verbatim message" line reaches the MCP dispatcher it may be too late to
re-insert it back into the in-band stream.  

This indicates to me that the MCP message dispatcher is just
conceptually the *wrong* place to be doing the unquoting; unquoting
needs to happen in the underlying layer, the one that sorts out the OOB
messages from the regular stream in the first place.  

Note that the current spec does not make a very clear distinction
between MCP message layer and this underlying layer, a distinction
that's important in the case where the layers are implemented in
distinct places (as happens with the MOO server).

Thus, I'll suggest the following rewrites

Replace

    <DT> Session
    ...
    <DT> Packages

with

    <DT> Session
    
    <DD> A <EM>session</EM> is a bidirectional stream of <EM>network
    lines</EM>.  MCP requires that each direction of this stream
    guarantee ordered, reliable message delivery, but there need not
    be synchronization between the two directions.  The standard
    implementation of a session is a TCP connection; however, any
    protocol which meets the session requirements may be used.

    <DT>Network Lines 

    <DD> A <EM>network line</EM> consists of a sequence of (ASCII)
    bytes terminated by a network newline.  The MCP protocol does not
    impose a line-length restriction, and the definition of
    "network-newline" depends on the network over which MCP is
    carried, and is not specified here.  An agent (client or server)
    receiving a network line translates it to either an
    <EM>in-band</EM> or an <EM>out-of-band</EM> line as described
    below.

    <DT> In-band lines

    <DD> In-band lines are for text generated by a client or server
    intended (in the case of client-generated text) to be interpreted
    as a command or (in the case of server-generated text) to be
    immediately visible to the user.  

    MCP places no restriction on the content of in-band lines beyond
    what restrictions already exist for network lines in the
    underlying protocol.

    <DT> Out-of-band lines

    <DD> Out-of-band lines are text/data passed between MUD client and
    server that is not intended to be directly user-visible or
    interpreted as user keyboard-input commands.
    
    MCP is a standard for the recognition and format of out-of-band
    lines.  Out-of-band lines will also be referred to as MCP
    <EM>message lines</EM>.

    <DT> Messages

    <DD> An MCP <EM>message</EM> is an ordered collection of one or
    more MCP message lines consisting of the initial message line,
    zero or more <EM>message-continuation</EM> lines for the
    multiline keywords in the start message, and a
    <EM>multiline-end</EM> line if the message contains 
    any multiline values.

    <DT> Packages

We then replace 

   <H2>Message Format</H2>
   <P>All MCP messages begin with the literal string <SAMP>#$#</SAMP>.

   <P>An MCP message consists of three basic parts: 

with

    <H2>Network line translation</H2>

    A received network line that begins with the characters
<SAMP>#$#</SAMP>
    translates to an out-of-band (message) line consisting of exactly
    the same characters.

    A received network line that begins with the characters
<SAMP>#$"</SAMP>
    translates to an in-band line consisting of the suffix beyond the
    first 3 characters (even if that suffix happens to begin with
    <SAMP>#$"</SAMP> or <SAMP>#$#</SAMP>).

    Any other received network line translates to an in-band line
consisting
    of exactly the same characters.

    Every in-band line to be sent must, upon translation to a network
    line, be <EM>quoted</EM>, i.e., prefixed with <SAMP>#$"</SAMP>,
    if it would otherwise be translated to an out-of-band line by the 
    recipient (i.e., it begins with either <SAMP>#$#</SAMP> or
    <SAMP>#$"</SAMP>).

    Out-of-band lines being sent require no quoting.

    <H2>MCP Message Format</H2> 

    <P>An MCP message line consists of three basic parts: