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

Diff of /innwebd/base.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 by sysadm, Fri Jul 2 11:22:00 2004 UTC Revision 1.7 by sysadm, Sat Feb 26 16:10:25 2005 UTC
# Line 1  Line 1 
1  /*******************************************************/  /*******************************************************/
2  /*                                                     */  /*                                                     */
3  /*  LeafOK Innd                                        */  /*  LeafOK Innbbsd                                     */
4  /*  Copyright (C) LeafOK.com, 2003-2004                */  /*  Copyright (C) LeafOK.com, 2003-2005                */
5  /*                                                     */  /*                                                     */
6  /*  Programmed by Leaf                                 */  /*  Programmed by Leaf                                 */
7  /*  E-mail:leaf@leafok.com  QQ:6049044                 */  /*  E-mail:leaflet@leafok.com  QQ:6049044              */
8  /*                                                     */  /*                                                     */
9  /*  http://bbs.leafok.com                              */  /*  http://bbs.leafok.com                              */
10  /*  http://bbs.leafok.net                              */  /*  http://bbs.leafok.net                              */
# Line 16  Line 16 
16    
17  #include "afxdb.h"  #include "afxdb.h"
18  #include "winsock2.h"  #include "winsock2.h"
19    #include ".\thread_pool.h"
20    
21  class base  class base
22  {  {
# Line 25  public: Line 26  public:
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);          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);          int begin(void);
28          int end(void);          int end(void);
29          bool IsRunning(void);          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:  protected:
50            ULONG ulMainThreadId;
51            base* p_ParentThread;
52            thread_pool* p_ThreadPool;
53          SOCKET s;          SOCKET s;
54          SOCKADDR sockaddr;          SOCKADDR sockaddr;
55          CDatabase Db;          CDatabase Db;
# Line 50  protected: Line 73  protected:
73          virtual int s_connect(const char* hostname, unsigned int port) = 0;          virtual int s_connect(const char* hostname, unsigned int port) = 0;
74          virtual int s_close(void) = 0;          virtual int s_close(void) = 0;
75          int s_send(const char* in_str, bool auto_endl = true);          int s_send(const char* in_str, bool auto_endl = true);
76          int s_receive(CString& out_str, const char* end_str="\r\n");          int s_receive(CString& out_str, char end_str[] = "\r");
77          int s_exec(const char* in_str, CString& out_str, const char* end_str="\r\n");          int s_exec(const char* in_str, CString& out_str, char end_str[] = "\r");
78          virtual bool IsShutdown(void);          virtual bool IsShutdown(void);
79          virtual int Shutdown(void);          virtual int Shutdown(void);
80          virtual int Startup(void);          virtual int Startup(void);
81          virtual int w_call() = 0;          virtual int w_call() = 0;
82  private:  private:
         HANDLE hThread;  
83          static DWORD Thread(LPVOID pParam);          static DWORD Thread(LPVOID pParam);
84    public:
85            bool IsThreadActive(void);
86  };  };
87    


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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