Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
28dd0f0e
Commit
28dd0f0e
authored
Dec 18, 2013
by
vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added dump packets to file
parent
d39a4e43
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
2 deletions
+43
-2
interface.c
interface.c
+4
-0
loop.c
loop.c
+1
-0
main.c
main.c
+16
-1
mtproto-client.c
mtproto-client.c
+2
-1
net.c
net.c
+20
-0
No files found.
interface.c
View file @
28dd0f0e
...
...
@@ -1369,6 +1369,10 @@ void print_message (struct message *M) {
print_service_message
(
M
);
return
;
}
if
(
!
get_peer_type
(
M
->
to_id
))
{
logprintf
(
"Bad msg
\n
"
);
return
;
}
last_from_id
=
M
->
from_id
;
last_to_id
=
M
->
to_id
;
...
...
loop.c
View file @
28dd0f0e
...
...
@@ -104,6 +104,7 @@ size_t *_l;
int
got_it_ok
;
void
got_it
(
char
*
line
,
int
len
)
{
assert
(
len
>
0
);
line
[
--
len
]
=
0
;
// delete end of line
*
_s
=
line
;
*
_l
=
len
;
...
...
main.c
View file @
28dd0f0e
...
...
@@ -324,10 +324,14 @@ extern char *rsa_public_key_name;
extern
int
verbosity
;
extern
int
default_dc_num
;
char
*
log_net_file
;
FILE
*
log_net_f
;
int
register_mode
;
int
disable_auto_accept
;
void
args_parse
(
int
argc
,
char
**
argv
)
{
int
opt
=
0
;
while
((
opt
=
getopt
(
argc
,
argv
,
"u:hk:vn:Nc:p:l:Rf"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"u:hk:vn:Nc:p:l:Rf
BL:E
"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'u'
:
set_default_username
(
optarg
);
...
...
@@ -360,6 +364,17 @@ void args_parse (int argc, char **argv) {
case
'B'
:
binlog_enabled
=
1
;
break
;
case
'L'
:
if
(
log_net_file
)
{
usage
();
}
log_net_file
=
strdup
(
optarg
);
log_net_f
=
fopen
(
log_net_file
,
"a"
);
assert
(
log_net_f
);
break
;
case
'E'
:
disable_auto_accept
=
1
;
break
;
case
'h'
:
default:
usage
();
...
...
mtproto-client.c
View file @
28dd0f0e
...
...
@@ -60,6 +60,7 @@ char nonce[256];
char
new_nonce
[
256
];
char
server_nonce
[
256
];
extern
int
binlog_enabled
;
extern
int
disable_auto_accept
;
int
total_packets_sent
;
...
...
@@ -1148,7 +1149,7 @@ void work_update (struct connection *c UU, long long msg_id UU) {
}
pop_color
();
print_end
();
if
(
E
->
state
==
sc_request
)
{
if
(
E
->
state
==
sc_request
&&
!
disable_auto_accept
)
{
do_accept_encr_chat_request
(
E
);
}
fetch_int
();
// date
...
...
net.c
View file @
28dd0f0e
...
...
@@ -45,6 +45,7 @@ DEFINE_TREE(int,int,int_cmp,0)
int
verbosity
;
extern
struct
connection_methods
auth_methods
;
extern
FILE
*
log_net_f
;
void
fail_connection
(
struct
connection
*
c
);
...
...
@@ -348,6 +349,7 @@ void fail_connection (struct connection *c) {
restart_connection
(
c
);
}
extern
FILE
*
log_net_f
;
void
try_write
(
struct
connection
*
c
)
{
if
(
verbosity
)
{
logprintf
(
"try write: fd = %d
\n
"
,
c
->
fd
);
...
...
@@ -355,6 +357,15 @@ void try_write (struct connection *c) {
int
x
=
0
;
while
(
c
->
out_head
)
{
int
r
=
write
(
c
->
fd
,
c
->
out_head
->
rptr
,
c
->
out_head
->
wptr
-
c
->
out_head
->
rptr
);
if
(
r
>
0
&&
log_net_f
)
{
fprintf
(
log_net_f
,
"OUT %s:%d"
,
c
->
ip
,
c
->
port
);
int
i
;
for
(
i
=
0
;
i
<
r
;
i
++
)
{
fprintf
(
log_net_f
,
" %02x"
,
*
(
unsigned
char
*
)(
c
->
out_head
->
rptr
+
i
));
}
fprintf
(
log_net_f
,
"
\n
"
);
fflush
(
log_net_f
);
}
if
(
r
>=
0
)
{
x
+=
r
;
c
->
out_head
->
rptr
+=
r
;
...
...
@@ -457,6 +468,15 @@ void try_read (struct connection *c) {
int
x
=
0
;
while
(
1
)
{
int
r
=
read
(
c
->
fd
,
c
->
in_tail
->
wptr
,
c
->
in_tail
->
end
-
c
->
in_tail
->
wptr
);
if
(
r
>
0
&&
log_net_f
)
{
fprintf
(
log_net_f
,
"IN %s:%d"
,
c
->
ip
,
c
->
port
);
int
i
;
for
(
i
=
0
;
i
<
r
;
i
++
)
{
fprintf
(
log_net_f
,
" %02x"
,
*
(
unsigned
char
*
)(
c
->
in_tail
->
wptr
+
i
));
}
fprintf
(
log_net_f
,
"
\n
"
);
fflush
(
log_net_f
);
}
if
(
r
>
0
)
{
c
->
last_receive_time
=
get_double_time
();
stop_ping_timer
(
c
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment