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

Contents of /innwebd/base.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations)
Fri Apr 11 17:14:49 2008 UTC (17 years, 11 months ago) by sysadm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +2 -6 lines
Content type: text/x-chdr
Update copyright
Add extra log for exception

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

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