#ifndef INET_API_H
#define INET_API_H


#ifdef __cplusplus
extern "C" {
#endif

#define MAX_HTTP_POST_SIZE          (1024)

typedef struct HTTP_POST_ATTACH
{
    char    keyName[64];
    char    keyValue[MAX_HTTP_POST_SIZE];

    struct HTTP_POST_ATTACH     *next, *prev;
} *PHTTP_POST_ATTACH;

typedef struct
{
	char *pUserName;
	char *pPassword;
	char *pSmtpServer;
	short smtpPort;
} SMTP_MAIL_CONFIG, *PSMTP_MAIL_CONFIG;

int InetSmtpSendEmail(const char *pFrom,
					  const char *pTo[],
					  const char *pCc[],
					  const char *pTitle,
					  const char *pMessage,
					  const char *pAttach[],
					  PSMTP_MAIL_CONFIG 	pConfig);
#define InetHttpsDownloadFile(pURL, pPath, onRespCb, onPrgCb) InetHttpDlFileAsync(pURL, pPath, onRespCb, onPrgCb)
#define InetHttpsWebServicePost(pURL, pPost, onRespCb) InetHttpWebServicePostAsync(pURL, pPost, onRespCb)
int InetCancelDownload(const char *pTaskUuid);

typedef void (*OnHttpResponse)(void* pData, unsigned int size, const char* pReqUrl, const char* pDlPath, const char* pTaskUuid, int iFinished, void* pUserData);
typedef void (*OnProgressNotify)(const char* pReqUrl, const char* pTaskUuid, unsigned char uPercent, void* pUserData);

int InetInit(void);
void InetUnInit(void);

const char* InetHttpDlFileAsync(const char*, const char*, OnHttpResponse, OnProgressNotify, void*);
const char* InetHttpWebServicePostAsync(const char *pURL, const char *pPost, OnHttpResponse onRespCb, void *pData);
int InetHttpUploadFileSync(const char *pURL, const char* pPath, void* pAttachInfo);
//int InetSmtpSendEmail(void);
#ifdef __cplusplus
}
#endif  
#endif
