/*
* ipq_main.c
* Copyright (C) 2009-2011 by ipoque GmbH
*
* This file is part of OpenDPI, an open source deep packet inspection
* library based on the PACE technology by ipoque GmbH
*
* OpenDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenDPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with OpenDPI. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ipq_main.h"
#include "ipq_protocols.h"
#include "ipq_utils.h"
u32 ipoque_detection_get_sizeof_ipoque_flow_struct(void)
{
return sizeof(struct ipoque_flow_struct);
}
u32 ipoque_detection_get_sizeof_ipoque_id_struct(void)
{
return sizeof(struct ipoque_id_struct);
}
struct ipoque_detection_module_struct *ipoque_init_detection_module(u32 ticks_per_second, void
*(*ipoque_malloc)
(unsigned
long size),
ipoque_debug_function_ptr ipoque_debug_printf)
{
struct ipoque_detection_module_struct *ipq_str;
ipq_str = ipoque_malloc(sizeof(struct ipoque_detection_module_struct));
if (ipq_str == NULL) {
ipoque_debug_printf(0, NULL, IPQ_LOG_DEBUG, "ipoque_init_detection_module initial malloc failed\n");
return NULL;
}
memset(ipq_str, 0, sizeof(struct ipoque_detection_module_struct));
IPOQUE_BITMASK_RESET(ipq_str->detection_bitmask);
#ifdef IPOQUE_ENABLE_DEBUG_MESSAGES
ipq_str->ipoque_debug_printf = ipoque_debug_printf;
ipq_str->user_data = NULL;
#endif
ipq_str->ticks_per_second = ticks_per_second;
ipq_str->tcp_max_retransmission_window_size = IPOQUE_DEFAULT_MAX_TCP_RETRANSMISSION_WINDOW_SIZE;
ipq_str->directconnect_connection_ip_tick_timeout =
IPOQUE_DIRECTCONNECT_CONNECTION_IP_TICK_TIMEOUT * ticks_per_second;
ipq_str->gadugadu_peer_connection_timeout = IPOQUE_GADGADU_PEER_CONNECTION_TIMEOUT * ticks_per_second;
ipq_str->edonkey_upper_ports_only = IPOQUE_EDONKEY_UPPER_PORTS_ONLY;
ipq_str->ftp_connection_timeout = IPOQUE_FTP_CONNECTION_TIMEOUT * ticks_per_second;
ipq_str->pplive_connection_timeout = IPOQUE_PPLIVE_CONNECTION_TIMEOUT * ticks_per_second;
ipq_str->rtsp_connection_timeout = IPOQUE_RTSP_CONNECTION_TIMEOUT * ticks_per_second;
ipq_str->tvants_connection_timeout = IPOQUE_TVANTS_CONNECTION_TIMEOUT * ticks_per_second;
ipq_str->irc_timeout = IPOQUE_IRC_CONNECTION_TIMEOUT * ticks_per_second;
ipq_str->gnutella_timeout = IPOQUE_GNUTELLA_CONNECTION_TIMEOUT * ticks_per_second;
ipq_str->battlefield_timeout = IPOQUE_BATTLEFIELD_CONNECTION_TIMEOUT * ticks_per_second;
ipq_str->thunder_timeout = IPOQUE_THUNDER_CONNECTION_TIMEOUT * ticks_per_second;
ipq_str->yahoo_detect_http_connections = IPOQUE_YAHOO_DETECT_HTTP_CONNECTIONS;
ipq_str->yahoo_lan_video_timeout = IPOQUE_YAHOO_LAN_VIDEO_TIMEOUT * ticks_per_second;
ipq_str->zattoo_connection_timeout = IPOQUE_ZATTOO_CONNECTION_TIMEOUT * ticks_per_second;
ipq_str->jabber_stun_timeout = IPOQUE_JABBER_STUN_TIMEOUT * ticks_per_second;
ipq_str->jabber_file_transfer_timeout = IPOQUE_JABBER_FT_TIMEOUT * ticks_per_second;
ipq_str->soulseek_connection_ip_tick_timeout = IPOQUE_SOULSEEK_CONNECTION_IP_TICK_TIMEOUT * ticks_per_second;
ipq_str->manolito_subscriber_timeout = IPOQUE_MANOLITO_SUBSCRIBER_TIMEOUT;
return ipq_str;
}
void ipoque_exit_detection_module(struct ipoque_detection_module_struct
*ipoque_struct, void (*ipoque_free) (void *ptr))
{
if (ipoque_struct != NULL) {
ipoque_free(ipoque_struct);
}
}
void ipoque_set_protocol_detection_bitmask2(struct ipoque_detection_module_struct
*ipoque_struct, const IPOQUE_PROTOCOL_BITMASK * dbm)
{
IPOQUE_PROTOCOL_BITMASK detection_bitmask_local;
IPOQUE_PROTOCOL_BITMASK *detection_bitmask = &detection_bitmask_local;
u32 a = 0;
IPOQUE_BITMASK_SET(detection_bitmask_local, *dbm);
IPOQUE_BITMASK_SET(ipoque_struct->detection_bitmask, *dbm);
/* set this here to zero to be interrupt safe */
ipoque_struct->callback_buffer_size = 0;
#ifdef IPOQUE_PROTOCOL_HTTP
#ifdef IPOQUE_PROTOCOL_MPEG
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_MPEG) != 0)
goto hack_do_http_detection;
#endif
#ifdef IPOQUE_PROTOCOL_FLASH
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_FLASH) != 0)
goto hack_do_http_detection;
#endif
#ifdef IPOQUE_PROTOCOL_QUICKTIME
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_QUICKTIME) != 0)
goto hack_do_http_detection;
#endif
#ifdef IPOQUE_PROTOCOL_REALMEDIA
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_REALMEDIA) != 0)
goto hack_do_http_detection;
#endif
#ifdef IPOQUE_PROTOCOL_WINDOWSMEDIA
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_WINDOWSMEDIA) != 0)
goto hack_do_http_detection;
#endif
#ifdef IPOQUE_PROTOCOL_MMS
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_MMS) != 0)
goto hack_do_http_detection;
#endif
#ifdef IPOQUE_PROTOCOL_OFF
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_OFF) != 0)
goto hack_do_http_detection;
#endif
#ifdef IPOQUE_PROTOCOL_XBOX
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_XBOX) != 0)
goto hack_do_http_detection;
#endif
#ifdef IPOQUE_PROTOCOL_QQ
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_QQ) != 0)
goto hack_do_http_detection;
#endif
#ifdef IPOQUE_PROTOCOL_AVI
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_AVI) != 0)
goto hack_do_http_detection;
#endif
#ifdef IPOQUE_PROTOCOL_OGG
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_OGG) != 0)
goto hack_do_http_detection;
#endif
#ifdef IPOQUE_PROTOCOL_MOVE
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_MOVE) != 0)
goto hack_do_http_detection;
#endif
#ifdef IPOQUE_PROTOCOL_RTSP
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_RTSP) != 0)
goto hack_do_http_detection;
#endif
/* HTTP DETECTION MUST BE BEFORE DDL BUT AFTER ALL OTHER PROTOCOLS WHICH USE HTTP ALSO */
if (IPOQUE_COMPARE_PROTOCOL_TO_BITMASK(*detection_bitmask, IPOQUE_PROTOCOL_HTTP) != 0) {
hack_do_http_detection:
ipoque_struct->callback_buffer[a].func = ipoque_search_http_tcp;
ipoque_struct->callback_buffer[a].ipq_selection_bitmask = IPQ_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD;
IPOQUE_SAVE_AS_BITMASK(ipoque_struct->callback_buffer[a].detection_bitmask, IPOQUE_PROTOCOL_UNKNOWN);
IPOQUE_ADD_PROTOCOL_TO_BITMASK(ipoque_struct->callback_buffer[a].detection_bitmask, IPOQUE_PROTOCOL_HTTP);
#ifdef IPOQUE_PROTOCOL_MPEG
IPOQUE_ADD_PROTOCOL_TO_BITMASK(ipoque_struct->callback_buffer[a].detection_bitmask, IPOQUE_PROTOCOL_MPEG);
#endif
#ifdef IPOQUE_PROTOCOL_FLASH
IPOQUE_ADD_PROTOCOL_TO_BITMASK(ipoque_struct->callback_buffer[a].detection_bitmask, IPOQUE_PROTOCOL_FLASH);
#endif
#ifdef IPOQUE_PROTOCOL_QUICKTIME
IPOQUE_ADD_PROTOCOL_TO_BITMASK(ipoque_struct->callback_buffer[a].detection_bitmask, IPOQUE_PROTOCOL_QUICKTIME);
#endif
#ifdef IPOQUE_PROTOCOL_REALMEDIA
IPOQUE_ADD_PROTOCOL_TO_BITMASK(ipoque_struct->callback_buffer[a].detection_bitmask, IPOQUE_PROTOCOL_REALMEDIA);
#endif
#ifdef IPOQUE_PROTOCOL_WINDOWSMEDIA
IPOQUE_ADD_PROTOCOL_TO_BITMASK(ipoque_struct->callback_buffer[a].detection_bitmask,
IPOQUE_PROTOCOL_WINDOWSMEDIA);
#endif
#ifdef IPOQUE_PROTOCOL_MMS
IPOQUE_ADD_PROTOCOL_TO_BITMASK(ipoque_struct->callback_buffer[a].detection_bitmask, IPOQUE_PROTOCOL_MMS);
#endif
#ifdef IPOQUE_PROTOCOL_OFF
IPOQUE_ADD_PROTOCOL_TO_BITMASK(ipoque_
没有合适的资源?快使用搜索试试~ 我知道了~
opendpi-1.3.0源代码
4星 · 超过85%的资源 需积分: 26 22 下载量 141 浏览量
2014-11-09
20:19:37
上传
评论
收藏 415KB GZ 举报
温馨提示
共143个文件
c:102个
h:13个
m4:6个
DPI技术,即DPI(Deep Packet Inspection)深度包检测技术是一种基于应用层的流量检测和控制技术,这个是当前最新的opendpi代码,目前opendpi已经无人维护了。
资源推荐
资源详情
资源评论
收起资源包目录
opendpi-1.3.0源代码 (143个子文件)
configure.ac 366B
Makefile.am 3KB
Makefile.am 223B
Makefile.am 200B
Makefile.am 80B
AUTHORS 0B
ipq_main.c 122KB
directdownloadlink.c 37KB
http.c 33KB
irc.c 33KB
pplive.c 23KB
qq.c 23KB
msn.c 22KB
gnutella.c 17KB
gadu_gadu.c 17KB
directconnect.c 17KB
yahoo.c 16KB
mail_imap.c 16KB
ftp.c 16KB
imesh.c 15KB
bittorrent.c 14KB
OpenDPI_demo.c 14KB
ssl.c 13KB
aimini.c 13KB
jabber.c 12KB
netbios.c 12KB
soulseek.c 11KB
oscar.c 11KB
rtp.c 11KB
zattoo.c 10KB
world_of_warcraft.c 9KB
sopcast.c 8KB
mail_pop.c 8KB
thunder.c 8KB
mail_smtp.c 8KB
tvuplayer.c 7KB
manolito.c 7KB
stun.c 7KB
meebo.c 6KB
edonkey.c 6KB
dofus.c 6KB
secondlife.c 6KB
sip.c 5KB
florensia.c 5KB
mdns.c 5KB
battlefield.c 5KB
veohtv.c 5KB
syslog.c 5KB
postgres.c 5KB
snmp.c 4KB
dns.c 4KB
shoutcast.c 4KB
ipp.c 4KB
rtsp.c 4KB
xbox.c 4KB
armagetron.c 4KB
ppstream.c 4KB
flash.c 4KB
maplestory.c 4KB
fiesta.c 4KB
feidian.c 4KB
non_tcp_udp.c 4KB
i23v5.c 3KB
quake.c 3KB
winmx.c 3KB
ldap.c 3KB
usenet.c 3KB
warcraft3.c 3KB
pando.c 3KB
iax.c 3KB
icecast.c 3KB
telnet.c 3KB
mgcp.c 3KB
popo.c 3KB
crossfire.c 3KB
fasttrack.c 3KB
filetopia.c 3KB
tvants.c 3KB
mms.c 3KB
socrates.c 3KB
tds.c 3KB
afp.c 3KB
guildwars.c 3KB
nfs.c 3KB
kerberos.c 3KB
xdmcp.c 3KB
mysql.c 2KB
tftp.c 2KB
halflife2_and_mods.c 2KB
kontiki.c 2KB
steam.c 2KB
ssh.c 2KB
world_of_kung_fu.c 2KB
vnc.c 2KB
ntp.c 2KB
pptp.c 2KB
dhcp.c 2KB
ssdp.c 2KB
applejuice.c 2KB
openft.c 2KB
共 143 条
- 1
- 2
资源评论
- ligaolei22015-03-22可以试一下 应该去问题
- newking952016-06-16运行不出来,不知道哪儿出错了
- hg_zhoujj2019-05-31可以试一下
Crombe
- 粉丝: 32
- 资源: 22
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功