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

Contents of /innwebd/base.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Sat Aug 28 15:38:42 2004 UTC (21 years, 6 months ago) by sysadm
Branch: MAIN
Changes since 1.5: +2 -2 lines
Content type: text/x-chdr
Use "\n" as input end instead of "\r\n"

1 /*******************************************************/
2 /* */
3 /* LeafOK Innbbsd */
4 /* Copyright (C) LeafOK.com, 2003-2004 */
5 /* */
6 /* Programmed by Leaf */
7 /* E-mail:leaflet@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 && this->IsThreadActive());
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 ULONG ulMainThreadId;
51 base* p_ParentThread;
52 thread_pool* p_ThreadPool;
53 SOCKET s;
54 SOCKADDR sockaddr;
55 CDatabase Db;
56 bool isConnected;
57 bool running;
58 unsigned long innd_uid;
59 char innd_id[50];
60 char innd_name[50];
61 char innd_server[256];
62 unsigned int w_port;
63 char w_address[50];
64 char w_conn_str[256];
65 char hostaddr[50];
66 unsigned int port;
67 int bbs_post(const CString& head, const CString& body, int sid, long art_id);
68 long last_insert_id(void);
69 int bbs_delete(long id);
70 static CString addslashes(CString str);
71 int db_open(const char* conn_str = "ODBC;");
72 int db_close(void);
73 virtual int s_connect(const char* hostname, unsigned int port) = 0;
74 virtual int s_close(void) = 0;
75 int s_send(const char* in_str, bool auto_endl = true);
76 int s_receive(CString& out_str, char end_str[] = "\r");
77 int s_exec(const char* in_str, CString& out_str, char end_str[] = "\r");
78 virtual bool IsShutdown(void);
79 virtual int Shutdown(void);
80 virtual int Startup(void);
81 virtual int w_call() = 0;
82 private:
83 static DWORD Thread(LPVOID pParam);
84 public:
85 bool IsThreadActive(void);
86 };
87

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