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
deleted file mode 100644
... ...
@@ -1,105 +0,0 @@
1
-/*
2
- * Copyright (C) 2006 iptelorg GmbH 
3
- *
4
- * Permission to use, copy, modify, and distribute this software for any
5
- * purpose with or without fee is hereby granted, provided that the above
6
- * copyright notice and this permission notice appear in all copies.
7
- *
8
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
- */
16
-
17
-#ifndef _str_hashs_h
18
-#define _str_hashs_h
19
-
20
-#include "str.h"
21
-#include "hashes.h"
22
-#include "mem/mem.h"
23
-#include "clist.h"
24
-#include <string.h>
25
-
26
-
27
-/* generic, simple str keyed hash */
28
-
29
-struct str_hash_entry{
30
-	struct str_hash_entry* next;
31
-	struct str_hash_entry* prev;
32
-	str key;
33
-	unsigned int flags;
34
-	union{
35
-		void* p;
36
-		char* s;
37
-		int   n;
38
-		char  data[sizeof(void*)];
39
-	}u;
40
-};
41
-
42
-
43
-struct str_hash_head{
44
-	struct str_hash_entry* next;
45
-	struct str_hash_entry* prev;
46
-};
47
-
48
-
49
-struct str_hash_table{
50
-	struct str_hash_head* table;
51
-	int size;
52
-};
53
-
54
-
55
-
56
-/* returns 0 on success, <0 on failure */
57
-inline static int str_hash_alloc(struct str_hash_table* ht, int size)
58
-{
59
-	ht->table=(struct str_hash_head*)pkg_malloc(sizeof(struct str_hash_head)*size);
60
-	if (ht->table==0)
61
-		return -1;
62
-	ht->size=size;
63
-	return 0;
64
-}
65
-
66
-
67
-
68
-inline static void str_hash_init(struct str_hash_table* ht)
69
-{
70
-	int r;
71
-	
72
-	for (r=0; r<ht->size; r++) clist_init(&(ht->table[r]), next, prev);
73
-}
74
-
75
-
76
-
77
-inline static void str_hash_add(struct str_hash_table* ht, 
78
-								struct str_hash_entry* e)
79
-{
80
-	int h;
81
-	
82
-	h=get_hash1_raw(e->key.s, e->key.len) % ht->size;
83
-	clist_insert(&ht->table[h], e, next, prev);
84
-}
85
-
86
-
87
-
88
-inline static struct str_hash_entry* str_hash_get(struct str_hash_table* ht,
89
-									const char* key, int len)
90
-{
91
-	int h;
92
-	struct str_hash_entry* e;
93
-	
94
-	h=get_hash1_raw(key, len) % ht->size;
95
-	clist_foreach(&ht->table[h], e, next){
96
-		if ((e->key.len==len) && (memcmp(e->key.s, key, len)==0))
97
-			return e;
98
-	}
99
-	return 0;
100
-}
101
-
102
-
103
-#define str_hash_del(e) clist_rm(e, next, prev)
104
-
105
-#endif
Browse code

core: Modify doxygen, remove history, remove SVN IDs, change "ser" and "sip-router" to "KAMAILIO"

Olle E. Johansson authored on 16/01/2015 16:38:46
Showing 1 changed files
... ...
@@ -1,6 +1,4 @@
1 1
 /*
2
- * $Id$
3
- *
4 2
  * Copyright (C) 2006 iptelorg GmbH 
5 3
  *
6 4
  * Permission to use, copy, modify, and distribute this software for any
... ...
@@ -15,14 +13,6 @@
15 13
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 14
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 15
  */
18
-/*
19
- * History:
20
- * --------
21
- *  2006-02-02  created by andrei
22
- *  2006-11-24  added numeric string optimized hash function (andrei)
23
- *  2006-12-13  split into hashes.h (more generic) and str_hash.h (andrei)
24
- */
25
-
26 16
 
27 17
 #ifndef _str_hashs_h
28 18
 #define _str_hashs_h
Browse code

Fixed compile warnings - casts from void at memory allocation

Anca Vamanu authored on 17/01/2012 09:02:50
Showing 1 changed files
... ...
@@ -66,7 +66,7 @@ struct str_hash_table{
66 66
 /* returns 0 on success, <0 on failure */
67 67
 inline static int str_hash_alloc(struct str_hash_table* ht, int size)
68 68
 {
69
-	ht->table=pkg_malloc(sizeof(struct str_hash_head)*size);
69
+	ht->table=(struct str_hash_head*)pkg_malloc(sizeof(struct str_hash_head)*size);
70 70
 	if (ht->table==0)
71 71
 		return -1;
72 72
 	ht->size=size;
Browse code

core: use const char*/str* for hash functions

Andrei Pelinescu-Onciul authored on 26/08/2010 19:40:45
Showing 1 changed files
... ...
@@ -96,7 +96,7 @@ inline static void str_hash_add(struct str_hash_table* ht,
96 96
 
97 97
 
98 98
 inline static struct str_hash_entry* str_hash_get(struct str_hash_table* ht,
99
-									char* key, int len)
99
+									const char* key, int len)
100 100
 {
101 101
 	int h;
102 102
 	struct str_hash_entry* e;
Browse code

- hash cleanup/cosmetics: - use the "raw" hash functions from hashes.h as base for the other hashes (e.g. tm hash). This doesn't change the hash functions, just removes some extra copies. - split old hashes.h into hashes.h (more generic stuff) and str_hash.h - new_hash() is safer now (nobody uses it, but just in case...)

Andrei Pelinescu-Onciul authored on 13/12/2006 22:50:46
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,115 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ * Copyright (C) 2006 iptelorg GmbH 
5
+ *
6
+ * Permission to use, copy, modify, and distribute this software for any
7
+ * purpose with or without fee is hereby granted, provided that the above
8
+ * copyright notice and this permission notice appear in all copies.
9
+ *
10
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
+ */
18
+/*
19
+ * History:
20
+ * --------
21
+ *  2006-02-02  created by andrei
22
+ *  2006-11-24  added numeric string optimized hash function (andrei)
23
+ *  2006-12-13  split into hashes.h (more generic) and str_hash.h (andrei)
24
+ */
25
+
26
+
27
+#ifndef _str_hashs_h
28
+#define _str_hashs_h
29
+
30
+#include "str.h"
31
+#include "hashes.h"
32
+#include "mem/mem.h"
33
+#include "clist.h"
34
+#include <string.h>
35
+
36
+
37
+/* generic, simple str keyed hash */
38
+
39
+struct str_hash_entry{
40
+	struct str_hash_entry* next;
41
+	struct str_hash_entry* prev;
42
+	str key;
43
+	unsigned int flags;
44
+	union{
45
+		void* p;
46
+		char* s;
47
+		int   n;
48
+		char  data[sizeof(void*)];
49
+	}u;
50
+};
51
+
52
+
53
+struct str_hash_head{
54
+	struct str_hash_entry* next;
55
+	struct str_hash_entry* prev;
56
+};
57
+
58
+
59
+struct str_hash_table{
60
+	struct str_hash_head* table;
61
+	int size;
62
+};
63
+
64
+
65
+
66
+/* returns 0 on success, <0 on failure */
67
+inline static int str_hash_alloc(struct str_hash_table* ht, int size)
68
+{
69
+	ht->table=pkg_malloc(sizeof(struct str_hash_head)*size);
70
+	if (ht->table==0)
71
+		return -1;
72
+	ht->size=size;
73
+	return 0;
74
+}
75
+
76
+
77
+
78
+inline static void str_hash_init(struct str_hash_table* ht)
79
+{
80
+	int r;
81
+	
82
+	for (r=0; r<ht->size; r++) clist_init(&(ht->table[r]), next, prev);
83
+}
84
+
85
+
86
+
87
+inline static void str_hash_add(struct str_hash_table* ht, 
88
+								struct str_hash_entry* e)
89
+{
90
+	int h;
91
+	
92
+	h=get_hash1_raw(e->key.s, e->key.len) % ht->size;
93
+	clist_insert(&ht->table[h], e, next, prev);
94
+}
95
+
96
+
97
+
98
+inline static struct str_hash_entry* str_hash_get(struct str_hash_table* ht,
99
+									char* key, int len)
100
+{
101
+	int h;
102
+	struct str_hash_entry* e;
103
+	
104
+	h=get_hash1_raw(key, len) % ht->size;
105
+	clist_foreach(&ht->table[h], e, next){
106
+		if ((e->key.len==len) && (memcmp(e->key.s, key, len)==0))
107
+			return e;
108
+	}
109
+	return 0;
110
+}
111
+
112
+
113
+#define str_hash_del(e) clist_rm(e, next, prev)
114
+
115
+#endif