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_EXPIRED"),
00055 };
00056
00057
00058 const char *gPumpFile = "";
00059 S32 gPumpLine = 0;
00060
00061 void pump_debug(const char *file, S32 line)
00062 {
00063 gPumpFile = file;
00064 gPumpLine = line;
00065 }
00066
00070 LLIOPipe::LLIOPipe() :
00071 mReferenceCount(0)
00072 {
00073 }
00074
00075 LLIOPipe::~LLIOPipe()
00076 {
00077
00078 }
00079
00080
00081 std::string LLIOPipe::lookupStatusString(EStatus status)
00082 {
00083 if((status >= 0) && (status < STATUS_SUCCESS_COUNT))
00084 {
00085 return STATUS_SUCCESS_NAMES[status];
00086 }
00087 else
00088 {
00089 S32 error_code = ((S32)status * -1) - 1;
00090 if(error_code < STATUS_ERROR_COUNT)
00091 {
00092 return STATUS_ERROR_NAMES[error_code];
00093 }
00094 }
00095 std::string rv;
00096 return rv;
00097 }
00098
00099 LLIOPipe::EStatus LLIOPipe::process(
00100 const LLChannelDescriptors& channels,
00101 buffer_ptr_t& buffer,
00102 bool& eos,
00103 LLSD& context,
00104 LLPumpIO* pump)
00105 {
00106 return process_impl(channels, buffer, eos, context, pump);
00107 }
00108
00109
00110 LLIOPipe::EStatus LLIOPipe::handleError(
00111 LLIOPipe::EStatus status,
00112 LLPumpIO* pump)
00113 {
00114
00115 return status;
00116 }