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
17class WvUnixAddr;
18class WvUnixListener;
19class 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
58public:
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
A WvFastString acts exactly like a WvString, but can take (const char *) strings without needing to a...
Definition wvstring.h:94
An IP+Port address also includes a port number, with the resulting form www.xxx.yyy....
Definition wvaddr.h:394
WvStreamList holds a list of WvStream objects – and its select() and callback() functions know how to...
A WvLog stream accepts log messages from applications and forwards them to all registered WvLogRcv's.
Definition wvlog.h:57
WvStreamClone simply forwards all requests to the "cloned" stream.
Unified support for streams, that is, sequences of bytes that may or may not be ready for read/write ...
Definition wvstream.h:25
This is a WvList of WvStrings, and is a really handy way to parse strings.
WvString is an implementation of a simple and efficient printable-string class.
Definition wvstring.h:330
Class to easily create the Server side of a WvTCPConn.
A Unix domain socket address is really just a filename.
Definition wvaddr.h:430
Server end of a Unix Sockets stream.