Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
e73424f3
提交
e73424f3
authored
5月 20, 2007
作者:
Michael Jerris
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
tweak types
git-svn-id:
http://svn.openzap.org/svn/openzap/trunk@53
a93c3328-9c30-0410-af19-c9cd2b2d52af
上级
8f340bf0
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
146 行增加
和
146 行删除
+146
-146
sangoma_tdm_api.h
libs/openzap/src/include/sangoma_tdm_api.h
+146
-146
没有找到文件。
libs/openzap/src/include/sangoma_tdm_api.h
浏览文件 @
e73424f3
...
@@ -33,34 +33,34 @@
...
@@ -33,34 +33,34 @@
/* sang_api.h(74) : warning C4201: nonstandard extension used : nameless struct/union */
/* sang_api.h(74) : warning C4201: nonstandard extension used : nameless struct/union */
/* wanpipe_defines.h(219) : warning C4214: nonstandard extension used : bit field types other than int */
/* wanpipe_defines.h(219) : warning C4214: nonstandard extension used : bit field types other than int */
/* wanpipe_defines.h(220) : warning C4214: nonstandard extension used : bit field types other than int */
/* wanpipe_defines.h(220) : warning C4214: nonstandard extension used : bit field types other than int */
/* this will break for any compilers that are strict ansi or strict c99 */
/* this will break for any compilers that are strict ansi or strict c99 */
/* The following definition for that struct should resolve this warning and work for 32 and 64 bit */
/* The following definition for that struct should resolve this warning and work for 32 and 64 bit */
#if 0
#if 0
struct iphdr {
struct iphdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
#if defined(__LITTLE_ENDIAN_BITFIELD)
unsigned ihl:4,
unsigned ihl:4,
version:4;
version:4;
#elif defined (__BIG_ENDIAN_BITFIELD)
#elif defined (__BIG_ENDIAN_BITFIELD)
unsigned version:4,
unsigned version:4,
ihl:4;
ihl:4;
#else
#else
# error "unknown byteorder!"
# error "unknown byteorder!"
#endif
#endif
unsigned
tos
:
8
;
unsigned
tos
:
8
;
unsigned
tot_len
:
16
;
unsigned
tot_len
:
16
;
unsigned
id
:
16
;
unsigned
id
:
16
;
unsigned
frag_off
:
16
;
unsigned
frag_off
:
16
;
__u8
ttl
;
__u8
ttl
;
__u8
protocol
;
__u8
protocol
;
__u16
check
;
__u16
check
;
__u32
saddr
;
__u32
saddr
;
__u32
daddr
;
__u32
daddr
;
/*The options start here. */
/*The options start here. */
};
};
#endif
/* #if 0 */
#endif
/* #if 0 */
#define __inline__ __inline
#define __inline__ __inline
...
@@ -90,7 +90,7 @@ struct iphdr {
...
@@ -90,7 +90,7 @@ struct iphdr {
/* what should the returns from this function be?? */
/* what should the returns from this function be?? */
/* I dont think they are currently consistant between windows and *nix */
/* I dont think they are currently consistant between windows and *nix */
#ifdef __WINDOWS__
#ifdef __WINDOWS__
static
__inline__
int
tdmv_api_ioctl
(
sng_fd_t
fd
,
wanpipe_tdm_api_
cmd_
t
*
tdm_api_cmd
)
static
__inline__
int
tdmv_api_ioctl
(
sng_fd_t
fd
,
wanpipe_tdm_api_t
*
tdm_api_cmd
)
{
{
/* can we make the structure passed for this on nix and windows the same */
/* can we make the structure passed for this on nix and windows the same */
/* so we don't have to do the extra 2 memcpy's on windows for this ? */
/* so we don't have to do the extra 2 memcpy's on windows for this ? */
...
@@ -129,7 +129,7 @@ static __inline__ int tdmv_api_ioctl(sng_fd_t fd, wanpipe_tdm_api_cmd_t *tdm_api
...
@@ -129,7 +129,7 @@ static __inline__ int tdmv_api_ioctl(sng_fd_t fd, wanpipe_tdm_api_cmd_t *tdm_api
}
}
#else
#else
static
__inline__
int
tdmv_api_ioctl
(
sng_fd_t
fd
,
wanpipe_tdm_api_
cmd_
t
*
tdm_api_cmd
)
static
__inline__
int
tdmv_api_ioctl
(
sng_fd_t
fd
,
wanpipe_tdm_api_t
*
tdm_api_cmd
)
{
{
return
ioctl
(
fd
,
SIOC_WANPIPE_TDM_API
,
tdm_api_cmd
);
return
ioctl
(
fd
,
SIOC_WANPIPE_TDM_API
,
tdm_api_cmd
);
}
}
...
@@ -291,22 +291,22 @@ static __inline__ int tdmv_api_wait_socket(sng_fd_t fd, int timeout, int flags)
...
@@ -291,22 +291,22 @@ static __inline__ int tdmv_api_wait_socket(sng_fd_t fd, int timeout, int flags)
/* we need some what to select if we are reading regular tdm msgs or events */
/* we need some what to select if we are reading regular tdm msgs or events */
/* need to either have 2 functions, 1 for events, 1 for regural read, or a flag on this function to choose */
/* need to either have 2 functions, 1 for events, 1 for regural read, or a flag on this function to choose */
/* 2 functions preferred. Need implementation for the event function for both nix and windows that is threadsafe */
/* 2 functions preferred. Need implementation for the event function for both nix and windows that is threadsafe */
static
__inline__
int
tdmv_api_readmsg_tdm
(
sng_fd_t
fd
,
void
*
hdrbuf
,
int
hdrlen
,
void
*
databuf
,
int
datalen
)
static
__inline__
int
tdmv_api_readmsg_tdm
(
sng_fd_t
fd
,
void
*
hdrbuf
,
int
hdrlen
,
void
*
databuf
,
int
datalen
)
{
{
/* What do we need to do here to avoid having to do all */
/* What do we need to do here to avoid having to do all */
/* the memcpy's on windows and still maintain api compat with nix */
/* the memcpy's on windows and still maintain api compat with nix */
int
rx_len
=
0
;
int
rx_len
=
0
;
#if defined(__WINDOWS__)
#if defined(__WINDOWS__)
static
RX_DATA_STRUCT
rx_data
;
static
RX_DATA_STRUCT
rx_data
;
api_header_t
*
pri
;
api_header_t
*
pri
;
wp_tdm_api_rx_hdr_t
*
tdm_api_rx_hdr
;
wp_tdm_api_rx_hdr_t
*
tdm_api_rx_hdr
;
wp_tdm_api_rx_hdr_t
*
user_buf
=
(
wp_tdm_api_rx_hdr_t
*
)
hdrbuf
;
wp_tdm_api_rx_hdr_t
*
user_buf
=
(
wp_tdm_api_rx_hdr_t
*
)
hdrbuf
;
DWORD
ln
;
DWORD
ln
;
if
(
hdrlen
!=
sizeof
(
wp_tdm_api_rx_hdr_t
)){
if
(
hdrlen
!=
sizeof
(
wp_tdm_api_rx_hdr_t
)){
return
-
1
;
return
-
1
;
}
}
if
(
!
DeviceIoControl
(
if
(
!
DeviceIoControl
(
fd
,
fd
,
IoctlReadCommand
,
IoctlReadCommand
,
...
@@ -316,111 +316,111 @@ static __inline__ int tdmv_api_readmsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen
...
@@ -316,111 +316,111 @@ static __inline__ int tdmv_api_readmsg_tdm(sng_fd_t fd, void *hdrbuf, int hdrlen
sizeof
(
RX_DATA_STRUCT
),
sizeof
(
RX_DATA_STRUCT
),
(
LPDWORD
)(
&
ln
),
(
LPDWORD
)(
&
ln
),
(
LPOVERLAPPED
)
NULL
(
LPOVERLAPPED
)
NULL
)){
)){
return
-
1
;
return
-
1
;
}
}
pri
=
&
rx_data
.
api_header
;
pri
=
&
rx_data
.
api_header
;
tdm_api_rx_hdr
=
(
wp_tdm_api_rx_hdr_t
*
)
rx_data
.
data
;
tdm_api_rx_hdr
=
(
wp_tdm_api_rx_hdr_t
*
)
rx_data
.
data
;
user_buf
->
wp_tdm_api_event_type
=
pri
->
operation_status
;
user_buf
->
wp_tdm_api_event_type
=
pri
->
operation_status
;
switch
(
pri
->
operation_status
)
switch
(
pri
->
operation_status
)
{
{
case
SANG_STATUS_RX_DATA_AVAILABLE
:
case
SANG_STATUS_RX_DATA_AVAILABLE
:
if
(
pri
->
data_length
>
datalen
){
if
(
pri
->
data_length
>
datalen
){
break
;
break
;
}
}
memcpy
(
databuf
,
rx_data
.
data
,
pri
->
data_length
);
memcpy
(
databuf
,
rx_data
.
data
,
pri
->
data_length
);
rx_len
=
pri
->
data_length
;
rx_len
=
pri
->
data_length
;
break
;
break
;
default:
default:
break
;
break
;
}
}
#else
#else
struct
msghdr
msg
;
struct
msghdr
msg
;
struct
iovec
iov
[
2
];
struct
iovec
iov
[
2
];
memset
(
&
msg
,
0
,
sizeof
(
struct
msghdr
));
memset
(
&
msg
,
0
,
sizeof
(
struct
msghdr
));
iov
[
0
].
iov_len
=
hdrlen
;
iov
[
0
].
iov_len
=
hdrlen
;
iov
[
0
].
iov_base
=
hdrbuf
;
iov
[
0
].
iov_base
=
hdrbuf
;
iov
[
1
].
iov_len
=
datalen
;
iov
[
1
].
iov_len
=
datalen
;
iov
[
1
].
iov_base
=
databuf
;
iov
[
1
].
iov_base
=
databuf
;
msg
.
msg_iovlen
=
2
;
msg
.
msg_iovlen
=
2
;
msg
.
msg_iov
=
iov
;
msg
.
msg_iov
=
iov
;
rx_len
=
read
(
fd
,
&
msg
,
datalen
+
hdrlen
);
rx_len
=
read
(
fd
,
&
msg
,
datalen
+
hdrlen
);
if
(
rx_len
<=
sizeof
(
wp_tdm_api_rx_hdr_t
)){
if
(
rx_len
<=
sizeof
(
wp_tdm_api_rx_hdr_t
)){
return
-
EINVAL
;
return
-
EINVAL
;
}
}
rx_len
-=
sizeof
(
wp_tdm_api_rx_hdr_t
);
rx_len
-=
sizeof
(
wp_tdm_api_rx_hdr_t
);
#endif
#endif
return
rx_len
;
return
rx_len
;
}
}
static
__inline__
int
tdmv_api_writemsg_tdm
(
sng_fd_t
fd
,
void
*
hdrbuf
,
int
hdrlen
,
void
*
databuf
,
unsigned
short
datalen
)
static
__inline__
int
tdmv_api_writemsg_tdm
(
sng_fd_t
fd
,
void
*
hdrbuf
,
int
hdrlen
,
void
*
databuf
,
unsigned
short
datalen
)
{
{
/* What do we need to do here to avoid having to do all */
/* What do we need to do here to avoid having to do all */
/* the memcpy's on windows and still maintain api compat with nix */
/* the memcpy's on windows and still maintain api compat with nix */
int
bsent
=
0
;
int
bsent
=
0
;
#if defined(__WINDOWS__)
#if defined(__WINDOWS__)
static
TX_DATA_STRUCT
local_tx_data
;
static
TX_DATA_STRUCT
local_tx_data
;
api_header_t
*
pri
;
api_header_t
*
pri
;
DWORD
ln
;
DWORD
ln
;
/* Are these really not needed or used??? What about for nix?? */
/* Are these really not needed or used??? What about for nix?? */
(
void
)
hdrbuf
;
(
void
)
hdrbuf
;
(
void
)
hdrlen
;
(
void
)
hdrlen
;
pri
=
&
local_tx_data
.
api_header
;
pri
=
&
local_tx_data
.
api_header
;
pri
->
data_length
=
datalen
;
pri
->
data_length
=
datalen
;
memcpy
(
local_tx_data
.
data
,
databuf
,
pri
->
data_length
);
memcpy
(
local_tx_data
.
data
,
databuf
,
pri
->
data_length
);
if
(
!
DeviceIoControl
(
if
(
!
DeviceIoControl
(
fd
,
fd
,
IoctlWriteCommand
,
IoctlWriteCommand
,
(
LPVOID
)
&
local_tx_data
,
(
LPVOID
)
&
local_tx_data
,
(
ULONG
)
sizeof
(
TX_DATA_STRUCT
),
(
ULONG
)
sizeof
(
TX_DATA_STRUCT
),
(
LPVOID
)
&
local_tx_data
,
(
LPVOID
)
&
local_tx_data
,
sizeof
(
TX_DATA_STRUCT
),
sizeof
(
TX_DATA_STRUCT
),
(
LPDWORD
)(
&
ln
),
(
LPDWORD
)(
&
ln
),
(
LPOVERLAPPED
)
NULL
(
LPOVERLAPPED
)
NULL
)){
)){
return
-
1
;
return
-
1
;
}
}
if
(
local_tx_data
.
api_header
.
operation_status
==
SANG_STATUS_SUCCESS
)
{
if
(
local_tx_data
.
api_header
.
operation_status
==
SANG_STATUS_SUCCESS
)
{
bsent
=
datalen
;
bsent
=
datalen
;
}
}
#else
#else
struct
msghdr
msg
;
struct
msghdr
msg
;
struct
iovec
iov
[
2
];
struct
iovec
iov
[
2
];
memset
(
&
msg
,
0
,
sizeof
(
struct
msghdr
));
memset
(
&
msg
,
0
,
sizeof
(
struct
msghdr
));
iov
[
0
].
iov_len
=
hdrlen
;
iov
[
0
].
iov_len
=
hdrlen
;
iov
[
0
].
iov_base
=
hdrbuf
;
iov
[
0
].
iov_base
=
hdrbuf
;
iov
[
1
].
iov_len
=
datalen
;
iov
[
1
].
iov_len
=
datalen
;
iov
[
1
].
iov_base
=
databuf
;
iov
[
1
].
iov_base
=
databuf
;
msg
.
msg_iovlen
=
2
;
msg
.
msg_iovlen
=
2
;
msg
.
msg_iov
=
iov
;
msg
.
msg_iov
=
iov
;
bsent
=
write
(
fd
,
&
msg
,
datalen
+
hdrlen
);
bsent
=
write
(
fd
,
&
msg
,
datalen
+
hdrlen
);
if
(
bsent
>
0
){
if
(
bsent
>
0
){
bsent
-=
sizeof
(
wp_tdm_api_tx_hdr_t
);
bsent
-=
sizeof
(
wp_tdm_api_tx_hdr_t
);
}
}
#endif
#endif
return
bsent
;
return
bsent
;
}
}
#endif
/* _SANGOMA_TDM_API_H */
#endif
/* _SANGOMA_TDM_API_H */
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论