This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Telnet support for eCos - Interfacing Telnet / Remote Console to File IO


David Webster wrote:
> 
>         - if not what is the best way for me to interface telnet between
> the network stack sockets and the file system?
>         It's fairly easy to implement a "server" thread that sits and
> listens on port 23 for an incoming connection. The telnet state machine
> (processing the IAC escape mechanism etc) is also pretty easy to
> implement. But it's the gluing it all together (as usual) that's more
> difficult.
>         Assuming that I can write a "server" thread that listens for
> connections and creates a new socket on accept. I can now pass this
> socket id to my telnet state machine that can process any data that is
> written to the socket or read from the socket. But how does this telnet
> state machine provide a File io interface. Can I dynamically create a
> FILE that my CLI can use for i/o operations?

Yes, but only with option 2 below.

>         There seem to be two ways (probably more?):
>         1.      using the device driver api - I could (statically)
> create say 2 telnet devices ("/dev/telnet1" and "/dev/telnet2"). My CLI
> opens one of these "files" for its io operation and I write a new serial
> device driver that actually performs my telnet state machine and
> interfaces to the appropriate socket. Sounds like it should work - I
> think I'd be limited to a fixed number of telnet sessions - but it's a
> bit naff.
>         2.      create a new file system, in the same way as "ramfs" /
> "romfs", called "telnetfs". My "server" thread should then be able to
> create a new telnet "file" when a connection is established which my CLI
> can use for its file io. But I'd have to implement entire file system
> handling required by eCos - which sounds a big job and a bit daunting to
> me? Does anybody have a feel for how easy this would be? I guess I can
> use devfs or ramfs as examples of what need doing. It seems a better way
> than 1) but a lot more work.

Don't overestimate how long a filesystem would take - you aren't supporting
directories, just a direct file. You're not actually worried about seeks
and so on, it's just a stream. I think it's much simpler than I believe you
think. Start with romfs and just fill in the gaps (adding write support).

Hey, if you get this working, then please consider contributing it back
(telnet server and this fs), so other people can use it, just like you were
hoping someone had already done it!

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]