Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
19c29ee3
提交
19c29ee3
authored
1月 03, 2017
作者:
Mike Jerris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-9903: [msrp] fix namespacing and visibility of some structs and defines for ssl private header
上级
ded506f6
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
58 行增加
和
62 行删除
+58
-62
switch_msrp.h
src/include/switch_msrp.h
+11
-29
switch_ssl.h
src/include/switch_ssl.h
+0
-4
switch_msrp.c
src/switch_msrp.c
+47
-29
没有找到文件。
src/include/switch_msrp.h
浏览文件 @
19c29ee3
...
...
@@ -33,8 +33,6 @@
#define _MSRP_H
#include <switch.h>
#include <switch_ssl.h>
#define MSRP_LISTEN_PORT 2855
#define MSRP_SSL_LISTEN_PORT 2856
...
...
@@ -65,6 +63,10 @@ enum {
MSRP_H_UNKNOWN
};
typedef
struct
switch_msrp_session_s
switch_msrp_session_t
;
typedef
struct
msrp_client_socket_s
switch_msrp_client_socket_t
;
typedef
struct
msrp_socket_s
switch_msrp_socket_t
;
typedef
struct
msrp_msg_s
{
int
state
;
int
method
;
...
...
@@ -82,24 +84,7 @@ typedef struct msrp_msg_s {
char
*
last_p
;
char
*
payload
;
struct
msrp_msg_s
*
next
;
}
msrp_msg_t
;
typedef
struct
msrp_msg_s
switch_msrp_msg_t
;
typedef
struct
msrp_socket_s
{
switch_port_t
port
;
switch_socket_t
*
sock
;
switch_thread_t
*
thread
;
int
secure
;
}
msrp_socket_t
;
struct
msrp_client_socket_s
{
switch_socket_t
*
sock
;
SSL
*
ssl
;
int
secure
;
int
client_mode
;
struct
switch_msrp_session_s
*
msrp_session
;
};
}
switch_msrp_msg_t
;
struct
switch_msrp_session_s
{
switch_memory_pool_t
*
pool
;
...
...
@@ -117,29 +102,26 @@ struct switch_msrp_session_s{
char
*
local_file_selector
;
int
local_port
;
char
*
call_id
;
msrp_msg_t
*
msrp_msg
;
msrp_msg_t
*
last_msg
;
switch_
msrp_msg_t
*
msrp_msg
;
switch_
msrp_msg_t
*
last_msg
;
switch_mutex_t
*
mutex
;
switch_size_t
msrp_msg_buffer_size
;
switch_size_t
msrp_msg_count
;
msrp_socket_t
*
msock
;
s
truct
msrp_client_socket_s
*
csock
;
switch_
msrp_socket_t
*
msock
;
s
witch_msrp_client_socket_t
*
csock
;
switch_frame_t
frame
;
uint8_t
frame_data
[
SWITCH_RTP_MAX_BUF_LEN
];
int
running
;
void
*
user_data
;
};
typedef
struct
msrp_client_socket_s
msrp_client_socket_t
;
typedef
struct
switch_msrp_session_s
switch_msrp_session_t
;
SWITCH_DECLARE
(
switch_status_t
)
switch_msrp_init
(
void
);
SWITCH_DECLARE
(
switch_status_t
)
switch_msrp_destroy
(
void
);
SWITCH_DECLARE
(
switch_msrp_session_t
*
)
switch_msrp_session_new
(
switch_memory_pool_t
*
pool
,
const
char
*
call_id
,
switch_bool_t
secure
);
SWITCH_DECLARE
(
switch_status_t
)
switch_msrp_session_destroy
(
switch_msrp_session_t
**
ms
);
// switch_status_t switch_msrp_session_push_msg(switch_msrp_session_t *ms, msrp_msg_t *msg);
// switch_status_t switch_msrp_session_push_msg(switch_msrp_session_t *ms,
switch_
msrp_msg_t *msg);
SWITCH_DECLARE
(
switch_msrp_msg_t
*
)
switch_msrp_session_pop_msg
(
switch_msrp_session_t
*
ms
);
SWITCH_DECLARE
(
switch_status_t
)
switch_msrp_perform_send
(
switch_msrp_session_t
*
ms
,
msrp_msg_t
*
msg
,
const
char
*
file
,
const
char
*
func
,
int
line
);
SWITCH_DECLARE
(
switch_status_t
)
switch_msrp_perform_send
(
switch_msrp_session_t
*
ms
,
switch_
msrp_msg_t
*
msg
,
const
char
*
file
,
const
char
*
func
,
int
line
);
SWITCH_DECLARE
(
switch_status_t
)
switch_msrp_start_client
(
switch_msrp_session_t
*
msrp_session
);
SWITCH_DECLARE
(
const
char
*
)
switch_msrp_listen_ip
(
void
);
...
...
src/include/switch_ssl.h
浏览文件 @
19c29ee3
...
...
@@ -31,10 +31,6 @@
#ifndef __SWITCH_SSL_H
#define __SWITCH_SSL_H
#ifndef HAVE_OPENSSL
#define HAVE_OPENSSL
#endif
#if defined(HAVE_OPENSSL)
#if defined (MACOSX) || defined(DARWIN)
/* Disable depricated-declarations on OS X */
...
...
src/switch_msrp.c
浏览文件 @
19c29ee3
...
...
@@ -30,11 +30,29 @@
*/
#include <switch.h>
#include <switch_ssl.h>
#include <switch_msrp.h>
#include <switch_stun.h>
#define MSRP_BUFF_SIZE SWITCH_RTP_MAX_BUF_LEN
#define DEBUG_MSRP 0
#define MSRP_LISTEN_PORT 2855
#define MSRP_SSL_LISTEN_PORT 2856
struct
msrp_socket_s
{
switch_port_t
port
;
switch_socket_t
*
sock
;
switch_thread_t
*
thread
;
int
secure
;
};
struct
msrp_client_socket_s
{
switch_socket_t
*
sock
;
SSL
*
ssl
;
int
secure
;
int
client_mode
;
struct
switch_msrp_session_s
*
msrp_session
;
};
static
struct
{
int
running
;
...
...
@@ -52,14 +70,14 @@ static struct {
const
SSL_METHOD
*
ssl_client_method
;
SSL_CTX
*
ssl_client_ctx
;
msrp_socket_t
msock
;
msrp_socket_t
msock_ssl
;
switch_
msrp_socket_t
msock
;
switch_
msrp_socket_t
msock_ssl
;
}
globals
;
typedef
struct
worker_helper
{
int
debug
;
switch_memory_pool_t
*
pool
;
msrp_client_socket_t
csock
;
switch_
msrp_client_socket_t
csock
;
switch_msrp_session_t
*
msrp_session
;
}
worker_helper_t
;
...
...
@@ -357,7 +375,7 @@ SWITCH_DECLARE(switch_status_t) switch_msrp_session_destroy(switch_msrp_session_
return
SWITCH_STATUS_SUCCESS
;
}
switch_status_t
switch_msrp_session_push_msg
(
switch_msrp_session_t
*
ms
,
msrp_msg_t
*
msg
)
switch_status_t
switch_msrp_session_push_msg
(
switch_msrp_session_t
*
ms
,
switch_
msrp_msg_t
*
msg
)
{
switch_mutex_lock
(
ms
->
mutex
);
...
...
@@ -378,9 +396,9 @@ switch_status_t switch_msrp_session_push_msg(switch_msrp_session_t *ms, msrp_msg
return
SWITCH_STATUS_SUCCESS
;
}
SWITCH_DECLARE
(
msrp_msg_t
*
)
switch_msrp_session_pop_msg
(
switch_msrp_session_t
*
ms
)
SWITCH_DECLARE
(
switch_
msrp_msg_t
*
)
switch_msrp_session_pop_msg
(
switch_msrp_session_t
*
ms
)
{
msrp_msg_t
*
m
=
ms
->
msrp_msg
;
switch_
msrp_msg_t
*
m
=
ms
->
msrp_msg
;
if
(
m
==
NULL
)
{
switch_yield
(
20000
);
return
NULL
;
...
...
@@ -394,7 +412,7 @@ SWITCH_DECLARE(msrp_msg_t *)switch_msrp_session_pop_msg(switch_msrp_session_t *m
return
m
;
}
switch_status_t
msrp_msg_serialize
(
msrp_msg_t
*
msrp_msg
,
char
*
buf
)
switch_status_t
msrp_msg_serialize
(
switch_
msrp_msg_t
*
msrp_msg
,
char
*
buf
)
{
char
*
code_number_str
=
switch_mprintf
(
"%d"
,
msrp_msg
->
code_number
);
char
method
[
10
];
...
...
@@ -427,7 +445,7 @@ switch_status_t msrp_msg_serialize(msrp_msg_t *msrp_msg, char *buf)
return
SWITCH_STATUS_SUCCESS
;
}
static
switch_status_t
msrp_socket_recv
(
msrp_client_socket_t
*
csock
,
char
*
buf
,
switch_size_t
*
len
)
static
switch_status_t
msrp_socket_recv
(
switch_
msrp_client_socket_t
*
csock
,
char
*
buf
,
switch_size_t
*
len
)
{
switch_status_t
status
=
SWITCH_STATUS_FALSE
;
...
...
@@ -451,7 +469,7 @@ static switch_status_t msrp_socket_recv(msrp_client_socket_t *csock, char *buf,
return
status
;
}
static
switch_status_t
msrp_socket_send
(
msrp_client_socket_t
*
csock
,
char
*
buf
,
switch_size_t
*
len
)
static
switch_status_t
msrp_socket_send
(
switch_
msrp_client_socket_t
*
csock
,
char
*
buf
,
switch_size_t
*
len
)
{
if
(
csock
->
secure
)
{
*
len
=
SSL_write
(
csock
->
ssl
,
buf
,
*
len
);
...
...
@@ -527,7 +545,7 @@ Byte-Range: 1-0/0
-------d4c667b2351e958f$
*/
char
*
msrp_parse_header
(
char
*
start
,
int
skip
,
const
char
*
end
,
msrp_msg_t
*
msrp_msg
,
int
index
,
switch_memory_pool_t
*
pool
)
char
*
msrp_parse_header
(
char
*
start
,
int
skip
,
const
char
*
end
,
switch_
msrp_msg_t
*
msrp_msg
,
int
index
,
switch_memory_pool_t
*
pool
)
{
char
*
p
=
start
+
skip
;
char
*
q
;
...
...
@@ -544,7 +562,7 @@ char *msrp_parse_header(char *start, int skip, const char *end, msrp_msg_t *msrp
return
start
;
}
msrp_msg_t
*
msrp_parse_headers
(
const
char
*
start
,
int
len
,
msrp_msg_t
*
msrp_msg
,
switch_memory_pool_t
*
pool
)
switch_msrp_msg_t
*
msrp_parse_headers
(
const
char
*
start
,
int
len
,
switch_
msrp_msg_t
*
msrp_msg
,
switch_memory_pool_t
*
pool
)
{
char
*
p
=
(
char
*
)
start
;
char
*
q
=
p
;
...
...
@@ -719,12 +737,12 @@ done:
return
msrp_msg
;
}
msrp_msg_t
*
msrp_parse_buffer
(
char
*
buf
,
int
len
,
msrp_msg_t
*
msrp_msg
,
switch_memory_pool_t
*
pool
)
switch_msrp_msg_t
*
msrp_parse_buffer
(
char
*
buf
,
int
len
,
switch_
msrp_msg_t
*
msrp_msg
,
switch_memory_pool_t
*
pool
)
{
const
char
*
start
;
if
(
!
msrp_msg
)
{
switch_zmalloc
(
msrp_msg
,
sizeof
(
msrp_msg_t
));
switch_zmalloc
(
msrp_msg
,
sizeof
(
switch_
msrp_msg_t
));
switch_assert
(
msrp_msg
);
msrp_msg
->
state
=
MSRP_ST_WAIT_HEADER
;
}
...
...
@@ -828,7 +846,7 @@ msrp_msg_t *msrp_parse_buffer(char *buf, int len, msrp_msg_t *msrp_msg, switch_m
}
switch_status_t
msrp_reply
(
msrp_client_socket_t
*
csock
,
msrp_msg_t
*
msrp_msg
)
switch_status_t
msrp_reply
(
switch_msrp_client_socket_t
*
csock
,
switch_
msrp_msg_t
*
msrp_msg
)
{
char
buf
[
2048
];
switch_size_t
len
;
...
...
@@ -843,7 +861,7 @@ switch_status_t msrp_reply(msrp_client_socket_t *csock, msrp_msg_t *msrp_msg)
return
msrp_socket_send
(
csock
,
buf
,
&
len
);
}
switch_status_t
msrp_report
(
msrp_client_socket_t
*
csock
,
msrp_msg_t
*
msrp_msg
,
char
*
status_code
)
switch_status_t
msrp_report
(
switch_msrp_client_socket_t
*
csock
,
switch_
msrp_msg_t
*
msrp_msg
,
char
*
status_code
)
{
char
buf
[
2048
];
switch_size_t
len
;
...
...
@@ -883,14 +901,14 @@ static switch_bool_t msrp_find_uuid(char *uuid, char *to_path)
static
void
*
SWITCH_THREAD_FUNC
msrp_worker
(
switch_thread_t
*
thread
,
void
*
obj
)
{
worker_helper_t
*
helper
=
(
worker_helper_t
*
)
obj
;
msrp_client_socket_t
*
csock
=
&
helper
->
csock
;
switch_
msrp_client_socket_t
*
csock
=
&
helper
->
csock
;
switch_memory_pool_t
*
pool
=
helper
->
pool
;
char
buf
[
MSRP_BUFF_SIZE
];
char
*
p
;
char
*
last_p
;
switch_size_t
len
=
MSRP_BUFF_SIZE
;
switch_status_t
status
;
msrp_msg_t
*
msrp_msg
=
NULL
;
switch_
msrp_msg_t
*
msrp_msg
=
NULL
;
char
uuid
[
128
]
=
{
0
};
switch_msrp_session_t
*
msrp_session
=
NULL
;
int
sanity
=
10
;
...
...
@@ -1139,7 +1157,7 @@ static void *SWITCH_THREAD_FUNC msrp_worker(switch_thread_t *thread, void *obj)
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_ERROR
,
"state:%d, len:%"
SWITCH_SIZE_T_FMT
" payload_bytes:%"
SWITCH_SIZE_T_FMT
"
\n
"
,
msrp_msg
->
state
,
len
,
msrp_msg
->
payload_bytes
);
// {
// char bbb[MSRP_BUFF_SIZE * 2];
// msrp_msg_serialize(msrp_msg_tmp, bbb),
// msrp_msg_serialize(
switch_
msrp_msg_tmp, bbb),
// }
}
...
...
@@ -1194,10 +1212,10 @@ static void *SWITCH_THREAD_FUNC msrp_worker(switch_thread_t *thread, void *obj)
{
int
i
;
msrp_msg_t
*
msrp_msg_old
=
msrp_msg
;
switch_
msrp_msg_t
*
msrp_msg_old
=
msrp_msg
;
msrp_msg
=
NULL
;
/*dup msrp_msg*/
switch_zmalloc
(
msrp_msg
,
sizeof
(
msrp_msg_t
));
switch_zmalloc
(
msrp_msg
,
sizeof
(
switch_
msrp_msg_t
));
switch_assert
(
msrp_msg
);
msrp_msg
->
state
=
msrp_msg_old
->
state
;
msrp_msg
->
byte_start
=
msrp_msg_old
->
byte_end
+
1
;
...
...
@@ -1256,7 +1274,7 @@ end:
static
void
*
SWITCH_THREAD_FUNC
msrp_listener
(
switch_thread_t
*
thread
,
void
*
obj
)
{
msrp_socket_t
*
msock
=
(
msrp_socket_t
*
)
obj
;
switch_msrp_socket_t
*
msock
=
(
switch_
msrp_socket_t
*
)
obj
;
switch_status_t
rv
;
switch_memory_pool_t
*
pool
=
NULL
;
switch_threadattr_t
*
thd_attr
=
NULL
;
...
...
@@ -1349,7 +1367,7 @@ void random_string(char *buf, uint16_t size)
}
#define MSRP_TRANS_ID_LEN 16
SWITCH_DECLARE
(
switch_status_t
)
switch_msrp_perform_send
(
switch_msrp_session_t
*
ms
,
msrp_msg_t
*
msrp_msg
,
const
char
*
file
,
const
char
*
func
,
int
line
)
SWITCH_DECLARE
(
switch_status_t
)
switch_msrp_perform_send
(
switch_msrp_session_t
*
ms
,
switch_
msrp_msg_t
*
msrp_msg
,
const
char
*
file
,
const
char
*
func
,
int
line
)
{
char
transaction_id
[
MSRP_TRANS_ID_LEN
+
1
]
=
{
0
};
char
buf
[
MSRP_BUFF_SIZE
];
...
...
@@ -1400,7 +1418,7 @@ SWITCH_DECLARE(switch_status_t) switch_msrp_perform_send(switch_msrp_session_t *
SWITCH_STANDARD_APP(msrp_echo_function)
{
msrp_session_t *msrp_session = NULL;
msrp_msg_t *msrp_msg = NULL;
switch_
msrp_msg_t *msrp_msg = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session);
// private_object_t *tech_pvt = switch_core_session_get_private(session);
...
...
@@ -1441,7 +1459,7 @@ SWITCH_STANDARD_APP(msrp_echo_function)
SWITCH_STANDARD_APP(msrp_recv_function)
{
msrp_session_t *msrp_session = NULL;
msrp_msg_t *msrp_msg = NULL;
switch_
msrp_msg_t *msrp_msg = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session);
private_object_t *tech_pvt = switch_core_session_get_private(session);
switch_memory_pool_t *pool = switch_core_session_get_pool(session);
...
...
@@ -1507,7 +1525,7 @@ SWITCH_STANDARD_APP(msrp_recv_function)
SWITCH_STANDARD_APP(msrp_send_function)
{
msrp_session_t *msrp_session = NULL;
msrp_msg_t *msrp_msg = NULL;
switch_
msrp_msg_t *msrp_msg = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session);
private_object_t *tech_pvt = switch_core_session_get_private(session);
switch_memory_pool_t *pool = switch_core_session_get_pool(session);
...
...
@@ -1539,7 +1557,7 @@ SWITCH_STANDARD_APP(msrp_send_function)
switch_assert(pool);
switch_zmalloc(msrp_msg, sizeof(msrp_msg_t));
switch_zmalloc(msrp_msg, sizeof(
switch_
msrp_msg_t));
switch_assert(msrp_msg);
msrp_msg->headers[MSRP_H_FROM_PATH] = switch_mprintf("msrp://%s:%d/%s;tcp",
...
...
@@ -1600,7 +1618,7 @@ SWITCH_STANDARD_APP(msrp_bridge_function)
msrp_session_t *peer_msrp_session = NULL;
private_object_t *tech_pvt = NULL;
private_object_t *ptech_pvt = NULL;
msrp_msg_t *msrp_msg = NULL;
switch_
msrp_msg_t *msrp_msg = NULL;
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
switch_status_t status;
...
...
@@ -1683,7 +1701,7 @@ SWITCH_STANDARD_API(uuid_msrp_send_function)
int argc;
switch_core_session_t *msession = NULL;
// msrp_session_t *msrp_session = NULL;
msrp_msg_t *msrp_msg = NULL;
switch_
msrp_msg_t *msrp_msg = NULL;
private_object_t *tech_pvt = NULL;
switch_memory_pool_t *pool = NULL;
...
...
@@ -1718,7 +1736,7 @@ SWITCH_STANDARD_API(uuid_msrp_send_function)
return SWITCH_STATUS_SUCCESS;
}
switch_zmalloc(msrp_msg, sizeof(msrp_msg_t));
switch_zmalloc(msrp_msg, sizeof(
switch_
msrp_msg_t));
switch_assert(msrp_msg);
msrp_msg->headers[MSRP_H_FROM_PATH] = switch_mprintf("msrp://%s:%d/%s;tcp",
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论