98 lines
2.7 KiB
C
98 lines
2.7 KiB
C
#ifndef SERVERS_H
|
|
#define SERVERS_H
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
#define SERVERS_PARAM_NULL_MEANS_END NULL
|
|
typedef enum
|
|
{
|
|
SERVERS_CODE_DEFAULT = -1,
|
|
SERVERS_CODE_OK = 0,
|
|
SERVERS_CODE_END
|
|
} ServersCode;
|
|
typedef enum
|
|
{
|
|
FTPS_FLAG_ENABLE = 0,
|
|
FTPS_FLAG_DISABLE,
|
|
FTPS_FLAG_END
|
|
} FtpsFlag;
|
|
typedef enum
|
|
{
|
|
LOG_FLAG_ENABLE = 0,
|
|
LOG_FLAG_DISABLE,
|
|
LOG_FLAG_END
|
|
} LogFlag;
|
|
typedef enum
|
|
{
|
|
SSL_VERIFY_ENABLE = 0,
|
|
SSL_VERIFY_DISABLE,
|
|
SSL_VERIFY_END
|
|
} SslFlag;
|
|
typedef struct servers_init
|
|
{
|
|
LogFlag logFlag;
|
|
SslFlag sslVerifyFlag;
|
|
} SERVERS_INIT;
|
|
typedef struct servers_http
|
|
{
|
|
const char *url;
|
|
char *postData;
|
|
char *filePath;
|
|
char **header;
|
|
char *reply;
|
|
unsigned int replyLength;
|
|
int code;
|
|
} SERVERS_HTTP;
|
|
typedef struct servers_ftp
|
|
{
|
|
const char *url;
|
|
const FtpsFlag ftpsFlag;
|
|
char *user_password;
|
|
char *filePath;
|
|
int code;
|
|
} SERVERS_FTP;
|
|
typedef struct servers_smtp
|
|
{
|
|
const char *url;
|
|
const char *subject;
|
|
const char *from;
|
|
const char *to;
|
|
const char *userName;
|
|
const char *password;
|
|
const char *date;
|
|
char *inlineText;
|
|
char **toList;
|
|
unsigned int toListLength;
|
|
// char *text;
|
|
// unsigned int textLength;
|
|
char **attachment;
|
|
int code;
|
|
} SERVERS_SMTP;
|
|
void servers_init(SERVERS_INIT init);
|
|
void servers_unit(void);
|
|
// HTTP API
|
|
SERVERS_HTTP *new_servers_http(const char *url);
|
|
void delete_servers_http(SERVERS_HTTP *ptr);
|
|
void http_get(SERVERS_HTTP *param);
|
|
void http_post(SERVERS_HTTP *param);
|
|
void http_put(SERVERS_HTTP *param);
|
|
// FTP API
|
|
SERVERS_FTP *new_servers_ftp(const char *url, const FtpsFlag ftpsFlag);
|
|
void delete_servers_ftp(SERVERS_FTP *ptr);
|
|
void ftp_download(SERVERS_FTP *param);
|
|
void ftp_upload(SERVERS_FTP *param);
|
|
// SMTP API
|
|
SERVERS_SMTP *new_servers_smtp(const char *url,
|
|
const char *subject,
|
|
const char *from,
|
|
const char *to,
|
|
const char *userName,
|
|
const char *password,
|
|
const char *date);
|
|
void delete_servers_smtp(SERVERS_SMTP *ptr);
|
|
void smtp_send_email(SERVERS_SMTP *param);
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif // !SERVERS_H
|