Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
1ffb1ee0
提交
1ffb1ee0
authored
6月 11, 2014
作者:
Michael Jerris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WIP
上级
94ab52cd
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
9203 行增加
和
0 行删除
+9203
-0
modules.conf.in
build/modules.conf.in
+1
-0
configure.ac
configure.ac
+1
-0
Makefile.am
src/mod/endpoints/mod_verto/Makefile.am
+38
-0
.gitignore
src/mod/endpoints/mod_verto/mcast/.gitignore
+2
-0
MCAST.i
src/mod/endpoints/mod_verto/mcast/MCAST.i
+24
-0
MCAST.pm
src/mod/endpoints/mod_verto/mcast/MCAST.pm
+108
-0
mcast.c
src/mod/endpoints/mod_verto/mcast/mcast.c
+173
-0
mcast.h
src/mod/endpoints/mod_verto/mcast/mcast.h
+78
-0
mcast_cpp.cpp
src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp
+69
-0
mcast_cpp.h
src/mod/endpoints/mod_verto/mcast/mcast_cpp.h
+59
-0
mcast_wrap.cpp
src/mod/endpoints/mod_verto/mcast/mcast_wrap.cpp
+2254
-0
perlxsi.c
src/mod/endpoints/mod_verto/mcast/perlxsi.c
+16
-0
test.c
src/mod/endpoints/mod_verto/mcast/test.c
+29
-0
test.pl
src/mod/endpoints/mod_verto/mcast/test.pl
+19
-0
test2.pl
src/mod/endpoints/mod_verto/mcast/test2.pl
+23
-0
mod_verto.2008.vcproj
src/mod/endpoints/mod_verto/mod_verto.2008.vcproj
+287
-0
mod_verto.2010.vcxproj
src/mod/endpoints/mod_verto/mod_verto.2010.vcxproj
+131
-0
mod_verto.2012.vcxproj
src/mod/endpoints/mod_verto/mod_verto.2012.vcxproj
+135
-0
mod_verto.c
src/mod/endpoints/mod_verto/mod_verto.c
+4485
-0
mod_verto.h
src/mod/endpoints/mod_verto/mod_verto.h
+272
-0
ws.c
src/mod/endpoints/mod_verto/ws.c
+879
-0
ws.h
src/mod/endpoints/mod_verto/ws.h
+120
-0
没有找到文件。
build/modules.conf.in
浏览文件 @
1ffb1ee0
...
...
@@ -83,6 +83,7 @@ dialplans/mod_dialplan_xml
#endpoints/mod_h323
#endpoints/mod_khomp
endpoints/mod_rtc
endpoints/mod_verto
endpoints/mod_loopback
#endpoints/mod_opal
#endpoints/mod_portaudio
...
...
configure.ac
浏览文件 @
1ffb1ee0
...
...
@@ -1500,6 +1500,7 @@ AC_CONFIG_FILES([Makefile
src/mod/endpoints/mod_sofia/Makefile
src/mod/endpoints/mod_unicall/Makefile
src/mod/endpoints/mod_rtc/Makefile
src/mod/endpoints/mod_verto/Makefile
src/mod/event_handlers/mod_cdr_csv/Makefile
src/mod/event_handlers/mod_cdr_mongodb/Makefile
src/mod/event_handlers/mod_cdr_pg_csv/Makefile
...
...
src/mod/endpoints/mod_verto/Makefile.am
0 → 100644
浏览文件 @
1ffb1ee0
include
$(top_srcdir)/build/modmake.rulesam
MODNAME
=
mod_verto
mod_LTLIBRARIES
=
mod_verto.la
mod_verto_la_SOURCES
=
mod_verto.c ws.c mcast/mcast.c
mod_verto_la_CFLAGS
=
-D__EXTENSIONS__
-D_GNU_SOURCE
$(AM_CFLAGS)
mod_verto_la_CPPFLAGS
=
-I
.
-Imcast
mod_verto_la_LIBADD
=
$(switch_builddir)
/libfreeswitch.la
mod_verto_la_LDFLAGS
=
-avoid-version
-module
-no-undefined
-shared
if
HAVE_PERL
perldir
=
$(PERL_SITEDIR)
perl_LTLIBRARIES
=
MCAST.la
MCAST_la_SOURCES
=
mcast/mcast_wrap.cpp mcast/perlxsi.c mcast/mcast.c mcast/mcast_cpp.cpp
MCAST_la_CFLAGS
=
$(CC_CFLAGS)
$(CFLAGS)
$(SWITCH_AM_CFLAGS)
$(PERL_CFLAGS)
MCAST_la_CXXFLAGS
=
$(SWITCH_AM_CXXFLAGS)
$(CXXFLAGS)
-w
$(PERL_INC)
MCAST_la_CPPFLAGS
=
-I
$(switch_srcdir)
/src/mod/endpoints/mod_verto/mcast
MCAST_la_LDFLAGS
=
-avoid-version
-module
-no-undefined
-shared
$(PERL_LDFLAGS)
install-data-local
:
perlmod-install
perlmod-install
:
install-perlLTLIBRARIES
install
-m
755 MCAST.pm
$(PERL_SITEDIR)
endif
mcast/esl_wrap.cpp
:
cd
mcast
&&
swig
-module
MCAST
-shadow
-perl5
-c
++
-DMULTIPLICITY
-I
../src/include
-o
mcast_wrap.cpp ../MCAST.i
mcast/perlxsi.c
:
$(PERL)
-MExtUtils
::Embed
-e
xsinit
--
-o
perlxsi.c
clean-data-local
:
rm
-f
*
.o
*
.so
*
~
swigclean
:
rm
-f
mcast/mcast_wrap.
*
mcast/MCAST.so mcast/MCAST.pm mcast/perlxsi.
*
reswig
:
swigclean mcast/mcast_wrap.cpp mcast/perlxsi.c
src/mod/endpoints/mod_verto/mcast/.gitignore
0 → 100644
浏览文件 @
1ffb1ee0
*.o
*.so
src/mod/endpoints/mod_verto/mcast/MCAST.i
0 → 100644
浏览文件 @
1ffb1ee0
%{
#include "mcast.h"
#include "mcast_cpp.h"
%}
%newobject McastHANDLE::recv;
%include "mcast_cpp.h"
%perlcode %{
use constant {
MCAST_SEND => (1 << 0),
MCAST_RECV => (1 << 1),
MCAST_TTL_HOST => (1 << 2),
MCAST_TTL_SUBNET => (1 << 3),
MCAST_TTL_SITE => (1 << 4),
MCAST_TTL_REGION => (1 << 5),
MCAST_TTL_CONTINENT => (1 << 6),
MCAST_TTL_UNIVERSE => (1 << 7)
};
%}
src/mod/endpoints/mod_verto/mcast/MCAST.pm
0 → 100644
浏览文件 @
1ffb1ee0
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.35
#
# Don't modify this file, modify the SWIG interface instead.
package
MCAST
;
require
Exporter
;
require
DynaLoader
;
@ISA
=
qw(Exporter DynaLoader)
;
package
MCASTc
;
bootstrap
MCAST
;
package
MCAST
;
@EXPORT
=
qw( )
;
# ---------- BASE METHODS -------------
package
MCAST
;
sub
TIEHASH
{
my
(
$classname
,
$obj
)
=
@_
;
return
bless
$obj
,
$classname
;
}
sub
CLEAR
{
}
sub
FIRSTKEY
{
}
sub
NEXTKEY
{
}
sub
FETCH
{
my
(
$self
,
$field
)
=
@_
;
my
$member_func
=
"swig_${field}_get"
;
$self
->
$member_func
();
}
sub
STORE
{
my
(
$self
,
$field
,
$newval
)
=
@_
;
my
$member_func
=
"swig_${field}_set"
;
$self
->
$member_func
(
$newval
);
}
sub
this
{
my
$ptr
=
shift
;
return
tied
(
%
$ptr
);
}
# ------- FUNCTION WRAPPERS --------
package
MCAST
;
############# Class : MCAST::McastHandle ##############
package
MCAST::
McastHandle
;
use
vars
qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS)
;
@ISA
=
qw( MCAST )
;
%
OWNER
=
();
%
ITERATORS
=
();
sub
new
{
my
$pkg
=
shift
;
my
$self
=
MCASTc::
new_McastHandle
(
@_
);
bless
$self
,
$pkg
if
defined
(
$self
);
}
sub
DESTROY
{
return
unless
$_
[
0
]
->
isa
(
'HASH'
);
my
$self
=
tied
(
%
{
$_
[
0
]});
return
unless
defined
$self
;
delete
$ITERATORS
{
$self
};
if
(
exists
$OWNER
{
$self
})
{
MCASTc::
delete_McastHandle
(
$self
);
delete
$OWNER
{
$self
};
}
}
*
send
=
*
MCASTc::
McastHandle_send
;
*
recv
=
*
MCASTc::
McastHandle_recv
;
*
fileno
=
*
MCASTc::
McastHandle_fileno
;
sub
DISOWN
{
my
$self
=
shift
;
my
$ptr
=
tied
(
%
$self
);
delete
$OWNER
{
$ptr
};
}
sub
ACQUIRE
{
my
$self
=
shift
;
my
$ptr
=
tied
(
%
$self
);
$OWNER
{
$ptr
}
=
1
;
}
# ------- VARIABLE STUBS --------
package
MCAST
;
use
constant
{
MCAST_SEND
=>
(
1
<<
0
),
MCAST_RECV
=>
(
1
<<
1
),
MCAST_TTL_HOST
=>
(
1
<<
2
),
MCAST_TTL_SUBNET
=>
(
1
<<
3
),
MCAST_TTL_SITE
=>
(
1
<<
4
),
MCAST_TTL_REGION
=>
(
1
<<
5
),
MCAST_TTL_CONTINENT
=>
(
1
<<
6
),
MCAST_TTL_UNIVERSE
=>
(
1
<<
7
)
};
1
;
src/mod/endpoints/mod_verto/mcast/mcast.c
0 → 100644
浏览文件 @
1ffb1ee0
/*
* Copyright (c) 2011, Anthony Minessale II
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <time.h>
#include <unistd.h>
#include "mcast.h"
#include <poll.h>
int
mcast_socket_create
(
const
char
*
host
,
int16_t
port
,
mcast_handle_t
*
handle
,
mcast_flag_t
flags
)
{
uint32_t
one
=
1
;
memset
(
handle
,
0
,
sizeof
(
*
handle
));
if
((
!
(
flags
&
MCAST_SEND
)
&&
!
(
flags
&
MCAST_RECV
))
||
!
(
handle
->
sock
=
socket
(
AF_INET
,
SOCK_DGRAM
,
0
)))
{
return
-
1
;
}
handle
->
send_addr
.
sin_family
=
AF_INET
;
handle
->
send_addr
.
sin_addr
.
s_addr
=
inet_addr
(
host
);
handle
->
send_addr
.
sin_port
=
htons
(
port
);
setsockopt
(
handle
->
sock
,
SOL_SOCKET
,
SO_REUSEADDR
,
&
one
,
sizeof
(
one
));
if
((
flags
&
MCAST_RECV
))
{
struct
ip_mreq
mreq
;
handle
->
recv_addr
.
sin_family
=
AF_INET
;
handle
->
recv_addr
.
sin_addr
.
s_addr
=
htonl
(
INADDR_ANY
);
handle
->
recv_addr
.
sin_port
=
htons
(
port
);
mreq
.
imr_multiaddr
.
s_addr
=
inet_addr
(
host
);
mreq
.
imr_interface
.
s_addr
=
htonl
(
INADDR_ANY
);
if
(
setsockopt
(
handle
->
sock
,
IPPROTO_IP
,
IP_ADD_MEMBERSHIP
,
&
mreq
,
sizeof
(
mreq
))
<
0
)
{
close
(
handle
->
sock
);
handle
->
sock
=
-
1
;
return
-
1
;
}
if
(
bind
(
handle
->
sock
,
(
struct
sockaddr
*
)
&
handle
->
recv_addr
,
sizeof
(
handle
->
recv_addr
))
<
0
)
{
close
(
handle
->
sock
);
handle
->
sock
=
-
1
;
return
-
1
;
}
}
handle
->
ttl
=
1
;
if
((
flags
&
MCAST_TTL_HOST
))
{
handle
->
ttl
=
0
;
}
if
((
flags
&
MCAST_TTL_SUBNET
))
{
handle
->
ttl
=
1
;
}
if
((
flags
&
MCAST_TTL_SITE
))
{
handle
->
ttl
=
32
;
}
if
((
flags
&
MCAST_TTL_REGION
))
{
handle
->
ttl
=
64
;
}
if
((
flags
&
MCAST_TTL_CONTINENT
))
{
handle
->
ttl
=
128
;
}
if
((
flags
&
MCAST_TTL_UNIVERSE
))
{
handle
->
ttl
=
255
;
}
setsockopt
(
handle
->
sock
,
IPPROTO_IP
,
IP_MULTICAST_TTL
,
&
handle
->
ttl
,
sizeof
(
handle
->
ttl
));
handle
->
ready
=
1
;
return
0
;
}
void
mcast_socket_close
(
mcast_handle_t
*
handle
)
{
if
(
handle
->
sock
>
-
1
)
{
close
(
handle
->
sock
);
handle
->
sock
=
-
1
;
}
}
ssize_t
mcast_socket_send
(
mcast_handle_t
*
handle
,
void
*
data
,
size_t
datalen
)
{
if
(
handle
->
sock
<=
-
1
)
{
return
-
1
;
}
if
(
data
==
NULL
||
datalen
==
0
)
{
data
=
handle
->
buffer
;
datalen
=
sizeof
(
handle
->
buffer
);
}
return
sendto
(
handle
->
sock
,
data
,
datalen
,
0
,
(
struct
sockaddr
*
)
&
handle
->
send_addr
,
sizeof
(
handle
->
send_addr
));
}
ssize_t
mcast_socket_recv
(
mcast_handle_t
*
handle
,
void
*
data
,
size_t
datalen
,
int
ms
)
{
socklen_t
addrlen
=
sizeof
(
handle
->
recv_addr
);
int
r
;
if
(
data
==
NULL
||
datalen
==
0
)
{
data
=
handle
->
buffer
;
datalen
=
sizeof
(
handle
->
buffer
);
}
if
(
ms
>
0
)
{
struct
pollfd
pfds
[
1
];
pfds
[
0
].
fd
=
handle
->
sock
;
pfds
[
0
].
events
=
POLLIN
|
POLLERR
;
if
((
r
=
poll
(
pfds
,
1
,
ms
))
<=
0
)
{
return
r
;
}
if
(
pfds
[
0
].
revents
&
POLLERR
)
{
return
-
1
;
}
}
return
recvfrom
(
handle
->
sock
,
data
,
datalen
,
0
,
(
struct
sockaddr
*
)
&
handle
->
recv_addr
,
&
addrlen
);
}
src/mod/endpoints/mod_verto/mcast/mcast.h
0 → 100644
浏览文件 @
1ffb1ee0
/*
* Copyright (c) 2011, Anthony Minessale II
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __MCAST_H
#define __MCAST_H
#ifdef __cplusplus
extern
"C"
{
#endif
/* defined(__cplusplus) */
#if EMACS_WORKS
}
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
typedef
struct
{
int
sock
;
unsigned
char
ttl
;
struct
sockaddr_in
send_addr
;
struct
sockaddr_in
recv_addr
;
unsigned
char
buffer
[
65536
];
int
ready
;
}
mcast_handle_t
;
typedef
enum
{
MCAST_SEND
=
(
1
<<
0
),
MCAST_RECV
=
(
1
<<
1
),
MCAST_TTL_HOST
=
(
1
<<
2
),
MCAST_TTL_SUBNET
=
(
1
<<
3
),
MCAST_TTL_SITE
=
(
1
<<
4
),
MCAST_TTL_REGION
=
(
1
<<
5
),
MCAST_TTL_CONTINENT
=
(
1
<<
6
),
MCAST_TTL_UNIVERSE
=
(
1
<<
7
)
}
mcast_flag_t
;
int
mcast_socket_create
(
const
char
*
host
,
int16_t
port
,
mcast_handle_t
*
handle
,
mcast_flag_t
flags
);
void
mcast_socket_close
(
mcast_handle_t
*
handle
);
ssize_t
mcast_socket_send
(
mcast_handle_t
*
handle
,
void
*
data
,
size_t
datalen
);
ssize_t
mcast_socket_recv
(
mcast_handle_t
*
handle
,
void
*
data
,
size_t
datalen
,
int
ms
);
#ifdef __cplusplus
}
#endif
/* defined(__cplusplus) */
#endif
src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp
0 → 100644
浏览文件 @
1ffb1ee0
/*
* Copyright (c) 2011, Anthony Minessale II
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "mcast.h"
#include "mcast_cpp.h"
#include <string.h>
#include <poll.h>
McastHandle
::
McastHandle
(
const
char
*
host
,
int
port
,
int
flags
)
{
mcast_socket_create
(
host
,
port
,
&
handle
,
(
mcast_flag_t
)
flags
);
}
McastHandle
::~
McastHandle
()
{
mcast_socket_close
(
&
handle
);
}
int
McastHandle
::
send
(
const
char
*
data
)
{
return
(
int
)
mcast_socket_send
(
&
handle
,
(
void
*
)
data
,
strlen
(
data
)
+
1
);
}
char
*
McastHandle
::
recv
(
int
ms
)
{
int
r
;
if
((
r
=
mcast_socket_recv
(
&
handle
,
NULL
,
0
,
ms
))
>
0
)
{
*
((
char
*
)
handle
.
buffer
+
r
)
=
'\0'
;
return
(
char
*
)
handle
.
buffer
;
}
return
NULL
;
}
int
McastHandle
::
fileno
(
void
)
{
return
handle
.
sock
;
}
src/mod/endpoints/mod_verto/mcast/mcast_cpp.h
0 → 100644
浏览文件 @
1ffb1ee0
/*
* Copyright (c) 2011, Anthony Minessale II
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* * Neither the name of the original author; nor the names of any contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef __MCAST_CPP_H
#define __MCAST_CPP_H
#ifdef __cplusplus
extern
"C"
{
#endif
/* defined(__cplusplus) */
#if EMACS_WORKS
}
#endif
class
McastHandle
{
private
:
mcast_handle_t
handle
;
public
:
McastHandle
(
const
char
*
host
,
int
port
,
int
flags
);
virtual
~
McastHandle
();
int
send
(
const
char
*
data
);
char
*
recv
(
int
ms
=
0
);
int
fileno
(
void
);
};
#ifdef __cplusplus
}
#endif
/* defined(__cplusplus) */
#endif
src/mod/endpoints/mod_verto/mcast/mcast_wrap.cpp
0 → 100644
浏览文件 @
1ffb1ee0
差异被折叠。
点击展开。
src/mod/endpoints/mod_verto/mcast/perlxsi.c
0 → 100644
浏览文件 @
1ffb1ee0
#include <EXTERN.h>
#include <perl.h>
EXTERN_C
void
xs_init
(
pTHX
);
EXTERN_C
void
boot_DynaLoader
(
pTHX_
CV
*
cv
);
EXTERN_C
void
xs_init
(
pTHX
)
{
char
*
file
=
__FILE__
;
dXSUB_SYS
;
/* DynaLoader is a special case */
newXS
(
"DynaLoader::boot_DynaLoader"
,
boot_DynaLoader
,
file
);
}
src/mod/endpoints/mod_verto/mcast/test.c
0 → 100644
浏览文件 @
1ffb1ee0
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "mcast.h"
int
main
(
int
argc
,
char
*
argv
[])
{
mcast_handle_t
handle
;
if
(
argc
<
2
)
{
printf
(
"WTF
\n
"
);
exit
(
-
1
);
}
mcast_socket_create
(
"231.3.3.7"
,
1337
,
&
handle
,
MCAST_SEND
|
MCAST_RECV
|
MCAST_TTL_HOST
);
perror
(
"create"
);
if
(
!
strcmp
(
argv
[
1
],
"send"
))
{
mcast_socket_send
(
&
handle
,
argv
[
2
],
strlen
(
argv
[
2
]));
exit
(
0
);
}
for
(;;)
{
int
r
=
mcast_socket_recv
(
&
handle
,
NULL
,
0
);
printf
(
"RECV %d [%s]
\n
"
,
r
,
(
char
*
)
handle
.
buffer
);
}
}
src/mod/endpoints/mod_verto/mcast/test.pl
0 → 100644
浏览文件 @
1ffb1ee0
use
MCAST
;
my
$s
=
new
MCAST::
McastHandle
(
"231.3.3.7"
,
1337
,
MCAST_SEND
|
MCAST_RECV
|
MCAST_TTL_HOST
);
my
$action
=
shift
;
if
(
$action
eq
"send"
)
{
$s
->
send
(
"W00t from Perl "
.
shift
);
exit
;
}
for
(;;)
{
my
$foo
=
$s
->
recv
(
100
);
if
(
$foo
)
{
print
"RECV [$foo]\n"
;
}
else
{
print
"PING\n"
;
}
}
src/mod/endpoints/mod_verto/mcast/test2.pl
0 → 100644
浏览文件 @
1ffb1ee0
use
MCAST
;
my
$action
=
shift
;
if
(
$action
eq
"send"
)
{
my
$s
=
new
MCAST::
McastHandle
(
"224.1.1.1"
,
1337
,
MCAST::
MCAST_SEND
|
MCAST::
MCAST_TTL_HOST
);
$s
->
send
(
shift
);
print
"Sending message"
;
exit
;
}
my
$s
=
new
MCAST::
McastHandle
(
"224.1.1.1"
,
1338
,
MCAST::
MCAST_RECV
|
MCAST::
MCAST_TTL_HOST
);
for
(;;)
{
my
$foo
=
$s
->
recv
();
if
(
$foo
)
{
print
"RECV [$foo]\n"
;
}
else
{
print
"PING\n"
;
}
}
src/mod/endpoints/mod_verto/mod_verto.2008.vcproj
0 → 100644
浏览文件 @
1ffb1ee0
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType=
"Visual C++"
Version=
"9.00"
Name=
"mod_verto"
ProjectGUID=
"{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}"
RootNamespace=
"mod_verto"
Keyword=
"Win32Proj"
TargetFrameworkVersion=
"131072"
>
<Platforms>
<Platform
Name=
"Win32"
/>
<Platform
Name=
"x64"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name=
"Debug|Win32"
ConfigurationType=
"2"
InheritedPropertySheets=
"..\..\..\..\w32\module_debug.vsprops"
CharacterSet=
"2"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
UsePrecompiledHeader=
"0"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLinkerTool"
RandomizedBaseAddress=
"1"
DataExecutionPrevention=
"0"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCManifestTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCAppVerifierTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Debug|x64"
OutputDirectory=
"$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory=
"$(PlatformName)\$(ConfigurationName)"
ConfigurationType=
"2"
InheritedPropertySheets=
"..\..\..\..\w32\module_debug.vsprops"
CharacterSet=
"2"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
TargetEnvironment=
"3"
/>
<Tool
Name=
"VCCLCompilerTool"
UsePrecompiledHeader=
"0"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLinkerTool"
OutputFile=
"$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
RandomizedBaseAddress=
"1"
DataExecutionPrevention=
"0"
TargetMachine=
"17"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCManifestTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCAppVerifierTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Release|Win32"
ConfigurationType=
"2"
InheritedPropertySheets=
"..\..\..\..\w32\module_release.vsprops"
CharacterSet=
"2"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
/>
<Tool
Name=
"VCCLCompilerTool"
UsePrecompiledHeader=
"0"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLinkerTool"
RandomizedBaseAddress=
"1"
DataExecutionPrevention=
"0"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCManifestTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCAppVerifierTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name=
"Release|x64"
OutputDirectory=
"$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory=
"$(PlatformName)\$(ConfigurationName)"
ConfigurationType=
"2"
InheritedPropertySheets=
"..\..\..\..\w32\module_release.vsprops"
CharacterSet=
"2"
>
<Tool
Name=
"VCPreBuildEventTool"
/>
<Tool
Name=
"VCCustomBuildTool"
/>
<Tool
Name=
"VCXMLDataGeneratorTool"
/>
<Tool
Name=
"VCWebServiceProxyGeneratorTool"
/>
<Tool
Name=
"VCMIDLTool"
TargetEnvironment=
"3"
/>
<Tool
Name=
"VCCLCompilerTool"
UsePrecompiledHeader=
"0"
/>
<Tool
Name=
"VCManagedResourceCompilerTool"
/>
<Tool
Name=
"VCResourceCompilerTool"
/>
<Tool
Name=
"VCPreLinkEventTool"
/>
<Tool
Name=
"VCLinkerTool"
OutputFile=
"$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
RandomizedBaseAddress=
"1"
DataExecutionPrevention=
"0"
TargetMachine=
"17"
/>
<Tool
Name=
"VCALinkTool"
/>
<Tool
Name=
"VCManifestTool"
/>
<Tool
Name=
"VCXDCMakeTool"
/>
<Tool
Name=
"VCBscMakeTool"
/>
<Tool
Name=
"VCFxCopTool"
/>
<Tool
Name=
"VCAppVerifierTool"
/>
<Tool
Name=
"VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath=
".\mod_verto.c"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
src/mod/endpoints/mod_verto/mod_verto.2010.vcxproj
0 → 100644
浏览文件 @
1ffb1ee0
<?xml version="1.0" encoding="utf-8"?>
<Project
DefaultTargets=
"Build"
ToolsVersion=
"4.0"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<ItemGroup
Label=
"ProjectConfigurations"
>
<ProjectConfiguration
Include=
"Debug|Win32"
>
<Configuration>
Debug
</Configuration>
<Platform>
Win32
</Platform>
</ProjectConfiguration>
<ProjectConfiguration
Include=
"Debug|x64"
>
<Configuration>
Debug
</Configuration>
<Platform>
x64
</Platform>
</ProjectConfiguration>
<ProjectConfiguration
Include=
"Release|Win32"
>
<Configuration>
Release
</Configuration>
<Platform>
Win32
</Platform>
</ProjectConfiguration>
<ProjectConfiguration
Include=
"Release|x64"
>
<Configuration>
Release
</Configuration>
<Platform>
x64
</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup
Label=
"Globals"
>
<ProjectName>
mod_verto
</ProjectName>
<ProjectGuid>
{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}
</ProjectGuid>
<RootNamespace>
mod_verto
</RootNamespace>
<Keyword>
Win32Proj
</Keyword>
</PropertyGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.Default.props"
/>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
Label=
"Configuration"
>
<ConfigurationType>
DynamicLibrary
</ConfigurationType>
<CharacterSet>
MultiByte
</CharacterSet>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label=
"Configuration"
>
<ConfigurationType>
DynamicLibrary
</ConfigurationType>
<CharacterSet>
MultiByte
</CharacterSet>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
Label=
"Configuration"
>
<ConfigurationType>
DynamicLibrary
</ConfigurationType>
<CharacterSet>
MultiByte
</CharacterSet>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
Label=
"Configuration"
>
<ConfigurationType>
DynamicLibrary
</ConfigurationType>
<CharacterSet>
MultiByte
</CharacterSet>
</PropertyGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.props"
/>
<ImportGroup
Label=
"ExtensionSettings"
>
</ImportGroup>
<ImportGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
Label=
"PropertySheets"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
<Import
Project=
"..\..\..\..\w32\module_release.props"
/>
</ImportGroup>
<ImportGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label=
"PropertySheets"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
<Import
Project=
"..\..\..\..\w32\module_debug.props"
/>
</ImportGroup>
<ImportGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
Label=
"PropertySheets"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
<Import
Project=
"..\..\..\..\w32\module_release.props"
/>
</ImportGroup>
<ImportGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
Label=
"PropertySheets"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
<Import
Project=
"..\..\..\..\w32\module_debug.props"
/>
</ImportGroup>
<PropertyGroup
Label=
"UserMacros"
/>
<PropertyGroup>
<_ProjectFileVersion>
10.0.30319.1
</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>
false
</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
<Midl>
<TargetEnvironment>
X64
</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>
false
</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>
MachineX64
</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>
false
</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
<Midl>
<TargetEnvironment>
X64
</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>
false
</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>
MachineX64
</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile
Include=
"mod_verto.c"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\..\..\..\w32\Library\FreeSwitchCore.2010.vcxproj"
>
<Project>
{202d7a4e-760d-4d0e-afa1-d7459ced30ff}
</Project>
<ReferenceOutputAssembly>
false
</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
<ImportGroup
Label=
"ExtensionTargets"
>
</ImportGroup>
</Project>
src/mod/endpoints/mod_verto/mod_verto.2012.vcxproj
0 → 100644
浏览文件 @
1ffb1ee0
<?xml version="1.0" encoding="utf-8"?>
<Project
DefaultTargets=
"Build"
ToolsVersion=
"4.0"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<ItemGroup
Label=
"ProjectConfigurations"
>
<ProjectConfiguration
Include=
"Debug|Win32"
>
<Configuration>
Debug
</Configuration>
<Platform>
Win32
</Platform>
</ProjectConfiguration>
<ProjectConfiguration
Include=
"Debug|x64"
>
<Configuration>
Debug
</Configuration>
<Platform>
x64
</Platform>
</ProjectConfiguration>
<ProjectConfiguration
Include=
"Release|Win32"
>
<Configuration>
Release
</Configuration>
<Platform>
Win32
</Platform>
</ProjectConfiguration>
<ProjectConfiguration
Include=
"Release|x64"
>
<Configuration>
Release
</Configuration>
<Platform>
x64
</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup
Label=
"Globals"
>
<ProjectName>
mod_verto
</ProjectName>
<ProjectGuid>
{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}
</ProjectGuid>
<RootNamespace>
mod_verto
</RootNamespace>
<Keyword>
Win32Proj
</Keyword>
</PropertyGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.Default.props"
/>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
Label=
"Configuration"
>
<ConfigurationType>
DynamicLibrary
</ConfigurationType>
<CharacterSet>
MultiByte
</CharacterSet>
<PlatformToolset>
v110
</PlatformToolset>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label=
"Configuration"
>
<ConfigurationType>
DynamicLibrary
</ConfigurationType>
<CharacterSet>
MultiByte
</CharacterSet>
<PlatformToolset>
v110
</PlatformToolset>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
Label=
"Configuration"
>
<ConfigurationType>
DynamicLibrary
</ConfigurationType>
<CharacterSet>
MultiByte
</CharacterSet>
<PlatformToolset>
v110
</PlatformToolset>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
Label=
"Configuration"
>
<ConfigurationType>
DynamicLibrary
</ConfigurationType>
<CharacterSet>
MultiByte
</CharacterSet>
<PlatformToolset>
v110
</PlatformToolset>
</PropertyGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.props"
/>
<ImportGroup
Label=
"ExtensionSettings"
>
</ImportGroup>
<ImportGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
Label=
"PropertySheets"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
<Import
Project=
"..\..\..\..\w32\module_release.props"
/>
</ImportGroup>
<ImportGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label=
"PropertySheets"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
<Import
Project=
"..\..\..\..\w32\module_debug.props"
/>
</ImportGroup>
<ImportGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
Label=
"PropertySheets"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
<Import
Project=
"..\..\..\..\w32\module_release.props"
/>
</ImportGroup>
<ImportGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
Label=
"PropertySheets"
>
<Import
Project=
"$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props"
Condition=
"exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')"
Label=
"LocalAppDataPlatform"
/>
<Import
Project=
"..\..\..\..\w32\module_debug.props"
/>
</ImportGroup>
<PropertyGroup
Label=
"UserMacros"
/>
<PropertyGroup>
<_ProjectFileVersion>
10.0.30319.1
</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>
false
</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
<Midl>
<TargetEnvironment>
X64
</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>
false
</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>
MachineX64
</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>
false
</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
<Midl>
<TargetEnvironment>
X64
</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>
false
</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>
MachineX64
</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile
Include=
"mod_verto.c"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\..\..\..\w32\Library\FreeSwitchCore.2012.vcxproj"
>
<Project>
{202d7a4e-760d-4d0e-afa1-d7459ced30ff}
</Project>
<ReferenceOutputAssembly>
false
</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
<ImportGroup
Label=
"ExtensionTargets"
>
</ImportGroup>
</Project>
src/mod/endpoints/mod_verto/mod_verto.c
0 → 100644
浏览文件 @
1ffb1ee0
差异被折叠。
点击展开。
src/mod/endpoints/mod_verto/mod_verto.h
0 → 100644
浏览文件 @
1ffb1ee0
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2012, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* mod_html.h -- HTML 5 interface
*
*/
#ifndef MOD_VERTO_H
#define MOD_VERTO_H
#include <switch.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/wait.h>
#include <string.h>
#include <unistd.h>
#include <poll.h>
#include <stdarg.h>
#include <netinet/tcp.h>
#include <sys/un.h>
#include <assert.h>
#include <errno.h>
#include <pwd.h>
#include <netdb.h>
#include <openssl/ssl.h>
#include "mcast.h"
#define MAXPENDING 10000
#define STACK_SIZE 80 * 1024
#define VERTO_CHAT_PROTO "verto"
#define copy_string(x,y,z) strncpy(x, y, z - 1)
#define set_string(x,y) strncpy(x, y, sizeof(x)-1)
#define CODE_INVALID -32600
#define CODE_AUTH_REQUIRED -32000
#define CODE_AUTH_FAILED -32001
#define CODE_SESSION_ERROR -32002
typedef
enum
{
PTYPE_CLIENT
=
(
1
<<
0
),
PTYPE_CLIENT_SSL
=
(
1
<<
1
)
}
jsock_type_t
;
typedef
enum
{
JPFLAG_INIT
=
(
1
<<
0
),
JPFLAG_AUTHED
=
(
1
<<
1
),
JPFLAG_CHECK_ATTACH
=
(
1
<<
2
)
}
jpflag_t
;
struct
verto_profile_s
;
struct
jsock_s
{
int
client_socket
;
switch_memory_pool_t
*
pool
;
switch_thread_t
*
thread
;
wsh_t
ws
;
unsigned
char
buf
[
65535
];
char
*
name
;
jsock_type_t
ptype
;
struct
sockaddr_in
local_addr
;
struct
sockaddr_in
remote_addr
;
struct
sockaddr_in
send_addr
;
struct
ucred
credentials
;
struct
passwd
pw
;
int
drop
;
int
local_sock
;
SSL
*
ssl
;
jpflag_t
flags
;
char
uuid_str
[
SWITCH_UUID_FORMATTED_LENGTH
+
1
];
switch_event_t
*
allowed_methods
;
switch_event_t
*
allowed_jsapi
;
switch_event_t
*
allowed_fsapi
;
switch_event_t
*
allowed_event_channels
;
char
*
id
;
char
*
domain
;
char
*
uid
;
char
*
dialplan
;
char
*
context
;
struct
verto_profile_s
*
profile
;
switch_thread_rwlock_t
*
rwlock
;
switch_mutex_t
*
write_mutex
;
switch_event_t
*
params
;
switch_event_t
*
vars
;
struct
jsock_s
*
next
;
};
typedef
struct
jsock_s
jsock_t
;
#define MAX_BIND 25
#define MAX_RTPIP 25
struct
ips
{
char
local_ip
[
256
];
in_addr_t
local_ip_addr
;
int
local_port
;
int
secure
;
};
typedef
enum
{
TFLAG_SENT_MEDIA
=
(
1
<<
0
),
TFLAG_ATTACH_REQ
=
(
1
<<
1
)
}
tflag_t
;
typedef
struct
verto_pvt_s
{
char
*
jsock_uuid
;
char
*
call_id
;
char
*
r_sdp
;
tflag_t
flags
;
switch_core_session_t
*
session
;
switch_channel_t
*
channel
;
switch_media_handle_t
*
smh
;
switch_core_media_params_t
*
mparams
;
switch_call_cause_t
remote_hangup_cause
;
time_t
detach_time
;
struct
verto_pvt_s
*
next
;
}
verto_pvt_t
;
struct
verto_profile_s
{
char
*
name
;
switch_mutex_t
*
mutex
;
switch_memory_pool_t
*
pool
;
switch_thread_rwlock_t
*
rwlock
;
struct
ips
ip
[
MAX_BIND
];
int
i
;
const
SSL_METHOD
*
ssl_method
;
SSL_CTX
*
ssl_ctx
;
char
cert
[
512
];
char
key
[
512
];
char
chain
[
512
];
jsock_t
*
jsock_head
;
int
jsock_count
;
int
server_socket
[
MAX_BIND
];
int
running
;
int
ssl_ready
;
int
ready
;
int
debug
;
int
in_thread
;
char
*
userauth
;
char
*
root_passwd
;
char
*
context
;
char
*
dialplan
;
char
*
mcast_ip
;
switch_port_t
mcast_port
;
mcast_handle_t
mcast_sub
;
mcast_handle_t
mcast_pub
;
char
*
extrtpip
;
char
*
rtpip
[
MAX_RTPIP
];
int
rtpip_index
;
int
rtpip_cur
;
char
*
cand_acl
[
SWITCH_MAX_CAND_ACL
];
uint32_t
cand_acl_count
;
char
*
inbound_codec_string
;
char
*
outbound_codec_string
;
char
*
timer_name
;
char
*
local_network
;
struct
verto_profile_s
*
next
;
};
typedef
struct
verto_profile_s
verto_profile_t
;
struct
globals_s
{
switch_mutex_t
*
mutex
;
switch_memory_pool_t
*
pool
;
int
profile_count
;
verto_profile_t
*
profile_head
;
int
sig
;
int
running
;
switch_hash_t
*
method_hash
;
switch_mutex_t
*
method_mutex
;
switch_hash_t
*
event_channel_hash
;
switch_thread_rwlock_t
*
event_channel_rwlock
;
int
debug
;
int
ready
;
int
profile_threads
;
int
enable_presence
;
switch_hash_t
*
jsock_hash
;
switch_mutex_t
*
jsock_mutex
;
verto_pvt_t
*
tech_head
;
switch_thread_rwlock_t
*
tech_rwlock
;
switch_thread_cond_t
*
detach_cond
;
switch_mutex_t
*
detach_mutex
;
switch_mutex_t
*
detach2_mutex
;
uint32_t
detached
;
uint32_t
detach_timeout
;
switch_event_channel_id_t
event_channel_id
;
};
extern
struct
globals_s
globals
;
typedef
switch_bool_t
(
*
jrpc_func_t
)(
const
char
*
method
,
cJSON
*
params
,
jsock_t
*
jsock
,
cJSON
**
response
);
void
set_log_path
(
const
char
*
path
);
/** @} */
#endif
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4:
*/
src/mod/endpoints/mod_verto/ws.c
0 → 100644
浏览文件 @
1ffb1ee0
差异被折叠。
点击展开。
src/mod/endpoints/mod_verto/ws.h
0 → 100644
浏览文件 @
1ffb1ee0
#ifndef _WS_H
#define _WS_H
//#define WSS_STANDALONE 1
#define WEBSOCKET_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
#define B64BUFFLEN 1024
#include <sys/types.h>
#ifndef _MSC_VER
#include <arpa/inet.h>
#include <sys/wait.h>
#include <sys/socket.h>
#else
#pragma warning(disable:4996)
#endif
#include <string.h>
#include <unistd.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <errno.h>
//#include "sha1.h"
#include <openssl/ssl.h>
#ifdef _MSC_VER
#define strncasecmp _strnicmp
#define snprintf _snprintf
#ifdef _WIN64
#define WS_SSIZE_T __int64
#elif _MSC_VER >= 1400
#define WS_SSIZE_T __int32 __w64
#else
#define WS_SSIZE_T __int32
#endif
typedef
WS_SSIZE_T
ssize_t
;
#endif
struct
ws_globals_s
{
const
SSL_METHOD
*
ssl_method
;
SSL_CTX
*
ssl_ctx
;
char
cert
[
512
];
char
key
[
512
];
};
extern
struct
ws_globals_s
ws_globals
;
typedef
int
ws_socket_t
;
#define ws_sock_invalid -1
typedef
enum
{
WS_NONE
=
0
,
WS_NORMAL
=
1000
,
WS_PROTO_ERR
=
1002
,
WS_DATA_TOO_BIG
=
1009
}
ws_cause_t
;
typedef
enum
{
WSOC_CONTINUATION
=
0x0
,
WSOC_TEXT
=
0x1
,
WSOC_BINARY
=
0x2
,
WSOC_CLOSE
=
0x8
,
WSOC_PING
=
0x9
,
WSOC_PONG
=
0xA
}
ws_opcode_t
;
typedef
struct
wsh_s
{
ws_socket_t
sock
;
char
buffer
[
65536
];
char
wbuffer
[
65536
];
size_t
buflen
;
ssize_t
datalen
;
ssize_t
wdatalen
;
char
*
payload
;
ssize_t
plen
;
ssize_t
rplen
;
SSL
*
ssl
;
int
handshake
;
uint8_t
down
;
int
secure
;
uint8_t
close_sock
;
SSL_CTX
*
ssl_ctx
;
int
block
;
int
sanity
;
int
secure_established
;
int
logical_established
;
int
x
;
}
wsh_t
;
ssize_t
ws_send_buf
(
wsh_t
*
wsh
,
ws_opcode_t
oc
);
ssize_t
ws_feed_buf
(
wsh_t
*
wsh
,
void
*
data
,
size_t
bytes
);
ssize_t
ws_raw_read
(
wsh_t
*
wsh
,
void
*
data
,
size_t
bytes
,
int
block
);
ssize_t
ws_raw_write
(
wsh_t
*
wsh
,
void
*
data
,
size_t
bytes
);
ssize_t
ws_read_frame
(
wsh_t
*
wsh
,
ws_opcode_t
*
oc
,
uint8_t
**
data
);
ssize_t
ws_write_frame
(
wsh_t
*
wsh
,
ws_opcode_t
oc
,
void
*
data
,
size_t
bytes
);
int
ws_init
(
wsh_t
*
wsh
,
ws_socket_t
sock
,
SSL_CTX
*
ssl_ctx
,
int
close_sock
,
int
block
);
ssize_t
ws_close
(
wsh_t
*
wsh
,
int16_t
reason
);
void
ws_destroy
(
wsh_t
*
wsh
);
void
init_ssl
(
void
);
void
deinit_ssl
(
void
);
int
xp_errno
(
void
);
int
xp_is_blocking
(
int
errcode
);
#ifndef _MSC_VER
static
inline
uint64_t
get_unaligned_uint64
(
const
void
*
p
)
{
const
struct
{
uint64_t
d
;
}
__attribute__
((
packed
))
*
pp
=
p
;
return
pp
->
d
;
}
#endif
#endif
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论