Browse code

debugger: updated to the new mod interface

Victor Seva authored on 28/09/2018 09:07:17
Showing 1 changed files
... ...
@@ -103,7 +103,7 @@ str* dbg_get_action_name(struct action *a)
103 103
 {
104 104
 	int i;
105 105
 	static str aname;
106
-	cmd_export_common_t *cmd;
106
+	cmd_export_t *cmd;
107 107
 
108 108
 	if(a==NULL)
109 109
 		return &_dbg_action_special[0];
... ...
@@ -130,7 +130,7 @@ str* dbg_get_action_name(struct action *a)
130 130
 		case MODULE5_RVE_T:
131 131
 		case MODULE6_RVE_T:
132 132
 		case MODULEX_RVE_T:
133
-			cmd = (cmd_export_common_t*)(a->val[0].u.data);
133
+			cmd = (cmd_export_t*)(a->val[0].u.data);
134 134
 			aname.s = cmd->name;
135 135
 			aname.len = strlen(aname.s);
136 136
 			return &aname;
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
... ...
@@ -26,8 +26,8 @@
26 26
 #include <stdlib.h>
27 27
 #include <unistd.h>
28 28
 
29
-#include "../../dprint.h"
30
-#include "../../sr_module.h"
29
+#include "../../core/dprint.h"
30
+#include "../../core/sr_module.h"
31 31
 
32 32
 #include "debugger_act.h"
33 33
 
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,146 @@
1
+/**
2
+ * $Id$
3
+ *
4
+ * Copyright (C) 2010 Daniel-Constantin Mierla (asipto.com)
5
+ *
6
+ * This file is part of Kamailio, a free SIP server.
7
+ *
8
+ * This file is free software; you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation; either version 2 of the License, or
11
+ * (at your option) any later version
12
+ *
13
+ * This file is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ */
23
+
24
+#include <stdio.h>
25
+#include <string.h>
26
+#include <stdlib.h>
27
+#include <unistd.h>
28
+
29
+#include "../../dprint.h"
30
+#include "../../sr_module.h"
31
+
32
+#include "debugger_act.h"
33
+
34
+typedef struct _dbg_action {
35
+	int type;
36
+	str name;
37
+} dbg_action_t;
38
+
39
+static str _dbg_action_special[] = {
40
+	str_init("unknown"),   /* 0 */
41
+	str_init("exit"),      /* 1 */
42
+	str_init("drop"),      /* 2 */
43
+	str_init("return"),    /* 3 */
44
+	{0, 0}
45
+};
46
+
47
+static dbg_action_t _dbg_action_list[] = {
48
+	{ FORWARD_T, str_init("forward") },
49
+	{ LOG_T, str_init("log") },
50
+	{ ERROR_T, str_init("error") },
51
+	{ ROUTE_T, str_init("route") },
52
+	{ EXEC_T, str_init("exec") },
53
+	{ SET_HOST_T, str_init("sethost") },
54
+	{ SET_HOSTPORT_T, str_init("sethostport") },
55
+	{ SET_USER_T, str_init("setuser") },
56
+	{ SET_USERPASS_T, str_init("setuserpass") },
57
+	{ SET_PORT_T, str_init("setport") },
58
+	{ SET_URI_T, str_init("seturi") },
59
+	{ SET_HOSTPORTTRANS_T, str_init("sethostporttrans") },
60
+	{ SET_HOSTALL_T, str_init("sethostall") },
61
+	{ SET_USERPHONE_T, str_init("setuserphone") },
62
+	{ IF_T, str_init("if") },
63
+	{ SWITCH_T, str_init("switch") },
64
+	{ BLOCK_T, str_init("block") },
65
+	{ EVAL_T, str_init("eval") },
66
+	{ SWITCH_JT_T, str_init("switch") },
67
+	{ SWITCH_COND_T, str_init("switch") },
68
+	{ MATCH_COND_T, str_init("case") },
69
+	{ WHILE_T, str_init("while") },
70
+	{ SETFLAG_T, str_init("setflag") },
71
+	{ RESETFLAG_T, str_init("resetflag") },
72
+	{ ISFLAGSET_T, str_init("isflagset") },
73
+	{ AVPFLAG_OPER_T, str_init("avpflag") },
74
+	{ LEN_GT_T, str_init("lengt") },
75
+	{ PREFIX_T, str_init("prefix") },
76
+	{ STRIP_T, str_init("strip") },
77
+	{ STRIP_TAIL_T, str_init("striptail") },
78
+	{ APPEND_BRANCH_T, str_init("append_branch") },
79
+	{ REVERT_URI_T, str_init("reverturi") },
80
+	{ FORWARD_TCP_T, str_init("forward_tcp") },
81
+	{ FORWARD_UDP_T, str_init("forward_udp") },
82
+	{ FORWARD_TLS_T, str_init("forward_tls") },
83
+	{ FORWARD_SCTP_T, str_init("forward_sctp") },
84
+	{ FORCE_RPORT_T, str_init("force_rport") },
85
+	{ ADD_LOCAL_RPORT_T, str_init("add_local_rport") },
86
+	{ SET_ADV_ADDR_T, str_init("set_adv_addr") },
87
+	{ SET_ADV_PORT_T, str_init("set_adv_port") },
88
+	{ FORCE_TCP_ALIAS_T, str_init("force_tcp_alias") },
89
+	{ LOAD_AVP_T, str_init("load_avp") },
90
+	{ AVP_TO_URI_T, str_init("avp_to_uri") },
91
+	{ FORCE_SEND_SOCKET_T, str_init("force_send_socket") },
92
+	{ ASSIGN_T, str_init("assign") },
93
+	{ ADD_T, str_init("add") },
94
+	{ UDP_MTU_TRY_PROTO_T, str_init("udp_mtu_try_proto") },
95
+	{ SET_FWD_NO_CONNECT_T, str_init("set_fwd_no_connect") },
96
+	{ SET_RPL_NO_CONNECT_T, str_init("set_rpl_no_connect") },
97
+	{ SET_FWD_CLOSE_T, str_init("set_fwd_close") },
98
+	{ SET_RPL_CLOSE_T, str_init("set_rpl_close") },
99
+	{ 0, {0, 0} }
100
+};
101
+
102
+str* dbg_get_action_name(struct action *a)
103
+{
104
+	int i;
105
+	static str aname;
106
+	cmd_export_common_t *cmd;
107
+
108
+	if(a==NULL)
109
+		return &_dbg_action_special[0];
110
+
111
+	switch(a->type) {
112
+		case DROP_T:
113
+			if(a->val[1].u.number&DROP_R_F)
114
+				return &_dbg_action_special[2];
115
+			if(a->val[1].u.number&RETURN_R_F)
116
+				return &_dbg_action_special[3];
117
+			return &_dbg_action_special[1];
118
+		case MODULE0_T:
119
+		case MODULE1_T:
120
+		case MODULE2_T:
121
+		case MODULE3_T:
122
+		case MODULE4_T:
123
+		case MODULE5_T:
124
+		case MODULE6_T:
125
+		case MODULEX_T:
126
+		case MODULE1_RVE_T:
127
+		case MODULE2_RVE_T:
128
+		case MODULE3_RVE_T:
129
+		case MODULE4_RVE_T:
130
+		case MODULE5_RVE_T:
131
+		case MODULE6_RVE_T:
132
+		case MODULEX_RVE_T:
133
+			cmd = (cmd_export_common_t*)(a->val[0].u.data);
134
+			aname.s = cmd->name;
135
+			aname.len = strlen(aname.s);
136
+			return &aname;
137
+		default:
138
+			for(i=0; _dbg_action_list[i].type!=0; i++)
139
+			{
140
+				if(_dbg_action_list[i].type==a->type)
141
+					return &_dbg_action_list[i].name;
142
+			}
143
+	}
144
+
145
+	return &_dbg_action_special[0];
146
+}