00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef AGENT_HANDLER_H
00025 #define AGENT_HANDLER_H
00026
00027 #include <string>
00028 #include <prthread.h>
00029 #include <prlog.h>
00030
00031 using namespace std;
00032
00033 namespace net
00034 {
00035
00041 class AgentHandler
00042 {
00043
00044 protected:
00045
00049 int mIsBusy;
00053 PRThread *mTaskThread;
00057 string mTaskDescriptor;
00058
00059 protected:
00060
00066 void SetBusyState(int aState) { mIsBusy = aState; }
00067
00068 public:
00069
00074 void LaunchTaskThread();
00075
00081 virtual int CheckDescriptor(string) = 0;
00082
00088 virtual void HandleDescriptor(string) = 0;
00089
00094 AgentHandler();
00095
00100 int IsBusy() { return mIsBusy; }
00101
00107 void SetTaskDescriptor(string aDesc) { mTaskDescriptor = aDesc; }
00108
00114 string GetTaskDescriptor() { return mTaskDescriptor; }
00115
00116
00117 PRThread* createThread(PRThreadType type,
00118 void (*start)(void *arg),
00119 void *arg,
00120 PRThreadPriority priority,
00121 PRThreadScope scope,
00122 PRThreadState state,
00123 PRUint32 stackSize, PRInt32 index);
00124
00125 friend void PR_CALLBACK net::task_thread(void *);
00126
00127 };
00128
00129 }
00130
00131
00132 #endif