Browse code

core, lib, modules: updated include paths for header files

Daniel-Constantin Mierla authored on 07/12/2016 11:07:22
Showing 1 changed files
... ...
@@ -28,14 +28,14 @@
28 28
 
29 29
 #include <errno.h>
30 30
 
31
-#include "../../parser/parse_from.h"
32
-#include "../../parser/parse_cseq.h"
33
-#include "../../parser/parse_content.h"
34
-#include "../../parser/parse_uri.h"
35
-#include "../../parser/contact/parse_contact.h"
36
-
37
-#include "../../data_lump.h"
38
-#include "../../msg_translator.h"
31
+#include "../../core/parser/parse_from.h"
32
+#include "../../core/parser/parse_cseq.h"
33
+#include "../../core/parser/parse_content.h"
34
+#include "../../core/parser/parse_uri.h"
35
+#include "../../core/parser/contact/parse_contact.h"
36
+
37
+#include "../../core/data_lump.h"
38
+#include "../../core/msg_translator.h"
39 39
 #include "auth_identity.h"
40 40
 
41 41
 /*
Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,120 @@
1
+/*
2
+ * This file is part of Kamailio, a free SIP server.
3
+ *
4
+ * Kamailio is free software; you can redistribute it and/or modify
5
+ * it under the terms of the GNU General Public License as published by
6
+ * the Free Software Foundation; either version 2 of the License, or
7
+ * (at your option) any later version
8
+ *
9
+ * Kamailio is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
+ * GNU General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License
15
+ * along with this program; if not, write to the Free Software
16
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17
+ *
18
+ * Copyright (c) 2007 iptelorg GmbH
19
+ *
20
+ */
21
+
22
+/*!
23
+ * \file
24
+ * \brief Kamailio auth-identity :: Dynamic strings
25
+ * \ingroup auth-identity
26
+ * Module: \ref auth-identity
27
+ */
28
+
29
+#include <errno.h>
30
+
31
+#include "../../parser/parse_from.h"
32
+#include "../../parser/parse_cseq.h"
33
+#include "../../parser/parse_content.h"
34
+#include "../../parser/parse_uri.h"
35
+#include "../../parser/contact/parse_contact.h"
36
+
37
+#include "../../data_lump.h"
38
+#include "../../msg_translator.h"
39
+#include "auth_identity.h"
40
+
41
+/*
42
+ * Dynamic string functions
43
+ */
44
+
45
+int initdynstr(dynstr *sout, int isize)
46
+{
47
+	memset(sout,0,sizeof(*sout));
48
+	getstr_dynstr(sout).s=pkg_malloc(isize);
49
+	if (!getstr_dynstr(sout).s) {
50
+		LOG(L_WARN,
51
+			"AUTH_IDENTITY:initdynstr: Not enough memory error\n");
52
+		return -1;
53
+	}
54
+	sout->size=isize;
55
+
56
+	return 0;
57
+}
58
+
59
+int cpy2dynstr(dynstr *sout, str *s2app)
60
+{
61
+	char *stmp;
62
+	int isize = s2app->len;
63
+
64
+	if (isize > sout->size) {
65
+		stmp=pkg_realloc(sout->sd.s, isize);
66
+		if (!stmp) {
67
+			LOG(L_ERR, "AUTH_IDENTITY:cpy2dynstr: Not enough memory error\n");
68
+			return -1;
69
+		}
70
+		sout->sd.s=stmp;
71
+		sout->size=isize;
72
+	}
73
+
74
+	memcpy(sout->sd.s,s2app->s,s2app->len);
75
+	sout->sd.len = isize;
76
+
77
+	return 0;
78
+}
79
+
80
+int app2dynchr(dynstr *sout, char capp)
81
+{
82
+	char *stmp;
83
+	int isize = sout->sd.len + 1;
84
+
85
+	if (isize > sout->size) {
86
+		stmp=pkg_realloc(sout->sd.s, isize);
87
+		if (!stmp) {
88
+			LOG(L_ERR, "AUTH_IDENTITY:app2dynchr: Not enough memory error\n");
89
+			return -1;
90
+		}
91
+		sout->sd.s=stmp;
92
+		sout->size++;
93
+	}
94
+
95
+	sout->sd.s[sout->sd.len]=capp;
96
+	sout->sd.len++;
97
+
98
+	return 0;
99
+}
100
+
101
+int app2dynstr(dynstr *sout, str *s2app)
102
+{
103
+	char *stmp;
104
+	int isize = sout->sd.len + s2app->len;
105
+
106
+	if (isize > sout->size) {
107
+		stmp=pkg_realloc(sout->sd.s, isize);
108
+		if (!stmp) {
109
+			LOG(L_ERR, "AUTH_IDENTITY:app2dynstr: Not enough memory error\n");
110
+			return -1;
111
+		}
112
+		sout->sd.s=stmp;
113
+		sout->size=isize;
114
+	}
115
+
116
+	memcpy(&sout->sd.s[sout->sd.len],s2app->s,s2app->len);
117
+	sout->sd.len = isize;
118
+
119
+	return 0;
120
+}