mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@184 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -54,7 +54,8 @@ struct switch_event {
|
||||
char *owner;
|
||||
switch_event_subclass *subclass;
|
||||
struct switch_event_header *headers;
|
||||
void *user_data;
|
||||
void *bind_user_data;
|
||||
void *event_user_data;
|
||||
struct switch_event *next;
|
||||
};
|
||||
|
||||
@@ -76,7 +77,7 @@ SWITCH_DECLARE(char *) switch_event_get_header(switch_event *event, char *header
|
||||
SWITCH_DECLARE(switch_status) switch_event_add_header(switch_event *event, char *header_name, char *fmt, ...);
|
||||
SWITCH_DECLARE(void) switch_event_destroy(switch_event **event);
|
||||
SWITCH_DECLARE(switch_status) switch_event_dup(switch_event **event, switch_event *todup);
|
||||
SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func, int line, switch_event **event);
|
||||
SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func, int line, switch_event **event, void *user_data);
|
||||
SWITCH_DECLARE(switch_status) switch_event_bind(char *id, switch_event_t event, char *subclass_name, switch_event_callback_t callback, void *user_data);
|
||||
SWITCH_DECLARE(char *) switch_event_name(switch_event_t event);
|
||||
SWITCH_DECLARE(switch_status) switch_event_reserve_subclass_detailed(char *owner, char *subclass_name);
|
||||
@@ -84,6 +85,7 @@ SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event *event, char *
|
||||
|
||||
#define switch_event_reserve_subclass(subclass_name) switch_event_reserve_subclass_detailed(__FILE__, subclass_name)
|
||||
#define switch_event_create(event, id) switch_event_create_subclass(event, id, SWITCH_EVENT_SUBCLASS_ANY)
|
||||
#define switch_event_fire(event) switch_event_fire_detailed(__FILE__, __FUNCTION__, __LINE__, event)
|
||||
#define switch_event_fire(event) switch_event_fire_detailed(__FILE__, (char * )__FUNCTION__, __LINE__, event, NULL)
|
||||
#define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (char * )__FUNCTION__, __LINE__, event, data)
|
||||
|
||||
#endif
|
||||
|
@@ -142,7 +142,7 @@ static void * SWITCH_THREAD_FUNC switch_event_thread(switch_thread *thread, void
|
||||
for(e = out_event->event_id;; e = SWITCH_EVENT_ALL) {
|
||||
for(node = EVENT_NODES[e]; node; node = node->next) {
|
||||
if (switch_events_match(out_event, node)) {
|
||||
out_event->user_data = node->user_data;
|
||||
out_event->bind_user_data = node->user_data;
|
||||
node->callback(out_event);
|
||||
}
|
||||
}
|
||||
@@ -342,7 +342,8 @@ SWITCH_DECLARE(switch_status) switch_event_dup(switch_event **event, switch_even
|
||||
}
|
||||
|
||||
(*event)->subclass = todup->subclass;
|
||||
(*event)->user_data = todup->user_data;
|
||||
(*event)->event_user_data = todup->event_user_data;
|
||||
(*event)->bind_user_data = todup->bind_user_data;
|
||||
|
||||
for (hp = todup->headers; hp && hp->next;) {
|
||||
if (!(header = malloc(sizeof(*header)))) {
|
||||
@@ -397,7 +398,7 @@ SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event *event, char *
|
||||
len = strlen(buf);
|
||||
}
|
||||
if (data) {
|
||||
snprintf(buf+len, buflen-len, "Content-Length: %d\n\n%s", strlen(data), data);
|
||||
snprintf(buf+len, buflen-len, "Content-Length: %d\n\n%s", (int)strlen(data), data);
|
||||
free(data);
|
||||
} else {
|
||||
snprintf(buf+len, buflen-len, "\n");
|
||||
@@ -407,7 +408,7 @@ SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event *event, char *
|
||||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func, int line, switch_event **event)
|
||||
SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func, int line, switch_event **event, void *user_data)
|
||||
{
|
||||
|
||||
switch_event *ep;
|
||||
@@ -419,6 +420,10 @@ SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func,
|
||||
switch_event_add_header(*event, "function", func);
|
||||
switch_event_add_header(*event, "line_number", "%d", line);
|
||||
|
||||
if (user_data) {
|
||||
(*event)->event_user_data = user_data;
|
||||
}
|
||||
|
||||
switch_mutex_lock(QLOCK);
|
||||
/* <LOCKED> -----------------------------------------------*/
|
||||
for(ep = EVENT_QUEUE_HEAD; ep && ep->next; ep = ep->next);
|
||||
|
Reference in New Issue
Block a user