JMP Protocol
CONSOLE SESSIONS
A Console Session provides access to the JANOS Command Line interpreter.
Practically every operating system has a command line interpreter. Windows(R)
has the DOS Command Prompt. JANOS is no different and in fact provides a
command line interpreter that recognizes many different commands some of which
are similar to commands available in either the DOS or Linux environments. The
command line Console provides the tools needed for JNIOR configuration,
diagnostics and application development.
The Console can be accessed by 115,200 BAUD serial connection to the RS-232
port directly on the JNIOR. If the unit is configured for operation on the
network the Console can also be opened by making a Telnet connection to the
unit. The command line interpreter functions identically using either approach.
The RS-232 diagnostic port provides some additional information such as a boot
dialog chronicling the boot sequence and error messages should critical
assertions occur.
The JMP Server also provides access to the command line interpreter. A JMP
connection can open a Console Session. This is a separate command process
under the control of the JMP Server on behalf of the JMP connection. The
client can supply data simulating keystroke entry and consume characters
output from the session perhaps for display. Only one session can be opened
for each JMP connection although it may be closed and reopened any number of
times while the JMP connection is active.
The dynamic configuration pages supplied with the unit support a "Console" tab
through which the use can interact with the Console Session in a fashion
virtually identical to any Telnet client or serial terminal client application.
You can review the Javascript for more insight.
An application may use a Console session to accomplish some action only
available through the command line interpreter. In such case the session my be
opened, the command or commands executed, and then immediately closed.
CONSOLE OPEN REQUEST
When a JMP connection is made there is no command session associated. If
commands are to be fed to the command line interpreter or a console session
supported it must be opened. The "Console Open" command is then required and
this solicits a "Console Response" message whose "Status" member provides the
status of the result. The outcome can be either "Established" or "Failed".
Below a Console Session is started.
TRANSMITTED RECEIVED
{
"Message":"Console Open"
}
{
"Message":"Console Response",
"Status":"Established"
}
Note that while a Console session is open all other JMP requests and
unsolicited messaging are still valid and active. The console session can
be supported in parallel with all other activity over the connection.
CONSOLE STDIN MESSAGE
The "Console Stdin" message passes character data to the command line
interpreter through its stdin serial stream. These characters function
exactly as if they were typed at the keyboard in a Telnet session. You use
"\r" as the ENTER keystroke. An UP-ARROW or DN-ARROW keystroke is replaced
by its VT-100 escape sequence which the Series 3 and Series 4 JNIORs have
come to expect. Characters entered through the Console tab in the dynamic
configuration pages are each sent immediately as typed one at a time to the
stdin stream. Note that the console session command line interpreter echoes
character input just as it does everywhere else.
{
"Message":"Console Stdin",
"Data":"dir\r"
}
CONSOLE STDOUT MESSAGE
With every stdin stream there is likely a stdout and the Console Session
is no exception. The "Console Stdout" message is transmitted by the server and
it supplies data available for display. This may be echoed characters or
command output. It is delivered asynchronously and therefore may contain 1 or
more characters. It may contain the entire output of a command or only part
depending on JANOS activity levels. In other words this is a character stream
and a single "Console Stdout" message may contain multiple lines of output or
the output from multiple commands. The output from a single console command
may be spread across multiple messages. Applications must be coded with this
in mind. For example this is data from the Console session tab where the
command was typed in and executed.
TRANSMITTED RECEIVED
{"Message":"Console Stdin","Data":"d"}
{"Message":"Console Stdin","Data":"i"}
{"Message":"Console Stdout","Data":"d"}
{"Message":"Console Stdin","Data":"r"}
{"Message":"Console Stdout","Data":"i"}
{"Message":"Console Stdin","Data":"\r"}
{"Message":"Console Stdout","Data":"r"}
{
"Message":"Console Stdout",
"Data":"\r\netc\r\nflash\r\njniorboot.log\r\n
jniorboot.log.bak\r\njniorsys.log\r\n
jniorsys.log.bak\r\nmyfile.txt\r\nphp
.log\r\ntemp\r\n\r\nBruce_Dev /> "
}
This would be the same command executed by an application. The results may not
be consistent although the output of the command certainly should.
TRANSMITTED RECEIVED
{
"Message":"Console Stdin",
"Data":"dir\r"
}
{
"Message":"Console Stdout",
"Data":"dir\r\netc\r\nflash\r\njniorboot.log
\r\njniorboot.log.bak\r\njniorsy"
}
{
"Message":"Console Stdout",
"Data":"s.log\r\njniorsys.log.bak\r\nmyfile.
txt\r\nphp.log\r\ntemp\r\n\r\nBruce
_Dev /> "
}
An application would likely buffer all data until the command line prompt is
detected. Only then can it interpret the list of files supplied reliably.
CONSOLE CLOSE REQUEST
A Console session will remain active until closed. It is automatically closed
should the JMP connection terminate. It is good practice however to close the
command session if there is no immediate need for it. This keeps the load on
JANOS to a minimum and keeps the process slot open for other activities. The
"Console Close" command solicits a "Console Response" message whose "Status"
member indicates "Closed" in all cases.
TRANSMITTED RECEIVED
{
"Message":"Console Close"
}
{
"Message":"Console Response",
"Status":"Closed"
}
EXAMPLE CONSOLE SESSION
Here is a example of opening a command session and logging in using the default
credentials. The session is then closed once the prompt has been reached. Note
how the entry of the password is not echoed. This is just as it is in any JNIOR
Telnet session.
TRANSMITTED RECEIVED
{
"Message":"Console Open"
}
{
"Message":"Console Response",
"Status":"Established"
}
{
"Message":"Console Stdout",
"Data":"\r\nWelcome to the JNIOR Model 410...
Copyright (c) 2012-2015 INTEG Process ...
Local time: Wed Oct 07 13:45:38 EDT 20...
Bruce_Dev login: "
}
{
"Message":"Console Stdin",
"Data":"jnior\r"
}
{
"Message":"Console Stdout",
"Data":"jnior\r\nBruce_Dev password: "
}
{
"Message":"Console Stdin",
"Data":"jnior\r"
}
{
"Message":"Console Stdout",
"Data":"*****\r\n\r\nBruce_Dev /> "
}
{
"Message":"Console Close"
}
{
"Message":"Console Response",
"Status":"Closed"
}
While access to the Console offers a great amount of flexibility for any
application it should not be abused.
[/flash/manpages/protocol.hlp:1265]