|
@@ -75,7 +75,7 @@ static inline struct ftp_request * tcp_to_ftp ( struct tcp_application *app ) {
|
75
|
75
|
*/
|
76
|
76
|
static void ftp_done ( struct ftp_request *ftp, int rc ) {
|
77
|
77
|
|
78
|
|
- DBG ( "FTP %p completed with status %d\n", ftp, rc );
|
|
78
|
+ DBGC ( ftp, "FTP %p completed with status %d\n", ftp, rc );
|
79
|
79
|
|
80
|
80
|
/* Close both TCP connections */
|
81
|
81
|
tcp_close ( &ftp->tcp );
|
|
@@ -118,7 +118,7 @@ static void ftp_parse_value ( char **text, uint8_t *value, size_t len ) {
|
118
|
118
|
static void ftp_reply ( struct ftp_request *ftp ) {
|
119
|
119
|
char status_major = ftp->status_text[0];
|
120
|
120
|
|
121
|
|
- DBG ( "FTP %p received status %s\n", ftp, ftp->status_text );
|
|
121
|
+ DBGC ( ftp, "FTP %p received status %s\n", ftp, ftp->status_text );
|
122
|
122
|
|
123
|
123
|
/* Ignore "intermediate" responses (1xx codes) */
|
124
|
124
|
if ( status_major == '1' )
|
|
@@ -149,8 +149,8 @@ static void ftp_reply ( struct ftp_request *ftp ) {
|
149
|
149
|
ftp_parse_value ( &ptr, ( uint8_t * ) &sa.sin.sin_port,
|
150
|
150
|
sizeof ( sa.sin.sin_port ) );
|
151
|
151
|
if ( ( rc = tcp_connect ( &ftp->tcp_data, &sa.st, 0 ) ) != 0 ){
|
152
|
|
- DBG ( "FTP %p could not create data connection\n",
|
153
|
|
- ftp );
|
|
152
|
+ DBGC ( ftp, "FTP %p could not make data connection\n",
|
|
153
|
+ ftp );
|
154
|
154
|
ftp_done ( ftp, rc );
|
155
|
155
|
return;
|
156
|
156
|
}
|
|
@@ -162,9 +162,10 @@ static void ftp_reply ( struct ftp_request *ftp ) {
|
162
|
162
|
ftp->already_sent = 0;
|
163
|
163
|
|
164
|
164
|
if ( ftp->state < FTP_DONE ) {
|
165
|
|
- DBG ( "FTP %p sending ", ftp );
|
166
|
|
- DBG ( ftp_strings[ftp->state].format, ftp_string_data ( ftp,
|
167
|
|
- ftp_strings[ftp->state].data_offset ) );
|
|
165
|
+ const struct ftp_string *string = &ftp_strings[ftp->state];
|
|
166
|
+ DBGC ( ftp, "FTP %p sending ", ftp );
|
|
167
|
+ DBGC ( ftp, string->format,
|
|
168
|
+ ftp_string_data ( ftp, string->data_offset ) );
|
168
|
169
|
}
|
169
|
170
|
|
170
|
171
|
return;
|
|
@@ -270,7 +271,8 @@ static void ftp_senddata ( struct tcp_application *app,
|
270
|
271
|
static void ftp_closed ( struct tcp_application *app, int status ) {
|
271
|
272
|
struct ftp_request *ftp = tcp_to_ftp ( app );
|
272
|
273
|
|
273
|
|
- DBG ( "FTP %p control connection closed (status %d)\n", ftp, status );
|
|
274
|
+ DBGC ( ftp, "FTP %p control connection closed (status %d)\n",
|
|
275
|
+ ftp, status );
|
274
|
276
|
|
275
|
277
|
/* Complete FTP operation */
|
276
|
278
|
ftp_done ( ftp, status );
|
|
@@ -315,7 +317,8 @@ tcp_to_ftp_data ( struct tcp_application *app ) {
|
315
|
317
|
static void ftp_data_closed ( struct tcp_application *app, int status ) {
|
316
|
318
|
struct ftp_request *ftp = tcp_to_ftp_data ( app );
|
317
|
319
|
|
318
|
|
- DBG ( "FTP %p data connection closed (status %d)\n", ftp, status );
|
|
320
|
+ DBGC ( ftp, "FTP %p data connection closed (status %d)\n",
|
|
321
|
+ ftp, status );
|
319
|
322
|
|
320
|
323
|
/* If there was an error, close control channel and record status */
|
321
|
324
|
if ( status )
|
|
@@ -358,7 +361,7 @@ static struct tcp_operations ftp_data_tcp_operations = {
|
358
|
361
|
struct async_operation * ftp_get ( struct ftp_request *ftp ) {
|
359
|
362
|
int rc;
|
360
|
363
|
|
361
|
|
- DBG ( "FTP %p fetching %s\n", ftp, ftp->filename );
|
|
364
|
+ DBGC ( ftp, "FTP %p fetching %s\n", ftp, ftp->filename );
|
362
|
365
|
|
363
|
366
|
ftp->tcp.tcp_op = &ftp_tcp_operations;
|
364
|
367
|
ftp->tcp_data.tcp_op = &ftp_data_tcp_operations;
|