| 1 |
/*******************************************************/
|
| 2 |
/* */
|
| 3 |
/* LeafOK Innd */
|
| 4 |
/* Copyright (C) LeafOK.com, 2003-2004 */
|
| 5 |
/* */
|
| 6 |
/* Programmed by Leaf */
|
| 7 |
/* E-mail:leaf@leafok.com QQ:6049044 */
|
| 8 |
/* */
|
| 9 |
/* http://bbs.leafok.com */
|
| 10 |
/* http://bbs.leafok.net */
|
| 11 |
/* http://bbs.fenglin.info */
|
| 12 |
/* */
|
| 13 |
/*******************************************************/
|
| 14 |
|
| 15 |
#pragma once
|
| 16 |
|
| 17 |
#include "afxdb.h"
|
| 18 |
#include "winsock2.h"
|
| 19 |
|
| 20 |
class base
|
| 21 |
{
|
| 22 |
public:
|
| 23 |
base(void);
|
| 24 |
~base(void);
|
| 25 |
virtual void configure(const char* innd_id, const char* innd_name, const char* innd_server, unsigned long innd_uid, const char* w_address, unsigned int w_port, const char* w_conn_str);
|
| 26 |
int begin(void);
|
| 27 |
int end(void);
|
| 28 |
bool IsRunning(void);
|
| 29 |
protected:
|
| 30 |
SOCKET s;
|
| 31 |
SOCKADDR sockaddr;
|
| 32 |
CDatabase Db;
|
| 33 |
bool isConnected;
|
| 34 |
bool running;
|
| 35 |
unsigned long innd_uid;
|
| 36 |
char innd_id[50];
|
| 37 |
char innd_name[50];
|
| 38 |
char innd_server[256];
|
| 39 |
unsigned int w_port;
|
| 40 |
char w_address[50];
|
| 41 |
char w_conn_str[256];
|
| 42 |
char hostaddr[50];
|
| 43 |
unsigned int port;
|
| 44 |
int bbs_post(const CString& head, const CString& body, int sid, long art_id);
|
| 45 |
long last_insert_id(void);
|
| 46 |
int bbs_delete(long id);
|
| 47 |
static CString addslashes(CString str);
|
| 48 |
int db_open(const char* conn_str = "ODBC;");
|
| 49 |
int db_close(void);
|
| 50 |
virtual int s_connect(const char* hostname, unsigned int port) = 0;
|
| 51 |
virtual int s_close(void) = 0;
|
| 52 |
int s_send(const char* in_str, bool auto_endl = true);
|
| 53 |
int s_receive(CString& out_str, const char* end_str="\r\n");
|
| 54 |
int s_exec(const char* in_str, CString& out_str, const char* end_str="\r\n");
|
| 55 |
virtual bool IsShutdown(void);
|
| 56 |
virtual int Shutdown(void);
|
| 57 |
virtual int Startup(void);
|
| 58 |
virtual int w_call() = 0;
|
| 59 |
private:
|
| 60 |
HANDLE hThread;
|
| 61 |
static DWORD Thread(LPVOID pParam);
|
| 62 |
};
|
| 63 |
|