Browse code

keepalive: format to match default conding style and 80 chars lines

Daniel-Constantin Mierla authored on 05/04/2017 06:52:01
Showing 6 changed files
... ...
@@ -32,22 +32,23 @@
32 32
 
33 33
 typedef int ka_state;
34 34
 
35
-#define KA_STATE_UNKNOWN    0
36
-#define KA_STATE_UP         1
37
-#define KA_STATE_DOWN       2
35
+#define KA_STATE_UNKNOWN 0
36
+#define KA_STATE_UP 1
37
+#define KA_STATE_DOWN 2
38 38
 
39 39
 typedef void (*ka_statechanged_f)(str uri, int state, void *user_attr);
40
-typedef int  (*ka_add_dest_f)(str uri, str owner, int flags, ka_statechanged_f callback,
41
-                              void *user_attr);
40
+typedef int (*ka_add_dest_f)(str uri, str owner, int flags,
41
+		ka_statechanged_f callback, void *user_attr);
42 42
 typedef ka_state (*ka_dest_state_f)(str uri);
43 43
 
44
-typedef struct keepalive_api {
45
-	ka_add_dest_f	  add_destination;
46
-	ka_dest_state_f   destination_state;
44
+typedef struct keepalive_api
45
+{
46
+	ka_add_dest_f add_destination;
47
+	ka_dest_state_f destination_state;
47 48
 } keepalive_api_t;
48 49
 
49
-typedef int (*bind_keepalive_f)(keepalive_api_t* api);
50
-int bind_keepalive(keepalive_api_t* api);
50
+typedef int (*bind_keepalive_f)(keepalive_api_t *api);
51
+int bind_keepalive(keepalive_api_t *api);
51 52
 
52 53
 /**
53 54
  * @brief Load the dispatcher API
... ...
@@ -62,8 +63,7 @@ static inline int keepalive_load_api(keepalive_api_t *api)
62 63
 		return -1;
63 64
 	}
64 65
 
65
-	if(bindkeepalive(api) < 0)
66
-	{
66
+	if(bindkeepalive(api) < 0) {
67 67
 		LM_ERR("cannot bind keepalive api\n");
68 68
 		return -1;
69 69
 	}
... ...
@@ -71,4 +71,3 @@ static inline int keepalive_load_api(keepalive_api_t *api)
71 71
 }
72 72
 
73 73
 #endif /* __KEEPALIVE_API_H__ */
74
-
... ...
@@ -32,39 +32,37 @@
32 32
 #include "../../core/sr_module.h"
33 33
 
34 34
 
35
-#define KA_INACTIVE_DST		1  /*!< inactive destination */
36
-#define KA_TRYING_DST		2  /*!< temporary trying destination */
37
-#define KA_DISABLED_DST		4  /*!< admin disabled destination */
38
-#define KA_PROBING_DST		8  /*!< checking destination */
39
-#define KA_STATES_ALL		15  /*!< all bits for the states of destination */
35
+#define KA_INACTIVE_DST 1 /*!< inactive destination */
36
+#define KA_TRYING_DST 2   /*!< temporary trying destination */
37
+#define KA_DISABLED_DST 4 /*!< admin disabled destination */
38
+#define KA_PROBING_DST 8  /*!< checking destination */
39
+#define KA_STATES_ALL 15  /*!< all bits for the states of destination */
40 40
 
41
-#define ds_skip_dst(flags)	((flags) & (KA_INACTIVE_DST|KA_DISABLED_DST))
41
+#define ds_skip_dst(flags) ((flags) & (KA_INACTIVE_DST | KA_DISABLED_DST))
42 42
 
43
-#define KA_PROBE_NONE			0
44
-#define KA_PROBE_ALL			1
45
-#define KA_PROBE_INACTIVE		2
46
-#define KA_PROBE_ONLYFLAGGED	3
43
+#define KA_PROBE_NONE 0
44
+#define KA_PROBE_ALL 1
45
+#define KA_PROBE_INACTIVE 2
46
+#define KA_PROBE_ONLYFLAGGED 3
47 47
 
48 48
 typedef void (*ka_statechanged_f)(str uri, int state, void *user_attr);
49 49
 
50 50
 typedef struct _ka_dest
51 51
 {
52 52
 	str uri;
53
-	str owner;                  // name of destination "owner"
54
-                                // (module asking to monitor this destination
53
+	str owner; // name of destination "owner"
54
+			   // (module asking to monitor this destination
55 55
 	int flags;
56 56
 	int state;
57
-	time_t last_checked,
58
-		   last_up,
59
-		   last_down;
57
+	time_t last_checked, last_up, last_down;
60 58
 
61 59
 	void *user_attr;
62 60
 	ka_statechanged_f statechanged_clb;
63 61
 
64
-	struct socket_info * sock;
65
-	struct ip_addr ip_address; 	/*!< IP-Address of the entry */
66
-	unsigned short int port; 	/*!< Port of the URI */
67
-	unsigned short int proto; 	/*!< Protocol of the URI */
62
+	struct socket_info *sock;
63
+	struct ip_addr ip_address; /*!< IP-Address of the entry */
64
+	unsigned short int port;   /*!< Port of the URI */
65
+	unsigned short int proto;  /*!< Protocol of the URI */
68 66
 	struct _ka_dest *next;
69 67
 } ka_dest_t;
70 68
 
... ...
@@ -75,9 +73,9 @@ typedef struct _ka_destinations_list
75 73
 
76 74
 extern ka_destinations_list_t *ka_destinations_list;
77 75
 
78
-int ka_add_dest(str uri, str owner, int flags, ka_statechanged_f callback, void *user_attr);
76
+int ka_add_dest(str uri, str owner, int flags, ka_statechanged_f callback,
77
+		void *user_attr);
79 78
 int ka_destination_state(str uri);
80 79
 int ka_str_copy(str src, str *dest, char *prefix);
81 80
 
82 81
 #endif
83
-
... ...
@@ -44,9 +44,9 @@
44 44
  * Regroup all exported functions in keepalive_api_t structure
45 45
  *
46 46
  */
47
-int bind_keepalive(keepalive_api_t* api)
47
+int bind_keepalive(keepalive_api_t *api)
48 48
 {
49
-	if (!api) {
49
+	if(!api) {
50 50
 		ERR("Invalid parameter value\n");
51 51
 		return -1;
52 52
 	}
... ...
@@ -59,49 +59,52 @@ int bind_keepalive(keepalive_api_t* api)
59 59
 /*
60 60
  * Add a new destination in keepalive pool
61 61
  */
62
-int ka_add_dest(str uri, str owner, int flags, ka_statechanged_f callback, void *user_attr) {
62
+int ka_add_dest(str uri, str owner, int flags, ka_statechanged_f callback,
63
+		void *user_attr)
64
+{
63 65
 	struct sip_uri _uri;
64 66
 	ka_dest_t *dest;
65 67
 
66 68
 	LM_INFO("adding destination: %.*s\n", uri.len, uri.s);
67 69
 
68
-	dest = (ka_dest_t *) shm_malloc(sizeof(ka_dest_t));
70
+	dest = (ka_dest_t *)shm_malloc(sizeof(ka_dest_t));
69 71
 	if(dest == NULL) {
70 72
 		LM_ERR("no more memory.\n");
71 73
 		goto err;
72 74
 	}
73 75
 	memset(dest, 0, sizeof(ka_dest_t));
74 76
 
75
-	if (uri.len >= 4 && (!strncasecmp("sip:", uri.s, 4) || !strncasecmp("sips:", uri.s, 5))) {
77
+	if(uri.len >= 4 && (!strncasecmp("sip:", uri.s, 4)
78
+							   || !strncasecmp("sips:", uri.s, 5))) {
76 79
 		// protocol found
77
-		if (ka_str_copy(uri  , &(dest->uri), NULL) < 0)
80
+		if(ka_str_copy(uri, &(dest->uri), NULL) < 0)
78 81
 			goto err;
79 82
 	} else {
80
-		if (ka_str_copy(uri  , &(dest->uri), "sip:") < 0)
83
+		if(ka_str_copy(uri, &(dest->uri), "sip:") < 0)
81 84
 			goto err;
82 85
 	}
83 86
 
84 87
 	// checking uri is valid
85
-	if (parse_uri(dest->uri.s, dest->uri.len, &_uri) != 0) {
88
+	if(parse_uri(dest->uri.s, dest->uri.len, &_uri) != 0) {
86 89
 		LM_ERR("invalid uri <%.*s>\n", dest->uri.len, dest->uri.s);
87 90
 		goto err;
88 91
 	}
89 92
 
90
-	if (ka_str_copy(owner, &(dest->owner), NULL) < 0)
93
+	if(ka_str_copy(owner, &(dest->owner), NULL) < 0)
91 94
 		goto err;
92 95
 
93
-	dest->flags                 = flags;
94
-	dest->statechanged_clb      = callback;
95
-	dest->user_attr             = user_attr;
96
+	dest->flags = flags;
97
+	dest->statechanged_clb = callback;
98
+	dest->user_attr = user_attr;
96 99
 
97
-	dest->next                  = ka_destinations_list->first;
100
+	dest->next = ka_destinations_list->first;
98 101
 	ka_destinations_list->first = dest;
99 102
 
100 103
 	return 0;
101 104
 
102 105
 err:
103
-	if (dest) {
104
-		if (dest->uri.s)
106
+	if(dest) {
107
+		if(dest->uri.s)
105 108
 			shm_free(dest->uri.s);
106 109
 
107 110
 		shm_free(dest);
... ...
@@ -112,24 +115,28 @@ err:
112 115
 /*
113 116
  * TODO
114 117
  */
115
-int ka_rm_dest() {
118
+int ka_rm_dest()
119
+{
116 120
 	return -1;
117 121
 }
118 122
 
119 123
 /*
120 124
  *
121 125
  */
122
-ka_state ka_destination_state(str destination) {
126
+ka_state ka_destination_state(str destination)
127
+{
123 128
 	ka_dest_t *ka_dest = NULL;
124 129
 
125
-	for(ka_dest = ka_destinations_list->first; ka_dest != NULL; ka_dest = ka_dest->next) {
126
-		if (strncmp(ka_dest->uri.s+4, destination.s, ka_dest->uri.len-4) == 0) {
130
+	for(ka_dest = ka_destinations_list->first; ka_dest != NULL;
131
+			ka_dest = ka_dest->next) {
132
+		if(strncmp(ka_dest->uri.s + 4, destination.s, ka_dest->uri.len - 4)
133
+				== 0) {
127 134
 			break;
128 135
 		}
129 136
 	}
130 137
 
131
-	if (ka_dest == NULL) {
132
-		return(-1);
138
+	if(ka_dest == NULL) {
139
+		return (-1);
133 140
 	}
134 141
 
135 142
 	return ka_dest->state;
... ...
@@ -43,7 +43,8 @@
43 43
 struct tm_binds tmb;
44 44
 
45 45
 static void ka_run_route(sip_msg_t *msg, str *uri, char *route);
46
-static void ka_options_callback( struct cell *t, int type, struct tmcb_params *ps );
46
+static void ka_options_callback(struct cell *t, int type,
47
+		struct tmcb_params *ps);
47 48
 
48 49
 
49 50
 /*! \brief
... ...
@@ -51,32 +52,30 @@ static void ka_options_callback( struct cell *t, int type, struct tmcb_params *p
51 52
  *
52 53
  * This timer is regularly fired.
53 54
  */
54
-void ka_check_timer(unsigned int ticks, void* param)
55
+void ka_check_timer(unsigned int ticks, void *param)
55 56
 {
56 57
 	ka_dest_t *ka_dest;
57 58
 	str ka_ping_method = str_init("OPTIONS");
58
-	str ka_ping_from   = str_init("sip:dispatcher@localhost");
59
+	str ka_ping_from = str_init("sip:dispatcher@localhost");
59 60
 	str ka_outbound_proxy = {0, 0};
60 61
 	uac_req_t uac_r;
61 62
 
62 63
 	LM_DBG("ka check timer\n");
63 64
 
64
-	for(ka_dest = ka_destinations_list->first; ka_dest != NULL; ka_dest = ka_dest->next) {
65
+	for(ka_dest = ka_destinations_list->first; ka_dest != NULL;
66
+			ka_dest = ka_dest->next) {
65 67
 		LM_DBG("ka_check_timer dest:%.*s\n", ka_dest->uri.len, ka_dest->uri.s);
66 68
 
67 69
 		/* Send ping using TM-Module.
68 70
 		 * int request(str* m, str* ruri, str* to, str* from, str* h,
69 71
 		 *		str* b, str *oburi,
70 72
 		 *		transaction_cb cb, void* cbp); */
71
-		set_uac_req(&uac_r, &ka_ping_method, 0, 0, 0,
72
-				TMCB_LOCAL_COMPLETED, ka_options_callback,
73
-				(void *) ka_dest);
74
-
75
-		if (tmb.t_request(&uac_r,
76
-					&ka_dest->uri,
77
-					&ka_dest->uri,
78
-					&ka_ping_from,
79
-					&ka_outbound_proxy) < 0) {
73
+		set_uac_req(&uac_r, &ka_ping_method, 0, 0, 0, TMCB_LOCAL_COMPLETED,
74
+				ka_options_callback, (void *)ka_dest);
75
+
76
+		if(tmb.t_request(&uac_r, &ka_dest->uri, &ka_dest->uri, &ka_ping_from,
77
+				   &ka_outbound_proxy)
78
+				< 0) {
80 79
 			LM_ERR("unable to ping [%.*s]\n", ka_dest->uri.len, ka_dest->uri.s);
81 80
 		}
82 81
 
... ...
@@ -91,8 +90,8 @@ void ka_check_timer(unsigned int ticks, void* param)
91 90
  * This Function is called, as soon as the Transaction is finished
92 91
  * (e. g. a Response came in, the timeout was hit, ...)
93 92
  */
94
-static void ka_options_callback( struct cell *t, int type,
95
-		struct tmcb_params *ps )
93
+static void ka_options_callback(
94
+		struct cell *t, int type, struct tmcb_params *ps)
96 95
 {
97 96
 	str uri = {0, 0};
98 97
 	sip_msg_t *msg = NULL;
... ...
@@ -101,25 +100,25 @@ static void ka_options_callback( struct cell *t, int type,
101 100
 	char *state_routes[] = {"", "keepalive:dst-up", "keepalive:dst-down"};
102 101
 
103 102
 	//NOTE: how to be sure destination is still allocated ?
104
-	ka_dest_t *ka_dest = (ka_dest_t *) (*ps->param);
103
+	ka_dest_t *ka_dest = (ka_dest_t *)(*ps->param);
105 104
 
106
-	uri.s   = t->to.s + 5;
105
+	uri.s = t->to.s + 5;
107 106
 	uri.len = t->to.len - 8;
108
-	LM_DBG("OPTIONS-Request was finished with code %d (to %.*s)\n",
109
-			ps->code, ka_dest->uri.len, ka_dest->uri.s); //uri.len, uri.s);
107
+	LM_DBG("OPTIONS-Request was finished with code %d (to %.*s)\n", ps->code,
108
+			ka_dest->uri.len, ka_dest->uri.s); //uri.len, uri.s);
110 109
 
111 110
 
112 111
 	// accepting 2XX return codes
113
-	if (ps->code >= 200 && ps->code <= 299) {
114
-		state              = KA_STATE_UP;
112
+	if(ps->code >= 200 && ps->code <= 299) {
113
+		state = KA_STATE_UP;
115 114
 		ka_dest->last_down = time(NULL);
116 115
 	} else {
117
-		state              = KA_STATE_DOWN;
118
-		ka_dest->last_up   = time(NULL);
116
+		state = KA_STATE_DOWN;
117
+		ka_dest->last_up = time(NULL);
119 118
 	}
120 119
 
121 120
 	LM_DBG("new state is: %d\n", state);
122
-	if (state != ka_dest->state) {
121
+	if(state != ka_dest->state) {
123 122
 		ka_run_route(msg, &uri, state_routes[state]);
124 123
 
125 124
 		if(ka_dest->statechanged_clb != NULL) {
... ...
@@ -140,8 +139,7 @@ static void ka_run_route(sip_msg_t *msg, str *uri, char *route)
140 139
 	struct run_act_ctx ctx;
141 140
 	sip_msg_t *fmsg;
142 141
 
143
-	if (route == NULL)
144
-	{
142
+	if(route == NULL) {
145 143
 		LM_ERR("bad route\n");
146 144
 		return;
147 145
 	}
... ...
@@ -149,17 +147,14 @@ static void ka_run_route(sip_msg_t *msg, str *uri, char *route)
149 147
 	LM_DBG("ka_run_route event_route[%s]\n", route);
150 148
 
151 149
 	rt = route_get(&event_rt, route);
152
-	if (rt < 0 || event_rt.rlist[rt] == NULL)
153
-	{
150
+	if(rt < 0 || event_rt.rlist[rt] == NULL) {
154 151
 		LM_DBG("route *%s* does not exist", route);
155 152
 		return;
156 153
 	}
157 154
 
158 155
 	fmsg = msg;
159
-	if (fmsg == NULL)
160
-	{
161
-		if (faked_msg_init() < 0)
162
-		{
156
+	if(fmsg == NULL) {
157
+		if(faked_msg_init() < 0) {
163 158
 			LM_ERR("faked_msg_init() failed\n");
164 159
 			return;
165 160
 		}
... ...
@@ -179,22 +174,21 @@ static void ka_run_route(sip_msg_t *msg, str *uri, char *route)
179 174
 /*
180 175
  * copy str into dynamically allocated shm memory
181 176
  */
182
-int ka_str_copy(str src, str *dest, char *prefix) {
183
-	int lp = prefix?strlen(prefix):0;
177
+int ka_str_copy(str src, str *dest, char *prefix)
178
+{
179
+	int lp = prefix ? strlen(prefix) : 0;
184 180
 
185
-	dest->s = (char *) shm_malloc((src.len + 1 + lp) * sizeof(char));
186
-	if(dest->s == NULL)
187
-	{
181
+	dest->s = (char *)shm_malloc((src.len + 1 + lp) * sizeof(char));
182
+	if(dest->s == NULL) {
188 183
 		LM_ERR("no more memory!\n");
189 184
 		return -1;
190 185
 	}
191 186
 
192 187
 	if(prefix)
193 188
 		strncpy(dest->s, prefix, lp);
194
-	strncpy(dest->s+lp, src.s, src.len);
195
-	dest->s[src.len+lp] = '\0';
196
-	dest->len           = src.len+lp;
189
+	strncpy(dest->s + lp, src.s, src.len);
190
+	dest->s[src.len + lp] = '\0';
191
+	dest->len = src.len + lp;
197 192
 
198 193
 	return 0;
199 194
 }
200
-
... ...
@@ -43,14 +43,14 @@
43 43
 MODULE_VERSION
44 44
 
45 45
 
46
-static int  mod_init(void);
46
+static int mod_init(void);
47 47
 static void mod_destroy(void);
48
-static int  ka_mod_add_destination(modparam_t type, void *val);
49
-int  ka_init_rpc(void);
50
-int         ka_alloc_destinations_list();
51
-extern void ka_check_timer(unsigned int ticks, void* param);
48
+static int ka_mod_add_destination(modparam_t type, void *val);
49
+int ka_init_rpc(void);
50
+int ka_alloc_destinations_list();
51
+extern void ka_check_timer(unsigned int ticks, void *param);
52 52
 
53
-static int cmd_is_alive(struct sip_msg* msg, char *str1, char *str2);
53
+static int cmd_is_alive(struct sip_msg *msg, char *str1, char *str2);
54 54
 
55 55
 extern struct tm_binds tmb;
56 56
 
... ...
@@ -58,36 +58,37 @@ int ka_ping_interval = 30;
58 58
 ka_destinations_list_t *ka_destinations_list = NULL;
59 59
 
60 60
 
61
-static cmd_export_t cmds[]={
62
-	{"is_alive",       (cmd_function)cmd_is_alive, 1, 0, 0,
63
-		REQUEST_ROUTE|FAILURE_ROUTE|ONREPLY_ROUTE},
61
+static cmd_export_t cmds[] = {
62
+	{"is_alive", (cmd_function)cmd_is_alive, 1, 0, 0,
63
+			REQUEST_ROUTE | FAILURE_ROUTE | ONREPLY_ROUTE},
64 64
 	// internal API
65 65
 	{"bind_keepalive", (cmd_function)bind_keepalive, 0, 0, 0, 0},
66
-	{0,0,0,0,0,0}
66
+	{0, 0, 0, 0, 0, 0}
67 67
 };
68 68
 
69 69
 
70
-static param_export_t params[]={
71
-	{"ping_interval", PARAM_INT                  , &ka_ping_interval},
72
-	{"destination"  , PARAM_STRING|USE_FUNC_PARAM, (void *)ka_mod_add_destination},
73
-	{0,0,0}
70
+static param_export_t params[] = {
71
+	{"ping_interval", PARAM_INT, &ka_ping_interval},
72
+	{"destination", PARAM_STRING | USE_FUNC_PARAM,
73
+				(void *)ka_mod_add_destination},
74
+	{0, 0, 0}
74 75
 };
75 76
 
76 77
 
77 78
 /** module exports */
78
-struct module_exports exports= {
79
+struct module_exports exports = {
79 80
 	"keepalive",
80 81
 	DEFAULT_DLFLAGS, /* dlopen flags */
81 82
 	cmds,
82 83
 	params,
83
-	0,          /* exported statistics */
84
-	0,          /* exported MI functions - no available anymore since 5.0 */
85
-	0,          /* exported pseudo-variables */
86
-	0,          /* extra processes */
87
-	mod_init,   /* module initialization function */
84
+	0,		  /* exported statistics */
85
+	0,		  /* exported MI functions - no available anymore since 5.0 */
86
+	0,		  /* exported pseudo-variables */
87
+	0,		  /* extra processes */
88
+	mod_init, /* module initialization function */
88 89
 	0,
89
-	(destroy_function) mod_destroy,
90
-	0           /* per-child init function */
90
+	(destroy_function)mod_destroy,
91
+	0 /* per-child init function */
91 92
 };
92 93
 
93 94
 
... ...
@@ -98,8 +99,7 @@ static int mod_init(void)
98 99
 {
99 100
 	LM_INFO("Initializing keepalive module\n");
100 101
 
101
-	if (load_tm_api( &tmb ) == -1)
102
-	{
102
+	if(load_tm_api(&tmb) == -1) {
103 103
 		LM_ERR("could not load the TM-functions - please load tm module\n");
104 104
 		return -1;
105 105
 	}
... ...
@@ -109,7 +109,7 @@ static int mod_init(void)
109 109
 		return -1;
110 110
 	}
111 111
 
112
-	if (ka_alloc_destinations_list() < 0)
112
+	if(ka_alloc_destinations_list() < 0)
113 113
 		return -1;
114 114
 
115 115
 	if(register_timer(ka_check_timer, NULL, ka_ping_interval) < 0) {
... ...
@@ -132,7 +132,7 @@ static void mod_destroy(void)
132 132
  * parses string to dispatcher dst flags set
133 133
  * returns <0 on failure or int with flag on success.
134 134
  */
135
-int ka_parse_flags( char* flag_str, int flag_len )
135
+int ka_parse_flags(char *flag_str, int flag_len)
136 136
 {
137 137
 	return 0;
138 138
 }
... ...
@@ -144,7 +144,7 @@ int ka_parse_flags( char* flag_str, int flag_len )
144 144
  */
145 145
 static int ka_mod_add_destination(modparam_t type, void *val)
146 146
 {
147
-	if (ka_alloc_destinations_list() < 0)
147
+	if(ka_alloc_destinations_list() < 0)
148 148
 		return -1;
149 149
 
150 150
 	str dest = {val, strlen(val)};
... ...
@@ -161,12 +161,13 @@ static int ka_mod_add_destination(modparam_t type, void *val)
161 161
  */
162 162
 int ka_alloc_destinations_list()
163 163
 {
164
-	if (ka_destinations_list != NULL) {
164
+	if(ka_destinations_list != NULL) {
165 165
 		LM_DBG("ka_destinations_list already allocated\n");
166 166
 		return 1;
167 167
 	}
168 168
 
169
-	ka_destinations_list = (ka_destinations_list_t *) shm_malloc(sizeof(ka_destinations_list_t));
169
+	ka_destinations_list = (ka_destinations_list_t *)shm_malloc(
170
+			sizeof(ka_destinations_list_t));
170 171
 	if(ka_destinations_list == NULL) {
171 172
 		LM_ERR("no more memory.\n");
172 173
 		return -1;
... ...
@@ -176,13 +177,13 @@ int ka_alloc_destinations_list()
176 177
 }
177 178
 
178 179
 
179
-static int cmd_is_alive(struct sip_msg* msg, char *str1, char *str2)
180
+static int cmd_is_alive(struct sip_msg *msg, char *str1, char *str2)
180 181
 {
181 182
 	str dest = {str1, strlen(str1)};
182 183
 
183 184
 	ka_state state = ka_destination_state(dest);
184 185
 	// must not return 0, as it stops dialplan execution
185
-	if (state == KA_STATE_UNKNOWN) {
186
+	if(state == KA_STATE_UNKNOWN) {
186 187
 		return KA_STATE_UP;
187 188
 	}
188 189
 
... ...
@@ -49,8 +49,9 @@ rpc_export_t keepalive_rpc_cmds[] = {
49 49
 	{0, 0, 0, 0}
50 50
 };
51 51
 
52
-int ka_init_rpc(void) {
53
-	if (rpc_register_array(keepalive_rpc_cmds) != 0) {
52
+int ka_init_rpc(void)
53
+{
54
+	if(rpc_register_array(keepalive_rpc_cmds) != 0) {
54 55
 		LM_ERR("failed to register RPC commands\n");
55 56
 	}
56 57
 
... ...
@@ -60,7 +61,8 @@ int ka_init_rpc(void) {
60 61
 static const char *keepalive_rpc_list_doc[2] = {
61 62
 		"Return the content of dispatcher sets", 0};
62 63
 
63
-static void keepalive_rpc_list(rpc_t *rpc, void *ctx) {
64
+static void keepalive_rpc_list(rpc_t *rpc, void *ctx)
65
+{
64 66
 	void *foo, *bar, *baz;
65 67
 	void *sub;
66 68
 	ka_dest_t *dest;
... ...
@@ -69,9 +71,9 @@ static void keepalive_rpc_list(rpc_t *rpc, void *ctx) {
69 71
 	char *_dtime;
70 72
 	str text = str_init("foobar");
71 73
 
72
-	if (rpc->add(ctx, "Sd", &text, 42) < 0)
74
+	if(rpc->add(ctx, "Sd", &text, 42) < 0)
73 75
 		LM_ERR("failed creating RPC struct\n");
74
-	if (rpc->add(ctx, "Sd", &text, 42) < 0)
76
+	if(rpc->add(ctx, "Sd", &text, 42) < 0)
75 77
 		LM_ERR("failed creating RPC struct\n");
76 78
 
77 79
 	rpc->add(ctx, "{", &foo);
... ...
@@ -85,9 +87,7 @@ static void keepalive_rpc_list(rpc_t *rpc, void *ctx) {
85 87
 	for(dest = ka_destinations_list->first; dest != NULL; dest = dest->next) {
86 88
 		rpc->add(ctx, "{", &sub);
87 89
 
88
-		rpc->struct_add(sub, "SS",
89
-			"uri"  , &dest->uri,
90
-			"owner", &dest->owner);
90
+		rpc->struct_add(sub, "SS", "uri", &dest->uri, "owner", &dest->owner);
91 91
 
92 92
 		_ctime = ctime(&dest->last_checked);
93 93
 		_ctime[strlen(_ctime) - 1] = '\0';