00001
00034 #include "linden_common.h"
00035 #include "lliopipe.h"
00036
00037 #include "llpumpio.h"
00038
00039 static const std::string STATUS_SUCCESS_NAMES[LLIOPipe::STATUS_SUCCESS_COUNT] =
00040 {
00041 std::string("STATUS_OK"),
00042 std::string("STATUS_STOP"),
00043 std::string("STATUS_DONE"),
00044 std::string("STATUS_BREAK"),
00045 std::string("STATUS_NEED_PROCESS"),
00046 };
00047
00048 static const std::string STATUS_ERROR_NAMES[LLIOPipe::STATUS_ERROR_COUNT] =
00049 {
00050 std::string("STATUS_ERROR"),
00051 std::string("STATUS_NOT_IMPLEMENTED"),
00052 std::string("STATUS_PRECONDITION_NOT_MET"),
00053 std::string("STATUS_NO_CONNECTION"),
00054 std::string("STATUS_LOST_CONNECTION"),
00055 std::string("STATUS_EXPIRED"),
00056 };
00057
00058
00059 const char *gPumpFile = "";
00060 S32 gPumpLine = 0;
00061
00062 void pump_debug(const char *file, S32 line)
00063 {
00064 gPumpFile = file;
00065 gPumpLine = line;
00066 }
00067
00071 LLIOPipe::LLIOPipe() :
00072 mReferenceCount(0)
00073 {
00074 }
00075
00076 LLIOPipe::~LLIOPipe()
00077 {
00078
00079 }
00080
00081
00082 std::string LLIOPipe::lookupStatusString(EStatus status)
00083 {
00084 if((status >= 0) && (status < STATUS_SUCCESS_COUNT))
00085 {
00086 return STATUS_SUCCESS_NAMES[status];
00087 }
00088 else
00089 {
00090 S32 error_code = ((S32)status * -1) - 1;
00091 if(error_code < STATUS_ERROR_COUNT)
00092 {
00093 return STATUS_ERROR_NAMES[error_code];
00094 }
00095 }
00096 std::string rv;
00097 return rv;
00098 }
00099
00100 LLIOPipe::EStatus LLIOPipe::process(
00101 const LLChannelDescriptors& channels,
00102 buffer_ptr_t& buffer,
00103 bool& eos,
00104 LLSD& context,
00105 LLPumpIO* pump)
00106 {
00107 return process_impl(channels, buffer, eos, context, pump);
00108 }
00109
00110
00111 LLIOPipe::EStatus LLIOPipe::handleError(
00112 LLIOPipe::EStatus status,
00113 LLPumpIO* pump)
00114 {
00115
00116 return status;
00117 }