00001
00002
00010 /********************************************************************
00011 Description: The CoreClass
00012 part of the 3Dsia project
00013 created: xandi, 080400
00014
00015 History:
00016 date, name, changes, in funtion
00017
00018 ********************************************************************/
00019 #ifndef CORECLASS_H
00020 #define CORECLASS_H
00021
00022
00023 /*...................................................................
00024 Description: The Class for CoreThread stuff..
00025 Args:
00026 Returns:
00027 Created: [name], [date]
00028 [ToDo:]
00029 Comments:
00030 The CoreClass does everything that is neccessary to connect to a
00031 server.
00032
00033 Changes:
00034 -------------------------------------------------------------------*/
00035
00036 #include <pthread.h>
00037 #include <string>
00038 #include <sys/time.h>
00039
00040 #include "misc.h"
00041 #include "quartz.h"
00042 #include "../common/buffer.h"
00043 #include "../common/protocol.h"
00044
00045 #define INCOMING 1
00046 #define OUTGOING 2
00047
00048 class coreClass
00049 {
00050 private:
00051
00052 string username;
00053 string password;
00054
00055 string realname;
00056
00057 int mySocket;
00058
00059 string serverAddress;
00060 int serverPort;
00061
00062 pthread_t incomingThread;
00063 pthread_t outgoingThread;
00064 pthread_t quartzThread;
00065
00066 QuartzClass* qObj;
00067
00068 Buffer* coreIn;
00069 Buffer* coreOut;
00070
00071 public:
00072
00074
00077 coreClass ( ThreadArgs* targs );
00078
00080
00082 coreClass ( );
00083
00085
00088 bool connectNow ( void );
00089
00091
00094 bool disconnectNow ( void );
00095
00096
00098
00102 Buffer* getBuffer ( int whichbuffer );
00103
00105
00108 void startQuartz ( unsigned int freq );
00110
00113 void setUpdateFreq ( unsigned int freq );
00114
00115 private:
00117
00122 bool connectTo ( string dotsandnumbers );
00124
00127 bool handshake ( void );
00129
00133 bool authenticate ( void );
00134
00135 };
00136
00137 #endif CORECLASS_H