File: QueueNode.h

package info (click to toggle)
squid3 3.4.8-6
  • links: PTS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 31,084 kB
  • sloc: cpp: 165,325; ansic: 21,998; sh: 12,166; makefile: 5,964; perl: 2,153; sql: 322; awk: 118
file content (53 lines) | stat: -rw-r--r-- 1,389 bytes parent folder | download | duplicates (3)
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
#ifndef SQUID_SRC_AUTH_QUEUENODE_H
#define SQUID_SRC_AUTH_QUEUENODE_H

namespace Auth
{

/**
 * A queue of auth requests waiting for verification to occur.
 *
 * Certain authentication schemes such a Basic and Bearer auth
 * permit credentials tokens to be repeated from multiple sources
 * simultaneously. This queue node allows multiple validation
 * queries to be collapsed into one backend helper lookup.
 * CBDATA and handlers stored in these queue nodes can be notified
 * all at once with a result when the lookup completes.
 */
class QueueNode
{

private:
    // we store CBDATA here, copy is not safe
    QueueNode(const QueueNode &);
    QueueNode &operator =(const QueueNode &);

public:
    QueueNode(Auth::UserRequest *aRequest, AUTHCB *aHandler, void *aData) :
            next(NULL),
            auth_user_request(aRequest),
            handler(aHandler),
            data(cbdataReference(aData)) {}
    ~QueueNode() {
        cbdataReferenceDone(data);
        while (next) {
            QueueNode *tmp = next->next;
            next->next = NULL;
            delete next;
            next = tmp;
        };
    }

    Auth::QueueNode *next;
    Auth::UserRequest::Pointer auth_user_request;
    AUTHCB *handler;
    void *data;

    MEMPROXY_CLASS(Auth::QueueNode);
};

MEMPROXY_CLASS_INLINE(Auth::QueueNode);

} // namespace Auth

#endif /* SQUID_SRC_AUTH_QUEUENODE_H */