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
... ...
@@ -40,7 +40,7 @@ extern unsigned nc_array_size; /* 2^k == 1<<nc_array_bits */
40 40
 #ifdef USE_NC
41 41
 
42 42
 #include "nid.h" /* nid_t */
43
-#include "../../atomic_ops.h"
43
+#include "../../core/atomic_ops.h"
44 44
 
45 45
 
46 46
 /* default number of maximum in-flight nonces */
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,74 @@
1
+/*
2
+ * Digest Authentication Module
3
+ * nonce-count (nc) tracking
4
+ *
5
+ * Copyright (C) 2008 iptelorg GmbH
6
+ *
7
+ * This file is part of Kamailio, a free SIP server.
8
+ *
9
+ * Kamailio is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * Kamailio is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program; if not, write to the Free Software
21
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22
+ *
23
+ */
24
+
25
+/*
26
+ * Defines:
27
+ *  USE_NC   - if not defined no NC specific code will be compiled
28
+ */
29
+
30
+#ifndef _nc_h
31
+#define _nc_h
32
+
33
+extern int nc_enabled;
34
+
35
+/* instead of storing only the 2^k size we store also k
36
+ * for faster operations */
37
+extern unsigned nc_array_k;    /* array size bits (k in 2^k) */
38
+extern unsigned nc_array_size; /* 2^k == 1<<nc_array_bits */
39
+
40
+#ifdef USE_NC
41
+
42
+#include "nid.h" /* nid_t */
43
+#include "../../atomic_ops.h"
44
+
45
+
46
+/* default number of maximum in-flight nonces */
47
+#define DEFAULT_NC_ARRAY_SIZE 1024*1024 /* uses 1Mb of memory */
48
+#define MIN_NC_ARRAY_SIZE        102400 /* warn if size < 100k */
49
+#define MAX_NC_ARRAY_SIZE 1024*1024*1024 /* warn if size > 1Gb */
50
+
51
+#define MIN_NC_ARRAY_PARTITION   65536 /* warn if a partition is < 65k */
52
+
53
+
54
+typedef unsigned char nc_t;
55
+
56
+int init_nonce_count();
57
+void destroy_nonce_count();
58
+
59
+
60
+enum nc_check_ret{
61
+	NC_OK=0, NC_INV_POOL=-1, NC_ID_OVERFLOW=-2, NC_TOO_BIG=-3,
62
+	NC_REPLAY=-4
63
+};
64
+
65
+/* check if nonce-count nc w/ index i is expected/valid and record its
66
+ * value */
67
+enum nc_check_ret nc_check_val(nid_t i, unsigned pool, unsigned int nc);
68
+
69
+/* re-init the stored nc for nonce id in pool pool_no */
70
+nid_t nc_new(nid_t id, unsigned char pool_no);
71
+
72
+#endif /* USE_NC */
73
+#endif /* _nc_h */
74
+