/[LeafOK_CVS]/innwebd/base.h
ViewVC logotype

Contents of /innwebd/base.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations)
Sat Jul 3 13:56:04 2004 UTC (21 years, 8 months ago) by sysadm
Branch: MAIN
Changes since 1.1: +23 -1 lines
Content type: text/x-chdr
Add thread_pool

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 #include ".\thread_pool.h"
20
21 class base
22 {
23 public:
24 base(void);
25 ~base(void);
26 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);
27 int begin(void);
28 int end(void);
29 inline bool IsRunning(void)
30 {
31 return this->running;
32 }
33 inline base* GetParentThread(void)
34 {
35 return this->p_ParentThread;
36 }
37 inline void SetParentThread(base* p_ParentThread)
38 {
39 this->p_ParentThread = p_ParentThread;
40 }
41 inline thread_pool* GetThreadPool(void)
42 {
43 return this->p_ThreadPool;
44 }
45 inline void SetThreadPool(thread_pool* p_ThreadPool)
46 {
47 this->p_ThreadPool = p_ThreadPool;
48 }
49 protected:
50 base* p_ParentThread;
51 thread_pool* p_ThreadPool;
52 SOCKET s;
53 SOCKADDR sockaddr;
54 CDatabase Db;
55 bool isConnected;
56 bool running;
57 unsigned long innd_uid;
58 char innd_id[50];
59 char innd_name[50];
60 char innd_server[256];
61 unsigned int w_port;
62 char w_address[50];
63 char w_conn_str[256];
64 char hostaddr[50];
65 unsigned int port;
66 int bbs_post(const CString& head, const CString& body, int sid, long art_id);
67 long last_insert_id(void);
68 int bbs_delete(long id);
69 static CString addslashes(CString str);
70 int db_open(const char* conn_str = "ODBC;");
71 int db_close(void);
72 virtual int s_connect(const char* hostname, unsigned int port) = 0;
73 virtual int s_close(void) = 0;
74 int s_send(const char* in_str, bool auto_endl = true);
75 int s_receive(CString& out_str, const char* end_str="\r\n");
76 int s_exec(const char* in_str, CString& out_str, const char* end_str="\r\n");
77 virtual bool IsShutdown(void);
78 virtual int Shutdown(void);
79 virtual int Startup(void);
80 virtual int w_call() = 0;
81 private:
82 HANDLE hThread;
83 static DWORD Thread(LPVOID pParam);
84 };
85

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1