WvStreams
Main Page
Modules
Classes
Files
File List
File Members
include
uniclientconn.h
1
/* -*- Mode: C++ -*-
2
* Worldvisions Tunnel Vision Software:
3
* Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4
*
5
* Manages a connection between the UniConf client and daemon.
6
*/
7
#ifndef __UNICONFCONN_H
8
#define __UNICONFCONN_H
9
10
#include "uniconfkey.h"
11
#include "uniconfgen.h"
12
#include "wvstreamclone.h"
13
#include "wvistreamlist.h"
14
#include "wvbuf.h"
15
#include "wvlog.h"
16
17
#define UNICONF_PROTOCOL_VERSION UniClientConn::NUM_COMMANDS
18
#define DEFAULT_UNICONF_DAEMON_TCP_PORT 4111
19
#define DEFAULT_UNICONF_DAEMON_SSL_PORT 4112
20
27
class
UniClientConn
:
public
WvStreamClone
28
{
29
WvDynBuf
msgbuf;
30
31
protected
:
32
WvLog
log;
33
bool
closed;
34
int
version;
35
36
public
:
37
WvConstStringBuffer
payloadbuf
;
39
/* This table is _very_ important!!!
40
*
41
* With UniConf, we promise to never remove or modify the behaviour of
42
* any of the commands listed here. If you want to modify anything,
43
* you'd better just add a new command instead. We keep track of the
44
* version of the UniConf protocol by the number of commands supported
45
* by the server.
46
*
47
* @see UniClientConn::cmdinfos
48
*/
49
enum
Command
50
{
51
NONE
= -2,
52
INVALID
= -1,
54
// requests
55
REQ_NOOP
,
56
REQ_GET
,
57
REQ_SET
,
58
REQ_SETV
,
59
REQ_REMOVE
,
60
REQ_SUBTREE
,
61
REQ_HASCHILDREN
,
62
REQ_COMMIT
,
63
REQ_REFRESH
,
64
REQ_QUIT
,
65
REQ_HELP
,
67
// command completion replies
68
REPLY_OK
,
69
REPLY_FAIL
,
70
REPLY_CHILD
,
71
REPLY_ONEVAL
,
73
// partial replies
74
PART_VALUE
,
75
PART_TEXT
,
77
// events
78
EVENT_HELLO
,
79
EVENT_NOTICE
,
80
};
81
static
const
int
NUM_COMMANDS =
EVENT_NOTICE
+ 1;
82
struct
CommandInfo
83
{
84
const
char
*name;
85
const
char
*description;
86
};
87
static
const
CommandInfo
cmdinfos[NUM_COMMANDS];
88
90
UniClientConn
(
IWvStream
*_s,
WvStringParm
dst = WvString::null);
91
virtual
~
UniClientConn
();
92
93
virtual
void
close
();
94
101
Command
readcmd
();
102
Command
readcmd
(
WvString
&command);
103
108
WvString
readarg
();
109
115
void
writecmd
(
Command
command,
WvStringParm
payload = WvString::null);
116
121
void
writeok
(
WvStringParm
payload =
""
);
122
127
void
writefail
(
WvStringParm
payload =
""
);
128
134
void
writevalue
(
const
UniConfKey
&key,
WvStringParm
value);
135
141
void
writeonevalue
(
const
UniConfKey
&key,
WvStringParm
value);
142
147
void
writetext
(
WvStringParm
text);
148
149
private
:
151
WvString
readmsg();
152
154
void
writemsg(
WvStringParm
message);
155
};
156
157
#endif // __UNICONFCONN_H
Generated on Tue Mar 1 2016 21:28:36 for WvStreams by
1.8.4