I've started using telnetd and it works great and is very stable, I have to say.
Oke, but now my question:
I would like to catch the function keys like F1, F2, F3
etc and ESC.
Some keys are predefined in BasicTerminalIO like
BACKSPACE, but not those mentioned above.
When I log the key value,
I see 1202 after 3 times ESC
and 1202 for F1 .. F4,
for F5 .. F12 I see different nummer
eg. F12 = 1202,52,126
eg. F5 = 1202,53,126
Can I use/catch those keys in TelnetD, and how?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The definitions in the BasicTerminalIO are mainly to cover the NVT from the telnet specification (Network Virtual Terminal).
There are two levels of negotiation in the protocol, one is at the telnet protocol level, the other at the terminal level. What you see above is pretty clear to me, the ESC is the indicator for the terminal level (Escape Sequences) and needs to be "escaped".
1202 is defined in Terminal IO as an unrecognized Terminal Escape Sequence. Given that this sequences are usually longer, one or two bytes will have been consumed (and you will only see them if you debug print the raw input).
See:
public static final int UNRECOGNIZED = 1202; //escape match missed
You can use these keys in TelnetD, but you need to put hands on a terminal implementation (likely these sequences are different for different terminals). The actual translation happens in the terminal implementations, in the
public int translateEscapeSequence(int[] buffer) method.
Regards,
Dieter
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Oke, I started to examine the
public int translateEscapeSequence(int[] buffer) method.
With F1 .. F4 I succeed to recognize.
eg. F1 = [79, 80] (from my ansi Terminal)
But than F5 and further react different:
F5 = [91, 49], followed by 2 seperate characters: 53 and 126.
F5 = [91, 49], followed by 2 seperate characters: 55 and 126.
In TerminalIO.java, method private int handleEscapeSequence(int i) throws IOException.
You call m_Terminal.getAtomicSequenceLength() and that returns 2.
Shouldend this be larger (eg. 4)?
Where can I find the specs for the terminal level of nvt of an Ansi Terminal (couldn't find it in the spec part of the documentation on the website)?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There is no "real" ANSI terminal, it's rather VT100 with color extensions, but well. Welcome to the world of terminals :)
Now, I have pretty much changed this code since the last checkins.
The reason is that I am working on an OSGi version.
Would you be interested in a working copy?
Especifically I have changed much of the Escape Sequence handling, and I have also added a better editor, and SSH2 listener support etc.
Regards,
Dieter
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The OSGi version is basically a bundle for an OSGi container.
It allows other bundles to create listeners through the CM factory pattern, and supports configuration through MetaType.
(For general info see http://www.osgi.org or http://en.wikipedia.org/wiki/OSGi\).
It's based on the telnetd standalone codebase but comes with quite some fixes and some updates that adapted it to OSGi. It should be stable, at least as much as the version you are using now. You can obtain it from me at the moment (mail me); I did not have the time yet to bring it into a repository.
Regards,
Dieter
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've started using telnetd and it works great and is very stable, I have to say.
Oke, but now my question:
I would like to catch the function keys like F1, F2, F3
etc and ESC.
Some keys are predefined in BasicTerminalIO like
BACKSPACE, but not those mentioned above.
When I log the key value,
I see 1202 after 3 times ESC
and 1202 for F1 .. F4,
for F5 .. F12 I see different nummer
eg. F12 = 1202,52,126
eg. F5 = 1202,53,126
Can I use/catch those keys in TelnetD, and how?
The definitions in the BasicTerminalIO are mainly to cover the NVT from the telnet specification (Network Virtual Terminal).
There are two levels of negotiation in the protocol, one is at the telnet protocol level, the other at the terminal level. What you see above is pretty clear to me, the ESC is the indicator for the terminal level (Escape Sequences) and needs to be "escaped".
1202 is defined in Terminal IO as an unrecognized Terminal Escape Sequence. Given that this sequences are usually longer, one or two bytes will have been consumed (and you will only see them if you debug print the raw input).
See:
public static final int UNRECOGNIZED = 1202; //escape match missed
You can use these keys in TelnetD, but you need to put hands on a terminal implementation (likely these sequences are different for different terminals). The actual translation happens in the terminal implementations, in the
public int translateEscapeSequence(int[] buffer) method.
Regards,
Dieter
Oke, I started to examine the
public int translateEscapeSequence(int[] buffer) method.
With F1 .. F4 I succeed to recognize.
eg. F1 = [79, 80] (from my ansi Terminal)
But than F5 and further react different:
F5 = [91, 49], followed by 2 seperate characters: 53 and 126.
F5 = [91, 49], followed by 2 seperate characters: 55 and 126.
In TerminalIO.java, method private int handleEscapeSequence(int i) throws IOException.
You call m_Terminal.getAtomicSequenceLength() and that returns 2.
Shouldend this be larger (eg. 4)?
Where can I find the specs for the terminal level of nvt of an Ansi Terminal (couldn't find it in the spec part of the documentation on the website)?
There is no "real" ANSI terminal, it's rather VT100 with color extensions, but well. Welcome to the world of terminals :)
Now, I have pretty much changed this code since the last checkins.
The reason is that I am working on an OSGi version.
Would you be interested in a working copy?
Especifically I have changed much of the Escape Sequence handling, and I have also added a better editor, and SSH2 listener support etc.
Regards,
Dieter
Yes, that would be nice.
BTW. What is the OSGi version?
How to get it?
How stable is it?
Thanx in advance,
Marcel
Marcel,
The OSGi version is basically a bundle for an OSGi container.
It allows other bundles to create listeners through the CM factory pattern, and supports configuration through MetaType.
(For general info see http://www.osgi.org or http://en.wikipedia.org/wiki/OSGi\).
It's based on the telnetd standalone codebase but comes with quite some fixes and some updates that adapted it to OSGi. It should be stable, at least as much as the version you are using now. You can obtain it from me at the moment (mail me); I did not have the time yet to bring it into a repository.
Regards,
Dieter