00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef __INETUSERCONNECTION_H_
00013 #define __INETUSERCONNECTION_H_
00014
00015 #include <inttypes.h>
00016 #include <pthread.h>
00017
00018 #include <Common.h>
00019 #include <Document.h>
00020 #include <Error.h>
00021 #include <Socket.h>
00022 #include <UserProfile.h>
00023
00024
00025 class Socket;
00026 class StrongroomCore;
00027
00031 class InetUserConnection
00032 {
00033 public:
00034 InetUserConnection( StrongroomCore *core, Socket *socket );
00035 ~InetUserConnection();
00036
00037 void run();
00038 bool isRunning();
00039
00040
00041 bool createDocument();
00042 bool deleteDocument();
00043 bool changeDocument();
00044 bool deleteRevision();
00045 bool addRendition();
00046 bool getDocument();
00047 bool getDocumentInfo();
00048 bool changeDocumentInfo();
00049 bool queryUpdates();
00050 bool login();
00051 bool bye();
00052 bool shutdown();
00053 bool addUser();
00054 bool deleteUser();
00055 bool getUserProfile();
00056 bool changeUserProfile();
00057 bool setPassword();
00058 bool clearPassword();
00059 bool listUsers();
00060
00061 private:
00062 bool parseEOL();
00063 bool parseInt64( int64_t &value );
00064 bool parseNumID( NumID &id );
00065 bool parseString( string &str );
00066 bool parseConstant( string value );
00067 string nextToken();
00068 string coreErrorToProtocol( CoreError error );
00069 int readString( int64_t length, string &str );
00070 int readDocumentInfo( int64_t length, Document &document );
00071 int readUserProfile( int64_t length, UserProfile &userProfile );
00072
00073 bool threadCreated, threadStopped;
00074 pthread_t thread;
00075 StrongroomCore *core;
00076 Socket *socket;
00077 uint8_t *transferBuffer;
00078 int transferBufferSize;
00079 string command, args;
00080 UserProfile user;
00081 };
00082
00083 #endif