forked from sackmotion/motion
-
Notifications
You must be signed in to change notification settings - Fork 1
/
netcam_ftp.h
43 lines (39 loc) · 1.7 KB
/
netcam_ftp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* Much of the FTP routines was inspired by the nanoftp.c module from
* libxml2 (Copyright Daniel Veillard, 2003). The routines have been
* modified to fit the needs of the Motion project.
*
* Copyright 2005, William M. Brack
* This software is distributed under the GNU Public license Version 2.
* See also the file 'COPYING'.
*
*/
#ifndef _INCLUDE_NETCAM_FTP_H
#define _INCLUDE_NETCAM_FTP_H
#define FTP_BUF_SIZE 1024
typedef struct ftp_context {
char *path; /* the path within the URL */
char *user; /* user string */
char *passwd; /* passwd string */
struct sockaddr_in ftp_address; /* the socket addr structure */
int passive; /* flag show passive/active mode used */
int control_file_desc; /* file descriptor for the control socket */
int data_file_desc; /* file descriptor for the data socket */
int state; /* WRITE / READ / CLOSED */
int returnValue; /* the protocol return value */
/* buffer for data received from the control connection */
char control_buffer[FTP_BUF_SIZE + 1];
int control_buffer_index;
int control_buffer_used;
int control_buffer_answer;
} ftp_context, *ftp_context_pointer;
/* The public interface */
ftp_context_pointer ftp_new_context(void);
void ftp_free_context(ftp_context_pointer);
ftp_context_pointer ftpOpen(const char *);
int ftp_connect(netcam_context_ptr);
int ftp_send_type(ftp_context_pointer, const char);
int ftp_get_socket(ftp_context_pointer);
int ftp_read(ftp_context_pointer, void *, int);
int ftp_close(ftp_context_pointer);
#endif