Pārlūkot izejas kodu

core: new core event: SREV_CFG_RUN_ACTION

- it is fired for each action executed from configuration file
- parameters are current acction and sip message given as a void* array
  of two elements
Daniel-Constantin Mierla 15 gadi atpakaļ
vecāks
revīzija
1a7ef918ab
2 mainītis faili ar 13 papildinājumiem un 0 dzēšanām
  1. 11 0
      events.c
  2. 2 0
      events.h

+ 11 - 0
events.c

@@ -60,6 +60,11 @@ int sr_event_register_cb(int type, sr_event_cb_f f)
 					_sr_events_list.core_stats = f;
 				else return -1;
 			break;
+		case SREV_CFG_RUN_ACTION:
+				if(_sr_events_list.run_action==0)
+					_sr_events_list.run_action = f;
+				else return -1;
+			break;
 		default:
 			return -1;
 	}
@@ -110,6 +115,12 @@ int sr_event_exec(int type, void *data)
 					return ret;
 				} else return 1;
 			break;
+		case SREV_CFG_RUN_ACTION:
+				if(unlikely(_sr_events_list.run_action!=0))
+				{
+					ret = _sr_events_list.run_action(data);
+					return ret;
+				} else return 1;
 		default:
 			return -1;
 	}

+ 2 - 0
events.h

@@ -26,6 +26,7 @@
 #define SREV_NET_DATA_IN	1
 #define SREV_NET_DATA_OUT	2
 #define SREV_CORE_STATS		3
+#define SREV_CFG_RUN_ACTION 4
 
 typedef int (*sr_event_cb_f)(void *data);
 
@@ -33,6 +34,7 @@ typedef struct sr_event_cb {
 	sr_event_cb_f net_data_in;
 	sr_event_cb_f net_data_out;
 	sr_event_cb_f core_stats;
+	sr_event_cb_f run_action;
 } sr_event_cb_t;
 
 void sr_event_cb_init(void);