Commit 283669aa authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

ftp: add callback to parse server responses

parent 3a4c96c5
......@@ -159,8 +159,9 @@ static int ftp_SendCommand( vlc_object_t *obj, access_sys_t *sys,
These strings are not part of the requests, except in the case \377\377,
where the request contains one \377. */
static int ftp_RecvCommand( vlc_object_t *obj, access_sys_t *sys,
int *restrict codep, char **restrict strp )
static int ftp_RecvAnswer( vlc_object_t *obj, access_sys_t *sys,
int *restrict codep, char **restrict strp,
void (*cb)(void *, const char *), void *opaque )
{
if( codep != NULL )
*codep = 500;
......@@ -198,6 +199,8 @@ static int ftp_RecvCommand( vlc_object_t *obj, access_sys_t *sys,
}
done = !strncmp( resp, line, 4 );
if( !done )
cb( opaque, line );
free( line );
}
while( !done );
......@@ -215,6 +218,17 @@ error:
return -1;
}
static void DummyLine( void *data, const char *str )
{
(void) data; (void) str;
}
static int ftp_RecvCommand( vlc_object_t *obj, access_sys_t *sys,
int *restrict codep, char **restrict strp )
{
return ftp_RecvAnswer( obj, sys, codep, strp, DummyLine, NULL );
}
static int ftp_StartStream( vlc_object_t *, access_sys_t *, uint64_t );
static int ftp_StopStream ( vlc_object_t *, access_sys_t * );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment