#include <ArClientFileUtils.h>
Public Types | |
enum | SendSpeed { SPEED_AUTO, SPEED_FAST, SPEED_SLOW } |
Enum that describes the speed to send at. More... | |
Public Member Functions | |
void | addFileSentCallback (ArFunctor1< int > *functor, ArListPos::Pos position=ArListPos::LAST) |
Adds a callback for when we get the desired file (or fail). | |
ArClientFileFromClient (ArClientBase *client) | |
Constructor. | |
void | cancelPut (void) |
Cancels getting a file. | |
const char * | getClientFileName (void) |
Gets the filename we're taking from the client. | |
const char * | getDirectory (void) |
Gets the directory we're putting to. | |
const char * | getFileName (void) |
Gets the filename we're putting. | |
ArTime | getLastCompletedSend (void) |
Gets the last time we finished putting a file. | |
ArTime | getLastStartedSend (void) |
Gets the last time we started putting a file. | |
bool | isAvailable (void) |
Sees if the server supports what this class needs. | |
bool | isAvailableFast (void) |
Sees if the server supports what this class needs to send fast. | |
bool | isAvailableSlow (void) |
Sees if the server supports what this class needs to send slowly. | |
bool | isWaitingForReturn (void) |
If we're waiting for completion now. | |
bool | putFileToDirectory (const char *directory, const char *fileName, const char *clientFileName, SendSpeed sendSpeed=SPEED_AUTO) |
Get the file from a directory. | |
void | remFileSentCallback (ArFunctor1< int > *functor) |
Removes a callback for when we get the desired file (or fail). | |
virtual | ~ArClientFileFromClient () |
Destructor. | |
Protected Member Functions | |
void | callFileSentCallbacks (int val) |
void | netPutFile (ArNetPacket *packet) |
Protected Attributes | |
ArMutex | myCallbackMutex |
ArClientBase * | myClient |
std::string | myClientFileName |
std::string | myCommandName |
ArMutex | myDataMutex |
std::string | myDirectory |
FILE * | myFile |
std::string | myFileName |
std::list< ArFunctor1< int > * > | myFileSentCallbacks |
bool | myInterleaved |
bool | myIsWaitingForReturn |
ArTime | myLastCompletedSend |
ArTime | myLastStartedSend |
ArFunctor1C< ArClientFileFromClient, ArNetPacket * > | myPutFileCB |
bool | myReadyForNextPacket |
std::string | myWholeFileName |
If you want to find out what files are on the server use ArClientFileLister.
When get a file it doesn't happen right away, but when the file is received (or failes) the fileGotten callbacks will be called, 0 as the int for the callback means everything is good, positive error messages are from the server (0 = good (got file), 1 = getting file, 2 = tried to go outside allowed area, 3 = bad directory, 4 = empty file name (or other problem with fileName), 5 = can't write temp file, 6 = error moving file from temp to perm, 7 = another client putting file, 8 = timeout (no activity for 15 seconds) and another client wanted to put the file, 9 = client adding to, finishing, or canceling a file the server doesn't have), negative would be from this class but there aren't any of those yet
Definition at line 228 of file ArClientFileUtils.h.
|
Enum that describes the speed to send at.
Definition at line 242 of file ArClientFileUtils.h. |
|
Constructor.
Definition at line 556 of file ArClientFileUtils.cpp. References ArClientBase::addHandler(), client, myClient, myFile, myIsWaitingForReturn, and myPutFileCB. |
|
Destructor.
Definition at line 566 of file ArClientFileUtils.cpp. |
|
Adds a callback for when we get the desired file (or fail).
Definition at line 827 of file ArClientFileUtils.cpp. References ArMutex::lock(), ArLog::log(), myCallbackMutex, myFileSentCallbacks, and ArMutex::unlock(). |
|
Definition at line 849 of file ArClientFileUtils.cpp. References ArMutex::lock(), myCallbackMutex, myFileSentCallbacks, and ArMutex::unlock(). Referenced by netPutFile(). |
|
Cancels getting a file.
Definition at line 885 of file ArClientFileUtils.cpp. References ArMutex::lock(), myClient, myCommandName, myDataMutex, myIsWaitingForReturn, myWholeFileName, ArClientBase::requestOnce(), ArBasePacket::strToBuf(), ArBasePacket::uByte2ToBuf(), and ArMutex::unlock(). |
|
Gets the filename we're taking from the client.
Definition at line 876 of file ArClientFileUtils.cpp. References ArMutex::lock(), myClientFileName, myDataMutex, and ArMutex::unlock(). |
|
Gets the directory we're putting to.
Definition at line 858 of file ArClientFileUtils.cpp. References ArMutex::lock(), myDataMutex, myDirectory, and ArMutex::unlock(). |
|
Gets the filename we're putting.
Definition at line 867 of file ArClientFileUtils.cpp. References ArMutex::lock(), myDataMutex, myFileName, and ArMutex::unlock(). |
|
Gets the last time we finished putting a file.
Definition at line 910 of file ArClientFileUtils.cpp. References ArMutex::lock(), myDataMutex, myLastCompletedSend, and ArMutex::unlock(). |
|
Gets the last time we started putting a file.
Definition at line 919 of file ArClientFileUtils.cpp. References ArMutex::lock(), myDataMutex, myLastStartedSend, and ArMutex::unlock(). |
|
Sees if the server supports what this class needs.
Definition at line 571 of file ArClientFileUtils.cpp. References ArClientBase::dataExists(), and myClient. |
|
Sees if the server supports what this class needs to send fast.
Definition at line 582 of file ArClientFileUtils.cpp. References ArClientBase::dataExists(), and myClient. |
|
Sees if the server supports what this class needs to send slowly.
Definition at line 577 of file ArClientFileUtils.cpp. References ArClientBase::dataExists(), and myClient. |
|
If we're waiting for completion now.
Definition at line 901 of file ArClientFileUtils.cpp. References ArMutex::lock(), myDataMutex, myIsWaitingForReturn, and ArMutex::unlock(). |
|
Definition at line 797 of file ArClientFileUtils.cpp. References callFileSentCallbacks(), done, ArMutex::lock(), myDataMutex, myInterleaved, myIsWaitingForReturn, myReadyForNextPacket, and ArMutex::unlock(). |
|
Get the file from a directory.
Definition at line 587 of file ArClientFileUtils.cpp. References ArUtil::appendSlash(), ArClientBase::dataExists(), ArBasePacket::dataToBuf(), ArNetPacket::empty(), file, ArUtil::fixSlashes(), ArMutex::lock(), ArLog::log(), myClient, myClientFileName, myCommandName, myDataMutex, myDirectory, myFileName, myInterleaved, myIsWaitingForReturn, myLastStartedSend, myReadyForNextPacket, myWholeFileName, ArClientBase::requestOnce(), ArTime::secSince(), ArTime::setToNow(), ArUtil::sleep(), SPEED_AUTO, SPEED_FAST, SPEED_SLOW, ArBasePacket::strToBuf(), ArBasePacket::uByte2ToBuf(), ArBasePacket::uByte4ToBuf(), and ArMutex::unlock(). |
|
Removes a callback for when we get the desired file (or fail).
Definition at line 841 of file ArClientFileUtils.cpp. References ArMutex::lock(), myCallbackMutex, myFileSentCallbacks, and ArMutex::unlock(). |
|
Definition at line 276 of file ArClientFileUtils.h. Referenced by addFileSentCallback(), callFileSentCallbacks(), and remFileSentCallback(). |
|
Definition at line 277 of file ArClientFileUtils.h. Referenced by ArClientFileFromClient(), cancelPut(), isAvailable(), isAvailableFast(), isAvailableSlow(), and putFileToDirectory(). |
|
Definition at line 284 of file ArClientFileUtils.h. Referenced by getClientFileName(), and putFileToDirectory(). |
|
Definition at line 280 of file ArClientFileUtils.h. Referenced by cancelPut(), and putFileToDirectory(). |
|
Definition at line 275 of file ArClientFileUtils.h. Referenced by cancelPut(), getClientFileName(), getDirectory(), getFileName(), getLastCompletedSend(), getLastStartedSend(), isWaitingForReturn(), netPutFile(), and putFileToDirectory(). |
|
Definition at line 281 of file ArClientFileUtils.h. Referenced by getDirectory(), and putFileToDirectory(). |
|
Definition at line 287 of file ArClientFileUtils.h. Referenced by ArClientFileFromClient(). |
|
Definition at line 282 of file ArClientFileUtils.h. Referenced by getFileName(), and putFileToDirectory(). |
|
Definition at line 290 of file ArClientFileUtils.h. Referenced by addFileSentCallback(), callFileSentCallbacks(), and remFileSentCallback(). |
|
Definition at line 279 of file ArClientFileUtils.h. Referenced by netPutFile(), and putFileToDirectory(). |
|
Definition at line 278 of file ArClientFileUtils.h. Referenced by ArClientFileFromClient(), cancelPut(), isWaitingForReturn(), netPutFile(), and putFileToDirectory(). |
|
Definition at line 289 of file ArClientFileUtils.h. Referenced by getLastCompletedSend(). |
|
Definition at line 288 of file ArClientFileUtils.h. Referenced by getLastStartedSend(), and putFileToDirectory(). |
|
Definition at line 291 of file ArClientFileUtils.h. Referenced by ArClientFileFromClient(). |
|
Definition at line 286 of file ArClientFileUtils.h. Referenced by netPutFile(), and putFileToDirectory(). |
|
Definition at line 283 of file ArClientFileUtils.h. Referenced by cancelPut(), and putFileToDirectory(). |