Browse code

sca: clang format code

Victor Seva authored on 16/06/2020 07:31:55
Showing 1 changed files
... ...
@@ -28,13 +28,13 @@ int sca_event_from_str(str *event_str)
28 28
 {
29 29
 	int event = SCA_EVENT_TYPE_UNKNOWN;
30 30
 
31
-	if (event_str == NULL || event_str->s == NULL) {
31
+	if(event_str == NULL || event_str->s == NULL) {
32 32
 		return (SCA_EVENT_TYPE_UNKNOWN);
33 33
 	}
34 34
 
35
-	if (STR_EQ(*event_str, SCA_EVENT_NAME_CALL_INFO)) {
35
+	if(STR_EQ(*event_str, SCA_EVENT_NAME_CALL_INFO)) {
36 36
 		event = SCA_EVENT_TYPE_CALL_INFO;
37
-	} else if (STR_EQ(*event_str, SCA_EVENT_NAME_LINE_SEIZE)) {
37
+	} else if(STR_EQ(*event_str, SCA_EVENT_NAME_LINE_SEIZE)) {
38 38
 		event = SCA_EVENT_TYPE_LINE_SEIZE;
39 39
 	}
40 40
 
... ...
@@ -43,15 +43,15 @@ int sca_event_from_str(str *event_str)
43 43
 
44 44
 char *sca_event_name_from_type(int event_type)
45 45
 {
46
-	switch (event_type) {
47
-	case SCA_EVENT_TYPE_CALL_INFO:
48
-		return (SCA_EVENT_NAME_CALL_INFO.s);
46
+	switch(event_type) {
47
+		case SCA_EVENT_TYPE_CALL_INFO:
48
+			return (SCA_EVENT_NAME_CALL_INFO.s);
49 49
 
50
-	case SCA_EVENT_TYPE_LINE_SEIZE:
51
-		return (SCA_EVENT_NAME_LINE_SEIZE.s);
50
+		case SCA_EVENT_TYPE_LINE_SEIZE:
51
+			return (SCA_EVENT_NAME_LINE_SEIZE.s);
52 52
 
53
-	default:
54
-		break;
53
+		default:
54
+			break;
55 55
 	}
56 56
 
57 57
 	return ("unknown");
... ...
@@ -63,7 +63,7 @@ int sca_event_append_header_for_type(int event_type, char *hdrbuf, int maxlen)
63 63
 
64 64
 	len = snprintf(hdrbuf, maxlen, "Event: %s%s",
65 65
 			sca_event_name_from_type(event_type), CRLF);
66
-	if (len >= maxlen) {
66
+	if(len >= maxlen) {
67 67
 		LM_ERR("%s Event header too long\n",
68 68
 				sca_event_name_from_type(event_type));
69 69
 		return (-1);
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,73 @@
1
+/*
2
+ * Copyright (C) 2012 Andrew Mortensen
3
+ *
4
+ * This file is part of the sca module for Kamailio, a free SIP server.
5
+ *
6
+ * The sca module is free software; you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation; either version 2 of the License, or
9
+ * (at your option) any later version
10
+ *
11
+ * The sca module is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA. 02110-1301 USA
19
+ */
20
+#include "sca_common.h"
21
+
22
+#include "sca_event.h"
23
+
24
+str SCA_EVENT_NAME_CALL_INFO = STR_STATIC_INIT("call-info");
25
+str SCA_EVENT_NAME_LINE_SEIZE = STR_STATIC_INIT("line-seize");
26
+
27
+int sca_event_from_str(str *event_str)
28
+{
29
+	int event = SCA_EVENT_TYPE_UNKNOWN;
30
+
31
+	if (event_str == NULL || event_str->s == NULL) {
32
+		return (SCA_EVENT_TYPE_UNKNOWN);
33
+	}
34
+
35
+	if (STR_EQ(*event_str, SCA_EVENT_NAME_CALL_INFO)) {
36
+		event = SCA_EVENT_TYPE_CALL_INFO;
37
+	} else if (STR_EQ(*event_str, SCA_EVENT_NAME_LINE_SEIZE)) {
38
+		event = SCA_EVENT_TYPE_LINE_SEIZE;
39
+	}
40
+
41
+	return (event);
42
+}
43
+
44
+char *sca_event_name_from_type(int event_type)
45
+{
46
+	switch (event_type) {
47
+	case SCA_EVENT_TYPE_CALL_INFO:
48
+		return (SCA_EVENT_NAME_CALL_INFO.s);
49
+
50
+	case SCA_EVENT_TYPE_LINE_SEIZE:
51
+		return (SCA_EVENT_NAME_LINE_SEIZE.s);
52
+
53
+	default:
54
+		break;
55
+	}
56
+
57
+	return ("unknown");
58
+}
59
+
60
+int sca_event_append_header_for_type(int event_type, char *hdrbuf, int maxlen)
61
+{
62
+	int len;
63
+
64
+	len = snprintf(hdrbuf, maxlen, "Event: %s%s",
65
+			sca_event_name_from_type(event_type), CRLF);
66
+	if (len >= maxlen) {
67
+		LM_ERR("%s Event header too long\n",
68
+				sca_event_name_from_type(event_type));
69
+		return (-1);
70
+	}
71
+
72
+	return (len);
73
+}