I am trying to build my own subsystem class, following the example of SftpSubsystemChannel. The subsystem I am dealing with is called "netconf", a configuration method for Juniper routers. Basically, if you do "ssh -s <IP> netconf", you'll be able to type in RPC requests in XML format and get responses in XML as well.
The syntax of the messages is actually very simple. Basically a request is:
<rpc>
blabla
</rpc>
]]>]]>
A response is:
<rpc-reply>
blabla
</rpc-reply>
]]>]]>
I have two questions. I looked at the code for SubsystemMessageStore() class. It seems that it assumes that each message starts with the message type. Also, in SubsystemChannel() class, each message start with a length. Is this true for all subsystems?
Second, I built my own "netconf" subsystem. The debug info showed that "Channel request succeeded". But I got onMsgChannelEOF after exactly 30 seconds. Does anyone know why?
Thanks.
-Simon
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found where the problem is. The "netconf" subsystem just sends ascii back and forth. So, in this case, the onChannelData() function in SubsystemChannel() class will mishandle the data stream, because it tries to first read a 4-byte message size and then read byte stream of that size.
Should we consider modify the subsystem branch to make it more general?
Thanks.
-Simon
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all,
I am trying to build my own subsystem class, following the example of SftpSubsystemChannel. The subsystem I am dealing with is called "netconf", a configuration method for Juniper routers. Basically, if you do "ssh -s <IP> netconf", you'll be able to type in RPC requests in XML format and get responses in XML as well.
The syntax of the messages is actually very simple. Basically a request is:
<rpc>
blabla
</rpc>
]]>]]>
A response is:
<rpc-reply>
blabla
</rpc-reply>
]]>]]>
I have two questions. I looked at the code for SubsystemMessageStore() class. It seems that it assumes that each message starts with the message type. Also, in SubsystemChannel() class, each message start with a length. Is this true for all subsystems?
Second, I built my own "netconf" subsystem. The debug info showed that "Channel request succeeded". But I got onMsgChannelEOF after exactly 30 seconds. Does anyone know why?
Thanks.
-Simon
Hi guys,
I found where the problem is. The "netconf" subsystem just sends ascii back and forth. So, in this case, the onChannelData() function in SubsystemChannel() class will mishandle the data stream, because it tries to first read a 4-byte message size and then read byte stream of that size.
Should we consider modify the subsystem branch to make it more general?
Thanks.
-Simon