core: new core event: SREV_CFG_RUN_ACTION
authorDaniel-Constantin Mierla <miconda@gmail.com>
Wed, 3 Feb 2010 23:05:41 +0000 (00:05 +0100)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Wed, 3 Feb 2010 23:10:09 +0000 (00:10 +0100)
- 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

events.c
events.h

index 6b29fa2..f2be3ad 100644 (file)
--- a/events.c
+++ b/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;
        }
index 9af0d71..5c7238a 100644 (file)
--- a/events.h
+++ b/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);