#ifndef PROCESS_REMODULE_H
#define PROCESS_REMODULE_H

#include <stdio.h>
#include <cstdio>
#include <process.h>
#ifndef  UT_TEST
#include "YAServerDlg.h"
#else
#include "stun_for_process_remodule.h"
#endif

//message process thread function
#define  TCP_MSG WM_USER+100
#define  MAX_INFO_SIZE     20
#define    MSG_PROCESS_THREAD_NUM    1
extern HANDLE hThread[MSG_PROCESS_THREAD_NUM];
extern unsigned nThreadID[MSG_PROCESS_THREAD_NUM];
extern int message_process_thread_init();
extern unsigned __stdcall message_process_entry(void *param);
extern int send_tcp_thread_message(ParseData* pchr);

//SQL thread function
#define SQL_MSG WM_USER+200
#define    SQL_PROCESS_THREAD_NUM    1
extern HANDLE hSqlThread[SQL_PROCESS_THREAD_NUM];
extern unsigned nSqlThreadID[SQL_PROCESS_THREAD_NUM];
extern int sql_process_thread_init();
extern unsigned __stdcall sql_process_entry(void *param);
extern int send_sql_message(char* pchr);

//err log thread function
#define ERR_LOG_MSG WM_USER+300
#define    ERR_LOG_PROCESS_THREAD_NUM    1
extern HANDLE hErrLogThread[ERR_LOG_PROCESS_THREAD_NUM];
extern unsigned nErrLogThreadID[ERR_LOG_PROCESS_THREAD_NUM];
extern int err_log_process_thread_init();
extern unsigned __stdcall err_log_process_entry(void *param);
extern int send_err_log_message(char* pchr);


//sys log thread function
#define SYS_LOG_MSG WM_USER+400
#define    SYS_LOG_PROCESS_THREAD_NUM    1
extern HANDLE hSysLogThread[SYS_LOG_PROCESS_THREAD_NUM];
extern unsigned nSysLogThreadID[SYS_LOG_PROCESS_THREAD_NUM];
extern int sys_log_process_thread_init();
extern unsigned __stdcall sys_log_process_entry(void *param);
extern int send_sys_log_message(char* pchr);
extern int debug_print_syslog(UINT debugLevel, const char* format, ...);

int service_task_init();

class BufferUtility
{
private:
	static BufferUtility* instance;
	
public:
	static BufferUtility* getInstance();
	int init();
	ParseData* getItem();
	int releaseItem(int index);
	int releaseItem(ParseData* itemPtr);
};

#endif