From eb83431dcb27dd2b6b5e64c731aa8d59ab9170c3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 22 May 2009 18:19:55 +0000 Subject: [PATCH] add some stuff for zrtp git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13426 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_core.h | 5 +++++ src/include/switch_frame.h | 4 +++- src/include/switch_types.h | 3 ++- src/switch_core_memory.c | 14 ++++++++++++++ src/switch_core_session.c | 2 ++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 47ee84caf3..9d0623de06 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -448,6 +448,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(_Inout_ */ #define switch_core_destroy_memory_pool(p) switch_core_perform_destroy_memory_pool(p, __FILE__, __SWITCH_FUNC__, __LINE__) + +SWITCH_DECLARE(void) switch_core_memory_pool_set_data(switch_memory_pool_t *pool, const char *key, void *data); +SWITCH_DECLARE(void *) switch_core_memory_pool_get_data(switch_memory_pool_t *pool, const char *key); + + /*! \brief Start the session's state machine \param session the session on which to start the state machine diff --git a/src/include/switch_frame.h b/src/include/switch_frame.h index 19701374d8..b00b54aa91 100644 --- a/src/include/switch_frame.h +++ b/src/include/switch_frame.h @@ -46,9 +46,11 @@ SWITCH_BEGIN_EXTERN_C /*! the originating source of the frame */ const char *source; /*! the raw packet */ - void *packet; + void *packet; /*! the size of the raw packet when applicable */ uint32_t packetlen; + /*! the extra frame data */ + void *extra_data; /*! the frame data */ void *data; /*! the size of the buffer that is in use */ diff --git a/src/include/switch_types.h b/src/include/switch_types.h index f4d92e83df..c165baed81 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -920,7 +920,8 @@ typedef enum { SFF_PLC = (1 << 3), SFF_RFC2833 = (1 << 4), SFF_PROXY_PACKET = (1 << 5), - SFF_DYNAMIC = (1 << 6) + SFF_DYNAMIC = (1 << 6), + SFF_ZRTP = (1 << 7) } switch_frame_flag_enum_t; typedef uint32_t switch_frame_flag_t; diff --git a/src/switch_core_memory.c b/src/switch_core_memory.c index 28c87337c3..177abc1dca 100644 --- a/src/switch_core_memory.c +++ b/src/switch_core_memory.c @@ -304,6 +304,20 @@ SWITCH_DECLARE(char *) switch_core_perform_strdup(switch_memory_pool_t *pool, co return duped; } +SWITCH_DECLARE(void) switch_core_memory_pool_set_data(switch_memory_pool_t *pool, const char *key, void *data) +{ + apr_pool_userdata_set(data, key, NULL, pool); +} + +SWITCH_DECLARE(void *) switch_core_memory_pool_get_data(switch_memory_pool_t *pool, const char *key) +{ + void *data = NULL; + + apr_pool_userdata_get(&data, key, pool); + + return data; +} + SWITCH_DECLARE(void) switch_core_memory_pool_tag(switch_memory_pool_t *pool, const char *tag) { apr_pool_tag(pool, tag); diff --git a/src/switch_core_session.c b/src/switch_core_session.c index a70caa7c41..a9a95470a6 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1206,6 +1206,8 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_ session = switch_core_alloc(usepool, sizeof(*session)); session->pool = usepool; + + switch_core_memory_pool_set_data(session->pool, "__session", session); if (switch_channel_alloc(&session->channel, direction, session->pool) != SWITCH_STATUS_SUCCESS) { abort();