This file is indexed.

/usr/include/wvstreams/uniclientconn.h is in libwvstreams-dev 4.6.1-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/* -*- Mode: C++ -*-
 * Worldvisions Tunnel Vision Software:
 *   Copyright (C) 1997-2002 Net Integration Technologies, Inc.
 *
 * Manages a connection between the UniConf client and daemon.
 */
#ifndef __UNICONFCONN_H
#define __UNICONFCONN_H

#include "uniconfkey.h"
#include "uniconfgen.h"
#include "wvstreamclone.h"
#include "wvistreamlist.h"
#include "wvbuf.h"
#include "wvlog.h"

#define UNICONF_PROTOCOL_VERSION UniClientConn::NUM_COMMANDS
#define DEFAULT_UNICONF_DAEMON_TCP_PORT 4111
#define DEFAULT_UNICONF_DAEMON_SSL_PORT 4112

/**
 * Represents a connection to a UniConf daemon via any WvStream.
 * Makes several operations much simpler, such as TCL
 * encoding/decoding of lists, filling of the operation buffer and
 * comparison for UniConf operations.
 */
class UniClientConn : public WvStreamClone
{
    WvDynBuf msgbuf;

protected:
    WvLog log;
    bool closed;
    int version;
    
public:
    WvConstStringBuffer payloadbuf; /*!< holds the previous command payload */

    /* This table is _very_ important!!!
     *
     * With UniConf, we promise to never remove or modify the behaviour of
     * any of the commands listed here.  If you want to modify anything,
     * you'd better just add a new command instead.  We keep track of the
     * version of the UniConf protocol by the number of commands supported
     * by the server.
     *
     * @see UniClientConn::cmdinfos
     */
    enum Command
    {
	NONE = -2, /*!< used to signal no command received */
	INVALID = -1, /*!< used to signal invalid command */

	// requests
	REQ_NOOP, /*!< noop ==> OK v18 */
	REQ_GET, /*!< get <key> ==> VAL ... OK / FAIL v18 */
	REQ_SET, /*!< set <key> <value> ==> OK / FAIL v18 */
	REQ_SETV, /*!< setv <key> <value> v19 */
	REQ_REMOVE, /*!< del <key> ==> OK / FAIL v18 */
	REQ_SUBTREE, /*!< subt <key> ==> VAL ... OK / FAIL v18 */
	REQ_HASCHILDREN, /*!< hchild <key> => HCHILD <key> TRUE / FALSE v18 */
	REQ_COMMIT, /*!< commit => OK v18 */
	REQ_REFRESH, /*!< refresh => OK / FAIL v18 */
	REQ_QUIT, /*!< quit ==> OK v18 */
	REQ_HELP, /*!< help ==> TEXT ... OK / FAIL v18 */

	// command completion replies
	REPLY_OK, /*!< OK v18 */
	REPLY_FAIL, /*!< FAIL <payload> v18 */
	REPLY_CHILD, /*!< HCHILD <key> TRUE / FALSE v18 */
	REPLY_ONEVAL, /*!< ONEVAL <key> <value> v18 */

	// partial replies
	PART_VALUE, /*!< VAL <key> <value> v18 */
	PART_TEXT, /*!< TEXT <text> v18 */

	// events
	EVENT_HELLO, /*!< HELLO <message> v18 */
	EVENT_NOTICE, /*!< NOTICE <key> <oldval> <newval> v18 */
    };
    static const int NUM_COMMANDS = EVENT_NOTICE + 1;
    struct CommandInfo
    {
        const char *name;
        const char *description;
    };
    static const CommandInfo cmdinfos[NUM_COMMANDS];

    /** Create a wrapper around the supplied WvStream. */
    UniClientConn(IWvStream *_s, WvStringParm dst = WvString::null);
    virtual ~UniClientConn();

    virtual void close();

    /**
     * Reads a command from the connection.
     * "command" is the command that was read.
     * The payload is stored in UniClientConn::payloadbuf.
     * Returns: the command code, NONE, or INVALID
     */
    Command readcmd();
    Command readcmd(WvString &command);

    /**
     * Reads the next argument from the command payload.
     * Returns: the argument or WvString::null
     */
    WvString readarg();

    /**
     * Writes a command to the connection.
     * "command" is the command
     * "payload" is the payload
     */
    void writecmd(Command command, WvStringParm payload = WvString::null);

    /**
     * Writes a REPLY_OK message.
     * "payload" is the payload, defaults to ""
     */
    void writeok(WvStringParm payload = "");

    /**
     * Writes a REPLY_FAIL message.
     * "payload" is the payload, defaults to ""
     */
    void writefail(WvStringParm payload = "");

    /**
     * Writes a PART_VALUE message.
     * "key" is the key
     * "value" is the value
     */
    void writevalue(const UniConfKey &key, WvStringParm value);

    /**
     * Writes a PART_VALUE message.
     * "key" is the key
     * "value" is the value
     */ 
    void writeonevalue(const UniConfKey &key, WvStringParm value);

    /**
     * Writes a PART_TEXT message.
     * "text" is the text
     */
    void writetext(WvStringParm text);

private:
    /** Reads a message from the connection. */
    WvString readmsg();

    /** Writes a message to the connection. */
    void writemsg(WvStringParm message);
};

#endif // __UNICONFCONN_H