Browse code

acc: expose accounting functions via inter-module api

Daniel-Constantin Mierla authored on 25/11/2021 12:36:59
Showing 2 changed files
... ...
@@ -146,8 +146,16 @@ typedef acc_extra_t* (*parse_extra_f)(char *extra_str);
146 146
 typedef int (*register_cdr_engine_f)(cdr_engine_t *eng);
147 147
 typedef int (*cdr_api_exec_f)(struct dlg_cell *dlg, struct sip_msg *rq, cdr_engine_t *eng, acc_param_t* comment);
148 148
 
149
+typedef int (*acc_log_request_f)(sip_msg_t *msg, str *comment);
150
+typedef int (*acc_db_request_f)(sip_msg_t *msg, str *comment, str *dbtable);
151
+typedef int (*acc_request_f)(sip_msg_t *msg, str *comment, str *dbtable);
152
+
153
+
149 154
 /* the acc API */
150 155
 typedef struct acc_api {
156
+	acc_log_request_f acc_log_request;
157
+	acc_db_request_f  acc_db_request;
158
+	acc_request_f     acc_request;
151 159
 	leg_info_f    get_leg_info;
152 160
 	core2strar_f  get_core_attrs;
153 161
 	extra2strar_f get_extra_attrs;
... ...
@@ -644,6 +644,12 @@ static int bind_acc(acc_api_t* api)
644 644
 		return -1;
645 645
 	}
646 646
 
647
+	memset(api, 0, sizeof(acc_api_t));
648
+
649
+	api->acc_log_request = ki_acc_log_request;
650
+	api->acc_db_request  = ki_acc_db_request;
651
+	api->acc_request     = ki_acc_request;
652
+
647 653
 	api->register_engine = acc_register_engine;
648 654
 	api->get_leg_info    = get_leg_info;
649 655
 	api->get_core_attrs  = core2strar;