Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
0c80d4c1
Commit
0c80d4c1
authored
19 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Support the ZCRC header type.
parent
3ed5ca14
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/sbbs3/zmodem.c
+37
-13
37 additions, 13 deletions
src/sbbs3/zmodem.c
src/sbbs3/zmodem.h
+2
-1
2 additions, 1 deletion
src/sbbs3/zmodem.h
with
39 additions
and
14 deletions
src/sbbs3/zmodem.c
+
37
−
13
View file @
0c80d4c1
...
...
@@ -85,6 +85,7 @@ static char *chr(uchar ch)
case
ZACK
:
return
(
"ZACK"
);
case
ZFILE
:
return
(
"ZFILE"
);
case
ZSKIP
:
return
(
"ZSKIP"
);
case
ZCRC
:
return
(
"ZCRC"
);
case
ZNAK
:
return
(
"ZNAK"
);
case
ZABORT
:
return
(
"ZABORT"
);
case
ZFIN
:
return
(
"ZFIN"
);
...
...
@@ -361,7 +362,7 @@ int zmodem_send_data32(zmodem_t* zm, uchar sub_frame_type, unsigned char * p, in
int
result
;
unsigned
long
crc
;
lprintf
(
zm
,
LOG_DEBUG
,
"zmodem_send_data32
"
);
lprintf
(
zm
,
LOG_DEBUG
,
"zmodem_send_data32
: %s"
,
chr
(
sub_frame_type
)
);
crc
=
0xffffffffl
;
...
...
@@ -395,7 +396,7 @@ int zmodem_send_data16(zmodem_t* zm, uchar sub_frame_type,unsigned char * p,int
int
result
;
unsigned
short
crc
;
lprintf
(
zm
,
LOG_DEBUG
,
"zmodem_send_data16
"
);
lprintf
(
zm
,
LOG_DEBUG
,
"zmodem_send_data16
: %s"
,
chr
(
sub_frame_type
)
);
crc
=
0
;
...
...
@@ -1108,13 +1109,18 @@ int zmodem_recv_header_raw(zmodem_t* zm, int errors)
* return its type.
*/
if
(
zm
->
rxd_header
[
0
]
==
ZDATA
)
{
zm
->
ack_file_pos
=
zm
->
rxd_header
[
ZP0
]
|
(
zm
->
rxd_header
[
ZP1
]
<<
8
)
|
(
zm
->
rxd_header
[
ZP2
]
<<
16
)
|
(
zm
->
rxd_header
[
ZP3
]
<<
24
);
}
if
(
zm
->
rxd_header
[
0
]
==
ZFILE
)
{
zm
->
ack_file_pos
=
0l
;
switch
(
zm
->
rxd_header
[
0
])
{
case
ZCRC
:
zm
->
crc_request
=
zm
->
rxd_header
[
ZP0
]
|
(
zm
->
rxd_header
[
ZP1
]
<<
8
)
|
(
zm
->
rxd_header
[
ZP2
]
<<
16
)
|
(
zm
->
rxd_header
[
ZP3
]
<<
24
);
break
;
case
ZDATA
:
zm
->
ack_file_pos
=
zm
->
rxd_header
[
ZP0
]
|
(
zm
->
rxd_header
[
ZP1
]
<<
8
)
|
(
zm
->
rxd_header
[
ZP2
]
<<
16
)
|
(
zm
->
rxd_header
[
ZP3
]
<<
24
);
break
;
case
ZFILE
:
zm
->
ack_file_pos
=
0l
;
break
;
}
#if 0 //def _DEBUG
...
...
@@ -1155,6 +1161,16 @@ int zmodem_recv_header_and_check(zmodem_t* zm)
return
type
;
}
BOOL
zmodem_get_crc
(
zmodem_t
*
zm
,
long
length
,
ulong
*
crc
)
{
zmodem_send_pos_header
(
zm
,
ZCRC
,
length
,
TRUE
);
if
(
zmodem_recv_header
(
zm
)
!=
ZCRC
)
return
(
FALSE
);
if
(
crc
!=
NULL
)
*
crc
=
zm
->
crc_request
;
return
(
TRUE
);
}
void
zmodem_parse_zrinit
(
zmodem_t
*
zm
)
{
zm
->
can_full_duplex
=
(
zm
->
rxd_header
[
ZF0
]
&
ZF0_CANFDX
)
!=
0
;
...
...
@@ -1403,16 +1419,16 @@ BOOL zmodem_send_file(zmodem_t* zm, char* fname, FILE* fp, BOOL request_init, ti
zfile_frame
[
ZF1
]
=
ZF1_ZMPROT
;
lprintf
(
zm
,
LOG_DEBUG
,
"zmodem_send_file: protecting destination"
);
}
if
(
zm
->
management_clobber
)
{
else
if
(
zm
->
management_clobber
)
{
zfile_frame
[
ZF1
]
=
ZF1_ZMCLOB
;
lprintf
(
zm
,
LOG_DEBUG
,
"zmodem_send_file: overwriting destination"
);
}
if
(
zm
->
management_newer
)
{
else
if
(
zm
->
management_newer
)
{
zfile_frame
[
ZF1
]
=
ZF1_ZMNEW
;
lprintf
(
zm
,
LOG_DEBUG
,
"zmodem_send_file: overwriting destination if newer"
);
}
else
zfile_frame
[
ZF1
]
=
ZF1_ZMCRC
;
/*
* transport options
...
...
@@ -1488,6 +1504,11 @@ BOOL zmodem_send_file(zmodem_t* zm, char* fname, FILE* fp, BOOL request_init, ti
return
(
FALSE
);
}
if
(
type
==
ZCRC
)
{
zmodem_send_pos_header
(
zm
,
ZCRC
,
fcrc32
(
fp
,
zm
->
crc_request
),
TRUE
);
type
=
zmodem_recv_header
(
zm
);
}
}
while
(
type
!=
ZRPOS
);
zm
->
transfer_start
=
time
(
NULL
);
...
...
@@ -1495,6 +1516,7 @@ BOOL zmodem_send_file(zmodem_t* zm, char* fname, FILE* fp, BOOL request_init, ti
if
(
start
!=
NULL
)
*
start
=
zm
->
transfer_start
;
rewind
(
fp
);
do
{
/*
* fetch pos from the ZRPOS header
...
...
@@ -1525,6 +1547,8 @@ BOOL zmodem_send_file(zmodem_t* zm, char* fname, FILE* fp, BOOL request_init, ti
lprintf
(
zm
,
LOG_INFO
,
"Finishing transfer on rx of header type: %s"
,
chr
((
uchar
)
type
));
if
(
sent
!=
NULL
)
lprintf
(
zm
,
LOG_DEBUG
,
"Sent %lu total bytes"
,
*
sent
);
if
(
type
==
ZACK
)
{
/*
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/zmodem.h
+
2
−
1
View file @
0c80d4c1
...
...
@@ -248,9 +248,9 @@ typedef struct {
BOOL
file_skipped
;
BOOL
no_streaming
;
unsigned
recv_bufsize
;
/* Receiver specified buffer size */
long
crc_request
;
/* Configuration */
long
*
mode
;
unsigned
send_timeout
;
unsigned
recv_timeout
;
unsigned
max_errors
;
...
...
@@ -286,6 +286,7 @@ int zmodem_send_zrinit(zmodem_t*);
int
zmodem_send_pos_header
(
zmodem_t
*
zm
,
int
type
,
long
pos
,
BOOL
hex
);
int
zmodem_get_zrinit
(
zmodem_t
*
);
int
zmodem_get_zfin
(
zmodem_t
*
zm
);
BOOL
zmodem_get_crc
(
zmodem_t
*
,
long
length
,
ulong
*
crc
);
void
zmodem_parse_zrinit
(
zmodem_t
*
);
int
zmodem_send_zfin
(
zmodem_t
*
);
BOOL
zmodem_send_file
(
zmodem_t
*
,
char
*
name
,
FILE
*
fp
,
BOOL
request_init
,
time_t
*
start
,
ulong
*
bytes_sent
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment