Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Achou.Wang
4Gsim
提交
31c13b8d
4
4Gsim
项目概览
Achou.Wang
/
4Gsim
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
4
4Gsim
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
31c13b8d
编写于
7月 09, 2012
作者:
C
calincerchez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dctdump ready without comment
上级
470d683a
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
108 addition
and
88 deletion
+108
-88
examples/diameter/hss.pcap
examples/diameter/hss.pcap
+0
-0
examples/diameter/mme.pcap
examples/diameter/mme.pcap
+0
-0
examples/diameter/results/General-0.sca
examples/diameter/results/General-0.sca
+3
-3
examples/diameter/results/General-0.vci
examples/diameter/results/General-0.vci
+4
-4
examples/diameter/results/General-0.vec
examples/diameter/results/General-0.vec
+3
-3
src/util/DCTDump.cc
src/util/DCTDump.cc
+60
-59
src/util/DCTDump.h
src/util/DCTDump.h
+38
-19
未找到文件。
examples/diameter/hss.pcap
浏览文件 @
31c13b8d
无法预览此类型文件
examples/diameter/mme.pcap
浏览文件 @
31c13b8d
无法预览此类型文件
examples/diameter/results/General-0.sca
浏览文件 @
31c13b8d
version 2
run General-0-2012070
6-18:17:56-5680
run General-0-2012070
9-12:08:18-5632
attr configname General
attr datetime 2012070
6-18:17:56
attr datetime 2012070
9-12:08:18
attr experiment General
attr inifile omnetpp.ini
attr iterationvars ""
attr iterationvars2 $repetition=0
attr measurement ""
attr network Test
attr processid 56
80
attr processid 56
32
attr repetition 0
attr replication #0
attr resultdir results
...
...
examples/diameter/results/General-0.vci
浏览文件 @
31c13b8d
file 13724 1341
587879
file 13724 1341
824901
version 2
run General-0-2012070
6-18:17:56-5680
run General-0-2012070
9-12:08:18-5632
attr configname General
attr datetime 2012070
6-18:17:56
attr datetime 2012070
9-12:08:18
attr experiment General
attr inifile omnetpp.ini
attr iterationvars ""
attr iterationvars2 $repetition=0
attr measurement ""
attr network Test
attr processid 56
80
attr processid 56
32
attr repetition 0
attr replication #0
attr resultdir results
...
...
examples/diameter/results/General-0.vec
浏览文件 @
31c13b8d
version 2
run General-0-2012070
6-18:17:56-5680
run General-0-2012070
9-12:08:18-5632
attr configname General
attr datetime 2012070
6-18:17:56
attr datetime 2012070
9-12:08:18
attr experiment General
attr inifile omnetpp.ini
attr iterationvars ""
attr iterationvars2 $repetition=0
attr measurement ""
attr network Test
attr processid 56
80
attr processid 56
32
attr repetition 0
attr replication #0
attr resultdir results
...
...
src/util/DCTDump.cc
浏览文件 @
31c13b8d
...
...
@@ -16,11 +16,12 @@
//
#include "DCTDump.h"
#include "IPSerializer.h"
#define MAXBUFLENGTH 65536
#define MAXDCTLENGTH 100
Define_Module
(
DCTDump
)
Define_Module
(
DCTDump
)
;
DCTDump
::
DCTDump
()
{
// TODO Auto-generated constructor stub
...
...
@@ -32,15 +33,9 @@ DCTDump::~DCTDump() {
}
void
DCTDump
::
initialize
()
{
const
char
*
file
=
this
->
par
(
"dumpFile"
);
char
begin_hdr
[]
=
{
0x53
,
0x65
,
0x73
,
0x73
,
0x69
,
0x6F
,
0x6E
,
0x20
,
0x54
,
0x72
,
0x61
,
0x6E
,
0x73
,
0x63
,
0x72
,
0x69
,
0x70
,
0x74
,
0x20
,
0x28
,
0x66
,
0x6F
,
0x72
,
0x6D
,
0x61
,
0x74
,
0x20
,
0x33
,
0x2E
,
0x31
,
0x2C
,
0x20
,
0x72
,
0x65
,
0x6C
,
0x65
,
0x61
,
0x73
,
0x65
,
0x20
,
0x31
,
0x30
,
0x2E
,
0x36
,
0x20
,
0x6F
,
0x6E
,
0x20
,
0x75
,
0x6B
,
0x65
,
0x6E
,
0x67
,
0x37
,
0x2C
,
0x20
,
0x4C
,
0x69
,
0x6E
,
0x75
,
0x78
,
0x20
,
0x32
,
0x2E
,
0x36
,
0x2E
,
0x38
,
0x2D
,
0x32
,
0x34
,
0x2D
,
0x73
,
0x6D
,
0x70
,
0x20
,
0x69
,
0x36
,
0x38
,
0x36
,
0x29
,
0x0A
,
0x46
,
0x65
,
0x62
,
0x72
,
0x75
,
0x61
,
0x72
,
0x79
,
0x20
,
0x32
,
0x31
,
0x2C
,
0x20
,
0x32
,
0x30
,
0x30
,
0x36
,
0x20
,
0x20
,
0x20
,
0x20
,
0x20
,
0x31
,
0x36
,
0x3A
,
0x34
,
0x35
,
0x3A
,
0x32
,
0x30
,
0x2E
,
0x35
,
0x31
,
0x38
,
0x35
,
0x0A
};
const
char
*
file
=
this
->
par
(
"dumpFile"
);
const
char
*
first_line
=
"Session Transcript
\n
"
;
const
char
*
second_line
=
"February 21, 2006 16:45:20.5186
\n
"
;
if
(
strcmp
(
file
,
""
)
!=
0
)
{
tcpdump
.
dumpfile
=
fopen
(
file
,
"wb"
);
...
...
@@ -50,7 +45,8 @@ void DCTDump::initialize() {
exit
(
-
1
);
}
fwrite
(
&
begin_hdr
,
sizeof
(
begin_hdr
),
1
,
tcpdump
.
dumpfile
);
fwrite
(
first_line
,
19
,
1
,
tcpdump
.
dumpfile
);
fwrite
(
second_line
,
36
,
1
,
tcpdump
.
dumpfile
);
}
else
tcpdump
.
dumpfile
=
NULL
;
...
...
@@ -64,67 +60,62 @@ void DCTDump::handleMessage(cMessage *msg) {
std
::
stringstream
vers
;
const
char
*
time
=
timestamp
(
stime
);
uint8
buf
[
MAXBUFLENGTH
];
int32
buf_len
=
0
;
std
::
string
ascii_buf
;
char
dh
[
MAXDCTLENGTH
];
struct
pcaprec_hdr
ph
;
char
*
p
=
dh
;
// Write pcap header
ph
.
ts_sec
=
(
int32
)
stime
.
dbl
();
ph
.
ts_usec
=
(
uint32
)((
stime
.
dbl
()
-
ph
.
ts_sec
)
*
1000000
);
// Write dump
memset
((
void
*
)
&
buf
,
0
,
sizeof
(
buf
));
// Write dct2000 header
memset
((
void
*
)
&
dh
,
0
,
sizeof
(
dh
));
// context
// context
name
IPDatagram
*
ipPacket
=
dynamic_cast
<
IPDatagram
*>
(
msg
);
if
(
ipPacket
)
{
if
(
ipPacket
->
getTransportProtocol
()
==
IP_PROT_SCTP
)
{
strncpy
(
p
,
"SCTP
"
,
4
);
strncpy
(
p
,
"SCTP
."
,
5
);
p
+=
5
;
}
write
=
true
;
}
// context port number
*
p
=
1
;
p
++
;
buf_len
=
IPSerializer
().
serialize
(
ipPacket
,
buf
,
sizeof
(
buf
));
}
//
timestamp
strncpy
(
p
,
time
,
strlen
(
time
)
);
p
+=
strlen
(
time
)
+
1
;
//
context port number - always 1
strncpy
(
p
,
"1/"
,
5
);
p
+=
2
;
// protocol
if
(
ipPacket
)
{
vers
<<
ipPacket
->
getVersion
();
// protocol name
strncpy
(
p
,
"ip
"
,
2
);
strncpy
(
p
,
"ip
/"
,
3
);
p
+=
3
;
//protocol version
strncpy
(
p
,
vers
.
str
().
c_str
(),
strlen
(
vers
.
str
().
c_str
()));
p
+=
strlen
(
vers
.
str
().
c_str
())
+
1
;
}
// direction
if
(
msg
->
getArrivalGate
()
->
isName
(
"ifIn"
))
*
p
=
RECEIVED
;
else
*
p
=
SENT
;
p
++
;
// encapsulation
if
(
ipPacket
)
{
*
p
=
RAW_IP
;
p
+=
strlen
(
vers
.
str
().
c_str
());
*
p
=
'/'
;
p
++
;
}
memset
((
void
*
)
&
buf
,
0
,
sizeof
(
buf
));
// direction
if
(
msg
->
getArrivalGate
()
->
isName
(
"ifIn"
))
{
strncpy
(
p
,
" r"
,
2
);
}
else
strncpy
(
p
,
" s"
,
2
);
p
+=
2
;
ph
.
incl_len
=
p
-
dh
;
ph
.
orig_len
=
ph
.
incl_len
;
// timestamp
strncpy
(
p
,
" tm "
,
4
);
p
+=
4
;
strncpy
(
p
,
time
,
strlen
(
time
));
p
+=
strlen
(
time
);
//fwrite(&ph, sizeof(ph), 1, tcpdump.dumpfile);
if
(
write
)
{
fwrite
(
&
dh
,
p
-
dh
,
1
,
tcpdump
.
dumpfile
);
dumpPacket
(
buf
,
buf_len
);
}
}
// forward
...
...
@@ -146,18 +137,28 @@ const char *DCTDump::timestamp(simtime_t stime) {
return
out
.
str
().
c_str
();
}
void
DCTDump
::
finish
()
{
void
DCTDump
::
finish
()
{
if
(
strcmp
(
this
->
par
(
"dumpFile"
),
""
)
!=
0
)
{
char
end_hdr
[]
=
{
0x0A
,
0x41
,
0x2E
,
0x31
,
0x2F
,
0x70
,
0x70
,
0x70
,
0x2F
,
0x31
,
0x2F
,
0x2F
,
0x2F
,
0x20
,
0x73
,
0x20
,
0x74
,
0x6D
,
0x20
,
0x32
,
0x30
,
0x2E
,
0x31
,
0x34
,
0x31
,
0x31
,
0x20
,
0x6C
,
0x20
,
0x24
,
0x66
,
0x66
,
0x30
,
};
fwrite
(
&
end_hdr
,
sizeof
(
end_hdr
),
1
,
tcpdump
.
dumpfile
);
fclose
(
tcpdump
.
dumpfile
);
}
}
void
DCTDump
::
dumpPacket
(
uint8
*
buf
,
int32
len
)
{
if
(
len
>
0
)
{
std
::
string
dump
=
" $3119022cba260012d8828128"
;
// int32 j = 0;
// for (int32 i = 0; i < len * 2; i++) {
// if (((buf[j]) >> (4 * ((i + 1) % 2)) & 0x0f) < 10)
// dump += ((buf[j]) >> (4 * ((i + 1) % 2)) & 0x0f) + 48;
// else
// dump += ((buf[j]) >> (4 * ((i + 1) % 2)) & 0x0f) + 87;
// j = j + i % 2;
// }
dump
+=
"
\n
"
;
fwrite
(
dump
.
c_str
(),
dump
.
size
(),
1
,
tcpdump
.
dumpfile
);
}
}
src/util/DCTDump.h
浏览文件 @
31c13b8d
...
...
@@ -26,20 +26,39 @@
#define RAW_IP 7
//struct dct2000_hdr {
// const char *ctxt_name;
// uint8 port_nr;
// const char *timestamp;
// const char *prot_name;
// const char *prot_var;
// const char *out_hdr;
// uint8 direct;
// uint8 encap;
//};
#define MAX_FIRST_LINE_LENGTH 200
#define MAX_TIMESTAMP_LINE_LENGTH 100
#define MAX_LINE_LENGTH 65536
#define MAX_TIMESTAMP_LEN 32
#define MAX_SECONDS_CHARS 16
#define MAX_SUBSECOND_DECIMALS 4
#define MAX_CONTEXT_NAME 64
#define MAX_PROTOCOL_NAME 64
#define MAX_PORT_DIGITS 2
#define MAX_VARIANT_DIGITS 32
#define MAX_OUTHDR_NAME 256
#define AAL_HEADER_CHARS 12
/*
* out file:
* - first line at least "Session Transcript"
* - second line, timestamp "February 21, 2006 16:45:20.5186"
* - packet:
* - context name "test_ETSI" followed by '.'
* - port number "1" followed by '/'
* - protocol name "isdn_l3" followed by '/'
* - protocol variant "1" followed by ',' if outhdr is present else followed by '/'
* - direction " s"
* - timestamp " tm 17.1505 "
* - start of dump "$"
* - dump of packet in ascii format (0x03 -> 0x30 0x33)
* - new line after each dump
*/
class
DCTDump
:
public
TCPDump
{
private:
const
char
*
timestamp
(
simtime_t
stime
);
void
dumpPacket
(
uint8
*
buf
,
int32
len
);
public:
DCTDump
();
virtual
~
DCTDump
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录