WvStreams
wvstreamsdebuggerserver.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * A server stream for WvStreamsDebugger connections
6  */
7 #ifndef __WVSTREAMSDEBUGGERSERVER_H
8 #define __WVSTREAMSDEBUGGERSERVER_H
9 
10 #include "wvstream.h"
11 #include "wvstreamclone.h"
12 #include "wvaddr.h"
13 #include "wvistreamlist.h"
14 #include "wvstreamsdebugger.h"
15 #include "wvlog.h"
16 
17 class WvUnixAddr;
18 class WvUnixListener;
19 class WvTCPListener;
20 
22 {
23  struct Connection : public WvStreamClone
24  {
25  WvStreamsDebugger debugger;
26  WvString salt;
27 
28  Connection(IWvStream *s);
29 
30  void result_cb(WvStringParm cmd, WvStringList &results);
31 
32  void send(WvStringParm code, WvStringParm result);
33  void send(WvStringParm code, WvStringList &results);
34 
35  void choose_salt();
36  };
37  // Username, salt, md5sum("%s%s", salt, password)
38  typedef wv::function<bool(WvStringParm, WvStringParm, WvStringParm)> AuthCallback;
39 
40  WvLog log;
41 
42  WvUnixListener *unix_listener;
43  void unix_listener_cb(IWvStream *s);
44  void unix_listener_close_cb();
45 
46  WvTCPListener *tcp_listener;
47  void tcp_listener_cb(IWvStream *s);
48  void tcp_listener_close_cb();
49 
50  AuthCallback auth_cb;
51 
52  void auth_request_cb(Connection &s);
53  void auth_response_cb(Connection &s);
54  void ready_cb(Connection &s);
55 
56  WvIStreamList streams;
57 
58 public:
59  WvStreamsDebuggerServer(const WvUnixAddr &unix_addr,
60  AuthCallback _auth_cb = AuthCallback(),
61  const WvIPPortAddr &tcp_addr = WvIPPortAddr());
63 
64  void set_auth_callback(AuthCallback _auth_cb)
65  { auth_cb = _auth_cb; }
66 };
67 
68 #endif // __WVSTREAMSDEBUGGERSERVER_H
WvStreamsDebugger
Definition: wvstreamsdebugger.h:12
IWvStream
Definition: iwvstream.h:24
WvTCPListener
Class to easily create the Server side of a WvTCPConn.
Definition: wvtcplistener.h:16
WvString
WvString is an implementation of a simple and efficient printable-string class.
Definition: wvstring.h:329
WvLog
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
Definition: wvlog.h:56
WvIPPortAddr
An IP+Port address also includes a port number, with the resulting form www.xxx.yyy....
Definition: wvaddr.h:393
WvStreamClone
WvStreamClone simply forwards all requests to the "cloned" stream.
Definition: wvstreamclone.h:23
WvStream
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
Definition: wvstream.h:24
WvUnixListener
Server end of a Unix Sockets stream.
Definition: wvunixlistener.h:15
WvIStreamList
WvStreamList holds a list of WvStream objects – and its select() and callback() functions know how to...
Definition: wvistreamlist.h:20
WvUnixAddr
A Unix domain socket address is really just a filename.
Definition: wvaddr.h:429
WvStringList
This is a WvList of WvStrings, and is a really handy way to parse strings.
Definition: wvstringlist.h:27
WvStreamsDebuggerServer
Definition: wvstreamsdebuggerserver.h:21