This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


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

Re: CYGWIN SERVER: Some questions


Hi!

Monday, 03 September, 2001 Corinna Vinschen vinschen@redhat.com wrote:

CV> The most important question IMO is, how do we design the communication
CV> protocol? It should combine all qualities which can't live together in
CV> reality but only on marketing papers:

CV> 1. Platform independent (from a Wincentric point of view, 9x/NT)
CV> 2. Fast
CV> 3. Reliable
CV> 4. Secure
CV> 5. Easy to use
CV> 6. Expandable

server should know when client dies (i'm not sure if it's implied by
"Reliable"). that's, btw, is a "Con" for at least Shared memory,
probably for DDE and RPC too.

CV> What did we found to date? We already discussed the transport layer
CV> back in June but we have no result so far. Possible transport layers
CV> are:

CV> - Sockets (Pro: Platform independent, Easy to use, Con: Secure)
CV> - Shared memory (Pro: Platform independent, Fast, Con: Secure)
CV> - Named pipes (Pro: Secure, Con: Platform independent)
CV> - DDE (Pro: Platform independent, Secure, Con: Easy to use???)
CV> - RPC (Pro: Platform independent, Secure, Con: Easy to use???)
CV> - COM (Pro: Platform independent, Con: Easy to use???)

As for transport layer, i believe we should design the protocol in
such a way that transport layer can be (more-or-less) easily switched.
i.e. we create "transport-level" abstract class (see class
server_connection below), and several implementations of such
interface using all or some of beforementioned OS primitives.

typedef enum {
  conn_status_not_established, /* not connected (yet) */
  conn_status_ready,           /* connection established, no requests currently */
  conn_status_processing,      /* server is processing the request */
} conn_status;

class server_connection
{
  conn_status connection_status;
public:
  conn_status get_connection_status ();
  int make_connection (int timeout);
  int accept (int timeout);
  HANDLE ready_to_read ();  /* HANDLE is signalled when connection is ready to read */
  HANDLE ready_to_write (); /* ... ready to write */
  int read (char* buf, int size);
  int write (char* buf, int size);

  /* call_server (...); */
  /* is there any need for "flat" connection in the case of RPC or
     COM? */

  int close ();
}

hmm, this makes abstract connection look similar to yet another
fhandler...

i think connections should be made on per-thread basis, rather than
per-process to avoid a host of problems with thread-safety. i think
thread-safety should be assured by server.

CV> The next thingy is, how to implement the high level protocol?
CV> It should be expandable so that a new server feature doesn't
CV> neccessarily imply a change in the protocol e.g. by using
CV> a function oriented interface like open_server(), write_server(),
CV> read_server(), close_server() with a defined structure or string
CV> for sending and receiving data.  Or we prefer the ease of use over
CV> the easy expandability.  A C++ class oriented interface comes to mind.
CV> Anyway, food for discussion.

here, the only problem i see is convenient way to linearize-delinearize
(or marshall-unmarshall, in MS terminology) complex data structures to
linear connection. native RPC dlls do contain some functions to
perform marshalling, but i've never used them and suspect they need
some kind of IDL (interface definition language) with appropriate
compiler.

CV> Which functionality would be thankful to be implement using a server?
CV> Currently I know of

CV> - Secure tty's (No access to other processes handles).
CV> - suid, sgid applications (start a privileged app on behalf of a non-
CV>   privileged app).
CV> - ipc (shm, sem, msg).
CV> - pthreads synchronisation stuff (did I get that right?)

mkfifo and fifo's

Egor.            mailto:deo@logos-m.ru ICQ 5165414 FidoNet 2:5020/496.19


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