blob: cda437df2d7d38e1635efb73fc8f2e99982875e5 (
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
|
/*
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, see <https://www.gnu.org/licenses/>.
*/
// Base class for message and response headers
#ifndef _HEADER_H
#define _HEADER_H
#include <string>
using namespace std;
class t_header {
private:
t_header();
protected:
bool populated; // true = header is populated
string header_name; // Full name of header in SIP messages
string compact_name; // Compact name of header in SIP messages
public:
virtual ~t_header() {}
t_header(const string &_header_name, const string &_compact_name = "");
// Return the text encoded header (CRLF at end of string)
virtual string encode(void) const;
// Return the text encoded value part (no CRLF at end of string)
virtual string encode_value(void) const = 0;
// Return a environemnt variable setting
// The format of the setting is:
//
// SIP_<header name>=<value>
//
// The header name is in capitals. Dashes are replaced by underscores.
virtual string encode_env(void) const;
// Get the header name
string get_name(void) const;
// Get text encoding of the header value only.
// I.e. without header name and no trailing CRLF
string get_value(void) const;
// Return true if the header is populated
bool is_populated(void) const;
};
#endif
|