summaryrefslogtreecommitdiffstats
path: root/src/parser/definitions.h
blob: ce0ba8f19ef14358754a4dc9ce5f232179e2cbea (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
/*
    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/>.
*/

#ifndef _DEFINITIONS_H
#define _DEFINITIONS_H

#include <string>
#include "protocol.h"
#include "sockets/url.h"

using namespace std;

#define SIP_VERSION	"2.0"

// RFC 3261
#ifndef RFC3261_COOKIE
#define RFC3261_COOKIE	"z9hG4bK"
#endif

// Authentication schemes
#define AUTH_DIGEST	"Digest"

// Authentication algorithms
#define ALG_MD5		"MD5"
#define ALG_AKAV1_MD5	"AKAV1-MD5"
#define ALG_MD5_SESS	"MD5-sess"

// Authentication QOP
#define QOP_AUTH	"auth"
#define QOP_AUTH_INT	"auth-int"

/** SIP request methods. */
enum t_method {
	INVITE,
	ACK,
	OPTIONS,
	BYE,
	CANCEL,
	REGISTER,
	PRACK,
	SUBSCRIBE,
	NOTIFY,
	REFER,
	INFO,
	MESSAGE,
	PUBLISH,
	METHOD_UNKNOWN
};

/**
 * Convert a method to a string.
 * @param m The method.
 * @param unknown Method name if m is @ref METHOD_UNKNOWN.
 * @return The name of the method.
 */
string method2str(const t_method &m, const string &unknown = "");

/**
 * Convert a string to a method.
 * @param s The string.
 * @return The method having s as name. If s is an unknown name,
 * then @ref METHOD_UNKNOWN is returned.
 */
t_method str2method(const string &s);

#endif