summaryrefslogtreecommitdiffstats
path: root/src/parser/hdr_request_disposition.h
blob: 9ae0988c38a2592ab54815de2f2f71270f3d9b2d (plain)
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
/*
    Copyright (C) 2005-2009  Michel de Boer <michel@twinklephone.com>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

/**
 * @file
 * Request-Disposition header (RFC 3841)
 */
 
#ifndef _H_HDR_REQUEST_DISPOSITION
#define _H_HDR_REQUEST_DISPOSITION

#include <string>
#include "header.h"

using namespace std;

#define REQDIS_PROXY		"proxy"
#define REQDIS_REDIRECT		"redirect"
#define REQDIS_CANCEL		"cancel"
#define REQDIS_NO_CANCEL	"no-cancel"
#define REQDIS_FORK		"fork"
#define REQDIS_NO_FORK		"no-fork"
#define REQDIS_RECURSE		"recurse"
#define REQDIS_NO_RECURSE	"no-recurse"
#define REQDIS_PARALLEL		"parallel"
#define REQDIS_SEQUENTIAL	"sequential"
#define REQDIS_QUEUE		"queue"
#define REQDIS_NO_QUEUE		"no-queue"

/** Request-Disposition header (RFC 3841) */
class t_hdr_request_disposition : public t_header {
public:
	enum t_proxy_directive {
		PROXY_NULL,
		PROXY,
		REDIRECT
	};
	
	enum t_cancel_directive {
		CANCEL_NULL,
		CANCEL,
		NO_CANCEL
	};
	
	enum t_fork_directive {
		FORK_NULL,
		FORK,
		NO_FORK
	};
	
	enum t_recurse_directive {
		RECURSE_NULL,
		RECURSE,
		NO_RECURSE
	};
	
	enum t_parallel_directive {
		PARALLEL_NULL,
		PARALLEL,
		SEQUENTIAL
	};
	
	enum t_queue_directive {
		QUEUE_NULL,
		QUEUE,
		NO_QUEUE
	};
	
	t_proxy_directive proxy_directive;
	t_cancel_directive cancel_directive;
	t_fork_directive fork_directive;
	t_recurse_directive recurse_directive;
	t_parallel_directive parallel_directive;
	t_queue_directive queue_directive;
	
	t_hdr_request_disposition();
	
	void set_proxy_directive(t_proxy_directive directive);
	void set_cancel_directive(t_cancel_directive directive);
	void set_fork_directive(t_fork_directive directive);
	void set_recurse_directive(t_recurse_directive directive);
	void set_parallel_directive(t_parallel_directive directive);
	void set_queue_directive(t_queue_directive directive);
	
	/**
	 * Set a directive using one of the tokens define in RFC 3841
	 * @param s [in] Directive token.
	 * @return True if directive set. False if directive is invalid or
	 *         conflicts with exisiting directives.
	 */
	bool set_directive(const string &s);
	
	string encode_value(void) const;
};

#endif