00001 /* 00002 * Copyright (C) 2009, Edmundo Albuquerque de Souza e Silva. 00003 * 00004 * This file may be distributed under the terms of the Q Public License 00005 * as defined by Trolltech AS of Norway and appearing in the file 00006 * LICENSE.QPL included in the packaging of this file. 00007 * 00008 * THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING 00009 * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00010 * PURPOSE. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, 00011 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 00012 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 00013 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 00014 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00015 * 00016 * Thanks: Jose Renato Santos 00017 * 00018 */ 00019 00020 ///////////////////////////////////////////////////////////////////////////// 00021 // RioError.h: Error codes for RIO 00022 ///////////////////////////////////////////////////////////////////////////// 00023 00024 #include <string> 00025 #include <ctime> 00026 #include <iostream> 00027 #include <sstream> 00028 00029 using namespace std; 00030 00031 #ifndef __RIOERROR_H_ 00032 #define __RIOERROR_H_ 00033 00034 #define ERROR_RIO 0xE0040000 00035 00036 #define ERROR_NO_RIO_ERROR 0x0000 00037 #define ERROR_STORAGEDEVICE ERROR_RIO + 0x2000 00038 #define ERROR_STORAGEMANAGER ERROR_RIO + 0x2100 00039 #define ERROR_STORAGESERVER ERROR_RIO + 0x2200 00040 #define ERROR_REQUEST ERROR_RIO + 0x2300 00041 #define ERROR_REQUESTQUEUE ERROR_RIO + 0x2400 00042 #define ERROR_NETWORKMANAGER ERROR_RIO + 0x2500 00043 #define ERROR_ROUTER ERROR_RIO + 0x2600 00044 #define ERROR_SYSTEMMANAGER ERROR_RIO + 0x2700 00045 #define ERROR_CONNECTIONMANAGER ERROR_RIO + 0x2800 00046 #define ERROR_PLCONNECTIONMANAGER ERROR_RIO + 0x2900 00047 #define ERROR_SESSIONMANAGER ERROR_RIO + 0x2A00 00048 #define ERROR_PLSESSIONMANAGER ERROR_RIO + 0x2B00 00049 #define ERROR_STREAMMANAGER ERROR_RIO + 0x2C00 00050 #define ERROR_OBJECTMANAGER ERROR_RIO + 0x2D00 00051 #define ERROR_BUFFERMANAGER ERROR_RIO + 0x2E00 00052 #define ERROR_USERMANAGER ERROR_RIO + 0x2F00 00053 #define ERROR_DISKMGR ERROR_RIO + 0x3000 00054 #define ERROR_BITMAP ERROR_RIO + 0x4000 00055 #define ERROR_CLIENT ERROR_RIO + 0x5000 00056 #define ERROR_RIOTCP ERROR_RIO + 0x5100 00057 #define ERROR_RIOPROXY ERROR_RIO + 0x5200 00058 #define ERROR_RIOSESSION ERROR_RIO + 0x5300 00059 #define ERROR_RIOSTREAM ERROR_RIO + 0x5400 00060 #define ERROR_RIOOBJECT ERROR_RIO + 0x5500 00061 #define ERROR_NETMGR ERROR_RIO + 0x6000 00062 #define ERROR_RIONETI ERROR_RIO + 0x6100 00063 #define ERROR_EVENT ERROR_RIO + 0x6200 00064 #define ERROR_STREAMPOLICING ERROR_RIO + 0x6300 00065 // Novo erro para a classe de controle de fluxo (StreamControl). 00066 #define ERROR_STREAMCONTROL ERROR_RIO + 0x6400 00067 // Novo erro para a classe de log (CLogRotate). 00068 #define ERROR_LOGROTATION ERROR_RIO + 0x6500 00069 // Novo erro para a classe de busca nos logs (CSearchLogs). 00070 #define ERROR_SEARCHLOGS ERROR_RIO + 0x6600 00071 // Novo erro para a classe usada pelo modulo do apache. 00072 #define ERROR_RIOMODULE ERROR_RIO + 0x6700 00073 // Novo erro para a nova classe de gerenciamento da classe de rede (a classe 00074 // CNetInterface). 00075 #define ERROR_NETINTERFACE ERROR_RIO + 0x6800 00076 // Novo erro para a nova classe de rede CNETTCP. 00077 #define ERROR_NETTCP ERROR_RIO + 0x6900 00078 // Novo erro para a nova classe de rede CNETUDP. 00079 #define ERROR_NETUDP ERROR_RIO + 0x6A00 00080 // Novo erro para a classe de gerenciamento de streams do TCP (implementacao 00081 // antiga da nova versao do TCP, sem threads distintas para cada conexao). 00082 #define ERROR_TCPSTREAMS ERROR_RIO + 0x6B00 00083 // Novo erro para a classe de gerenciamentos das transferencias. 00084 #define ERROR_TRANSFERINFO ERROR_RIO + 0x6C00 00085 // Novo erro para a nova classe de gerenciamento de uma conexao TCP. 00086 #define ERROR_TCPCONNECTION ERROR_RIO + 0x6D00 00087 // Novo erro para a nova classe para salvar os logs de comportamento do cliente 00088 // pelo modulo (parte "servidora", que recebe as linhas de log pelo socket UDP 00089 // e as coloca no log. 00090 #define ERROR_SERVERUSERLOGS ERROR_RIO + 0x6E00 00091 // Novo erro para a nova classe para salvar os logs de comportamento do cliente 00092 // pelo modulo (parte "cliente", que envia as linhas de log pelo socket UDP 00093 // para serem salvas). 00094 #define ERROR_CLIENTUSERLOGS ERROR_RIO + 0x6F00 00095 // Novo erro para a nova classe usada para fazer a interface com o servidor RIO. 00096 // Esta classe, alem de enviar e receber arquivos pela conexao TCP, ira tambem 00097 // executar comandos do riosh. 00098 #define ERROR_SERVERINTERFACE ERROR_RIO + 0x7000 00099 00100 // User Errors 00101 //No error. Return with succes. 00102 const unsigned int ERROR_NO_USER_ERROR = 0x00; 00103 // Tried to initialize component already initialized 00104 const unsigned int ERROR_INITIALIZED = 0x01; 00105 // Component not initialized 00106 const unsigned int ERROR_NOT_INITIALIZED = 0x02; 00107 // Tried to start component already started 00108 const unsigned int ERROR_STARTED = 0x03; 00109 // Component not started 00110 const unsigned int ERROR_NOT_STARTED = 0x04; 00111 // Can not perform operation because there are active streams 00112 const unsigned int ERROR_STREAM_ACTIVE = 0x05; 00113 00114 // Invalid request type 00115 const unsigned int ERROR_REQUEST_TYPE = 0x20; 00116 // Invalid stream id 00117 const unsigned int ERROR_INVALID_STREAM = 0x21; 00118 // Invalid parameter 00119 const unsigned int ERROR_INVALID_PARAM = 0x22; 00120 // Invalid disk operation 00121 #ifdef __Rio_Win 00122 // Windows implementation 00123 #else 00124 // Linux implementation 00125 const unsigned int ERROR_INVALID_OPERATION = 0x23; 00126 #endif 00127 /* -------------------------------------------------- */ 00128 // Invalid physical block 00129 const unsigned int ERROR_INVALID_PHYSICAL_BLOCK = 0x24; 00130 // Exceeded maximum number of sessions 00131 const unsigned int ERROR_MAX_SESSIONS = 0x25; 00132 // Invalid session id 00133 const unsigned int ERROR_INVALID_SESSION = 0x26; 00134 // Exceeded maximum number of sessions 00135 const unsigned int ERROR_MAX_STREAMS = 0x27; 00136 // Not enough resources are avaiable for supporting new stream 00137 const unsigned int ERROR_STREAM_REFUSED = 0x28; 00138 // Invalid traffic type 00139 const unsigned int ERROR_INVALID_TRAFFIC = 0x29; 00140 // Invalid block size 00141 const unsigned int ERROR_INVALID_BLOCKSIZE = 0x2A; 00142 // Invalid stream direction 00143 const unsigned int ERROR_INVALID_DIRECTION = 0x2B; 00144 // Invalid object access mode (or conflict with stream direction) 00145 const unsigned int ERROR_INVALID_ACCESS_TYPE = 0x2C; 00146 // Disk full 00147 const unsigned int ERROR_DISKFULL = 0x2D; 00148 // Object path name is too large 00149 const unsigned int ERROR_LARGE_NAME = 0x2E; 00150 // The type of object is invalid 00151 const unsigned int ERROR_INVALID_OBJECT_TYPE = 0x2F; 00152 // Tryed to create object that already exists 00153 const unsigned int ERROR_OBJECT_EXISTS = 0x30; 00154 // Object does not exist 00155 const unsigned int ERROR_INVALID_OBJECTNAME = 0x31; 00156 // Could not open object (System error) 00157 const unsigned int ERROR_OBJECT_OPEN_FAILED = 0x32; 00158 // Could not open object (System error) 00159 const unsigned int ERROR_OBJECT_REMOVE_FAILED = 0x33; 00160 // Exceeded maximum number of opened objects 00161 const unsigned int ERROR_MAX_OPENED_OBJECTS = 0x34; 00162 // Invalid object handle 00163 const unsigned int ERROR_INVALID_OBJECT_HANDLE = 0x35; 00164 // Invalid object handle 00165 const unsigned int ERROR_INVALID_LOGICAL_BLOCK = 0x36; 00166 // Can not execute operation without exclusive access to object 00167 const unsigned int ERROR_NOT_EXCLUSIVE_ACCESS = 0x37; 00168 // Tried to make connection on already connected socket 00169 const unsigned int ERROR_CONNECTED = 0x38; 00170 // Connection is not open 00171 const unsigned int ERROR_NOTCONNECTED = 0x39; 00172 // Method requires connection on client mode 00173 const unsigned int ERROR_NOT_CLIENT = 0x3A; 00174 // Method requires connection on server mode 00175 const unsigned int ERROR_NOT_SERVER = 0x3B; 00176 // Can not perform this operation on a directory object 00177 const unsigned int ERROR_OBJECT_IS_DIRECTORY = 0x3C; 00178 // Specified object is not a directory 00179 const unsigned int ERROR_OBJECT_NOT_DIRECTORY = 0x3D; 00180 // Buffer is to small to hold object name 00181 const unsigned int ERROR_NAMEBUFFER_OVERFLOW = 0x3E; 00182 // There are no more objects on directory 00183 const unsigned int ERROR_NO_MORE_OBJECTS = 0x3F; 00184 // Error detected while reading directory 00185 const unsigned int ERROR_DIRECTORY_READ_FAILED = 0x40; 00186 // Directory does not exist 00187 const unsigned int ERROR_INVALID_DIRECTORYNAME = 0x41; 00188 // Invalid block 00189 #ifdef __Rio_Win 00190 // Windows implementation 00191 #else 00192 // Linux implementation 00193 const unsigned int ERROR_INVALID_BLOCK = 0x42; 00194 #endif 00195 /* --------------------------------------------------- */ 00196 // Too many data requests for a given stream 00197 const unsigned int ERROR_MAX_STREAM_REQUESTS = 0x43; 00198 00199 // Tryed to open a session using a handle already in use 00200 const unsigned int ERROR_SESSION_ALREADY_OPENED = 0x4F; 00201 // Object is not open 00202 const unsigned int ERROR_SESSION_NOT_OPENED = 0x50; 00203 // Tryed to open a stream using a handle already in use 00204 const unsigned int ERROR_STREAM_ALREADY_OPENED = 0x51; 00205 // Stream is not open 00206 const unsigned int ERROR_STREAM_NOT_OPENED = 0x52; 00207 // CAC Stream is not open 00208 const unsigned int ERROR_CAC_STREAM_NOT_OPENED = 0x53; 00209 // Tryed to open an object using a handle already in use 00210 const unsigned int ERROR_OBJECT_ALREADY_OPENED = 0x54; 00211 // Object is not open 00212 const unsigned int ERROR_OBJECT_NOT_OPENED = 0x55; 00213 00214 // Invalid User/Password (Failed to authenticate user) 00215 const unsigned int ERROR_INVALID_USER = 0x56; 00216 00217 // Object name too LARGE 00218 const unsigned int ERROR_PATHNAME_TOOLARGE = 0x57; 00219 // Object name bad syntax 00220 const unsigned int ERROR_PATHNAME_BADSYNTAX = 0x58; 00221 // Directory does not exist 00222 const unsigned int ERROR_NOT_DIRECTORY = 0x59; 00223 00224 // Novo erro para dar suporte ao reinicio dos servidores de armazenamento. O 00225 // erro e para informar aos clientes que, quando o numero de servidores nao 00226 // for suficiente para tratar um pedido nao e suficiente. 00227 const unsigned int ERROR_SERVICE_TEMPORARY_UNAVAILABLE = 0x5A; 00228 00229 // Novo erro para indicar que nao foi possivel ler o arquivo que armazena os 00230 // blocos a serem liberados de um servidor de armazenamento 00231 const unsigned int ERROR_OPEN_FREEBLOCKS_FILE = 0x5B; 00232 // Novo erro usado para indicar que um nome de objeto nao foi definido (usado 00233 // pelo modulo do apache. 00234 const unsigned int ERROR_OBJECT_NOT_DEFINED = 0x5C; 00235 // Novo erro usado para indicar que nenhum nome foi definido para um servidor. 00236 const unsigned int ERROR_SERVER_NOT_DEFINED = 0x5D; 00237 // Novo erro usado para indicar que um nome incorreto foi passado ao modulo 00238 // (diferente dos nomes usados para o redirecionamento e o envio dos arquivos), 00239 // ou que a redirecao foi usada quando o cliente envia um arquivo ao servidor. 00240 const unsigned int ERROR_INVALID_MODULE_POLICY = 0x5E; 00241 // Novo erro usado para indicar que o metodo usado pelo pedido nao e uma conexao 00242 // segura (https). 00243 const unsigned int ERROR_HTTPS_REQUIRED = 0x5F; 00244 // Novo erro para indicar que um usuario ja existe. 00245 const unsigned int ERROR_USER_EXISTS = 0x60; 00246 // Novo erro para indicar que existe um erro com o diretorio do usuario. 00247 const unsigned int ERROR_INVALID_USER_DIRECTORY = 0x61; 00248 // Novo erro para indicar que ocorreu um erro ao ler o arquivo com os usuarios e 00249 // as senhas. 00250 const unsigned int ERROR_RIOPASSWORD_FILE = 0x62; 00251 00252 00253 // System Errors 00254 00255 // Unexpected error (Software bug) 00256 const unsigned int ERROR_UNEXPECTED = 0x80; 00257 // Failed to get geometry information 00258 const unsigned int ERROR_DISK_GEOMETRY = 0x81; 00259 // Failed to do logical seek on disk device 00260 const unsigned int ERROR_DISK_SEEK = 0x82; 00261 // Failed to write on disk device 00262 const unsigned int ERROR_DISK_WRITE = 0x83; 00263 // Failed to read from disk device 00264 const unsigned int ERROR_DISK_READ = 0x84; 00265 // Failed to create event 00266 const unsigned int ERROR_CREATE_EVENT = 0x85; 00267 // Failed to set event 00268 const unsigned int ERROR_SET_EVENT = 0x86; 00269 // Failed to reset event 00270 const unsigned int ERROR_RESET_EVENT = 0x87; 00271 // Failed to wait event 00272 const unsigned int ERROR_WAIT_EVENT = 0x88; 00273 // Failed to create thread 00274 const unsigned int ERROR_CREATE_THREAD = 0x89; 00275 // Failed to wait thread termination 00276 const unsigned int ERROR_WAIT_THREAD = 0x8A; 00277 // Failed to set thread attributes 00278 const unsigned int ERROR_THREAD_ATTRIB = 0x8B; 00279 // Failed to create mutex 00280 const unsigned int ERROR_CREATE_MUTEX = 0x8C; 00281 // Failed to wait on mutex 00282 const unsigned int ERROR_WAIT_MUTEX = 0x8D; 00283 // Failed to release mutex 00284 const unsigned int ERROR_RELEASE_MUTEX = 0x8E; 00285 // Failed to create semaphore 00286 const unsigned int ERROR_CREATE_SEMAPHORE = 0x8F; 00287 00288 00289 // Failed to create component instance 00290 const unsigned int ERROR_CREATE_INSTANCE = 0x90; 00291 // Failed to query component interface 00292 const unsigned int ERROR_QUERY_INTERFACE = 0x91; 00293 // Failed to allocate memory 00294 const unsigned int ERROR_MEMORY = 0x92; 00295 // System metadata corrupted 00296 const unsigned int ERROR_METADATA_CORRUPTED = 0x93; 00297 // Failed to write object metadata 00298 const unsigned int ERROR_OBJECT_METADATA_WRITE = 0x94; 00299 // Failed to read object metadata 00300 const unsigned int ERROR_OBJECT_METADATA_CORRUPTED = 0x95; 00301 00302 // Failed to open disk device 00303 const unsigned int ERROR_DISK_OPEN = 0x96; 00304 // Could not set specified system configuration 00305 const unsigned int ERROR_SYSTEM_CONFIGURATION = 0x97; 00306 00307 // Failed to start socket library 00308 const unsigned int ERROR_SOCKET_LIBRARY = 0x98; 00309 // Failed to create socket 00310 const unsigned int ERROR_SOCKET_CREATE = 0x99; 00311 // Failed to bind socket to port 00312 const unsigned int ERROR_SOCKET_BIND = 0x9A; 00313 // Failed to listen to socket 00314 const unsigned int ERROR_SOCKET_LISTEN = 0x9B; 00315 // Failed to receive data on socket 00316 const unsigned int ERROR_SOCKET_RECEIVE = 0x9C; 00317 // Failed to make socket connection 00318 const unsigned int ERROR_SOCKET_CONNECT = 0x9D; 00319 // Failed to accept socket connection 00320 const unsigned int ERROR_SOCKET_ACCEPT = 0x9E; 00321 // Failed to get local host name 00322 const unsigned int ERROR_LOCALHOSTNAME = 0x9F; 00323 // Failed to get host by name (gethostbyname()) 00324 const unsigned int ERROR_HOSTBYNAME = 0xA0; 00325 // Could not find host machine network address 00326 const unsigned int ERROR_HOST_NOTFOUND = 0xA1; 00327 // Failed to send data through socket 00328 const unsigned int ERROR_SOCKET_SEND = 0xA2; 00329 // Server refused connection 00330 const unsigned int ERROR_SOCKET_REFUSED_CONNECTION = 0xA3; 00331 // Error on RIO logical protocol between client and server (UNEXPECTED) 00332 const unsigned int ERROR_RIO_PROTOCOL = 0xA4; 00333 // Rio protocol version mismatch between server and client 00334 const unsigned int ERROR_INVALID_VERSION = 0xA5; 00335 00336 // Tryed to access invalid disk (software bug) 00337 const unsigned int ERROR_INVALID_DISK = 0xA6; 00338 // Tryed to access empty queue (software bug) 00339 const unsigned int ERROR_QUEUE_EMPTY = 0xA7; 00340 // Tryed to call class with invalid numeric code (software bug) 00341 const unsigned int ERROR_INVALID_CLASS = 0xA8; 00342 // Tryed to call class method with invalid parameter (software bug) 00343 const unsigned int ERROR_INVALID_METHOD_PARAM = 0xA9; 00344 // Tryed to call invalid class method (software bug) 00345 const unsigned int ERROR_INVALID_METHOD = 0xAA; 00346 // Send call result exceeded maximum message size (software bug) 00347 const unsigned int ERROR_RESULT_MESSAGE_OVERFLOW = 0xAB; 00348 // Setting connection to storage nodes specified number of storage nodes greater than maximum (software bug) 00349 const unsigned int ERROR_MAX_STORAGE_NODES = 0xAC; 00350 // Data in message has format errors (software bug) 00351 const unsigned int ERROR_MESSAGE_DATA_FORMAT = 0xAD; 00352 // Send method call message exceeded maximum message size (software bug) 00353 const unsigned int ERROR_CALL_MESSAGE_OVERFLOW = 0xAE; 00354 // Referenced Invalid Buffer (software bug) 00355 const unsigned int ERROR_INVALID_BUFFER = 0xAF; 00356 00357 // Failed to set socket options 00358 const unsigned int ERROR_SOCKET_OPTIONS = 0xB0; 00359 00360 // Novo erro usado pelas classes derivadas da CNet, para indicar que o socket 00361 // fechou devido a um timeout. 00362 const unsigned int ERROR_SOCKET_TIMEOUT = 0xB1; 00363 // Novo erro usado para indicar que ocorreu um erro ao executar o select. 00364 const unsigned int ERROR_SOCKETS_SELECT = 0xB2; 00365 // Novo erro usado para indicar que um recursos ainda nao foi implememtado. 00366 const unsigned int ERROR_NOT_IMPLEMENTED = 0xB3; 00367 // Novo erro usado para indicar que uma chamada a funcao ioctl falhou. 00368 const unsigned int ERROR_IOCTL_FAILED = 0xB4; 00369 // Novo erro usado para indicar que o socket foi fechado. 00370 const unsigned int ERROR_SOCKET_CLOSED = 0xB5; 00371 // Novo erro usado para indicar (as callbacks), que a classe de gerenciamento 00372 // de transferencias (CTransferInfo) foi removida. Este erro somente deveria 00373 // ser gerado quando o cliente ou um dos servidores for terminado. 00374 const unsigned int ERROR_PROCESS_TERMINATED = 0xB6; 00375 // Novo erro usado para indicar que um identificador invalido de uma 00376 // transferencia foi passado em uma mensagem. 00377 const unsigned int ERROR_INVALID_TRANSFERID = 0xB7; 00378 // Novo erro usado para indicar que o par IP, Porta de um Host nao e o correto 00379 // (o que esta indicado na estrutura associada a transferencia quando um dado 00380 // enviado/recebido foi processado). 00381 const unsigned int ERROR_INVALID_HOST = 0xB8; 00382 // Novo erro para indicar um erro critico no accept. 00383 const unsigned int ERROR_SOCKET_ACCEPT_CRITICAL = 0xB9; 00384 00385 // Novo erro usado para indicar que a opcao que define o comando nao foi usada 00386 // ao usarmos a opcao "exec.rio" do modulo. 00387 const unsigned int ERROR_COMMAND_NOT_DEFINED = 0xBA; 00388 // Novo erro usado para indicar que um comando invalido foi passado pela opcao 00389 // "exec.rio" do modulo. 00390 const unsigned int ERROR_INVALID_COMMAND = 0xBB; 00391 // Novo erro usado para indicar um erro de sintaxe em um dos comandos executados 00392 // pela opcao "exec.rio" do modulo. 00393 const unsigned int ERROR_COMMAND_SYNTAX = 0xBC; 00394 // Novo erro usado para indicar que a opcao que defineo identificador da sessao 00395 // nao foi usada ao usarmos a opcao "exec.rio" do modulo com um comando 00396 // diferente do login. 00397 const unsigned int ERROR_SESSIONID_NOT_DEFINED = 0xBD; 00398 // Novo erro usado para indicar que a opcao que define identificador da sessao 00399 // foi usada ao usarmos a opcao "exec.rio" do modulo com o comando login. 00400 const unsigned int ERROR_SESSIONID_ALREADY_DEFINED = 0xBE; 00401 // Novo erro usado para indicar que ocorreu algum erro durante a copia (erro ao 00402 // copiar o bloco de/para o servidor ou de/para o cliente). 00403 const unsigned int ERROR_COPYING_OBJECT = 0xBF; 00404 00405 // LogRotation Erros 00406 00407 // Failed to open a log 00408 const unsigned int ERROR_LOGFILE_OPEN_FAILED = 0xC0; 00409 // Failed to read a line of log 00410 const unsigned int ERROR_LOGFILE_READ_FAILED = 0xC1; 00411 // Failed to write a line of log 00412 const unsigned int ERROR_LOGFILE_WRITE_FAILED = 0xC2; 00413 // Failed to close a log 00414 const unsigned int ERROR_LOGFILE_CLOSE_FAILED = 0xC3; 00415 // Format error in one log line 00416 const unsigned int ERROR_LOGFILE_LINE_FORMAT = 0xC4; 00417 // Format error in name of the log file 00418 const unsigned int ERROR_LOGFILE_FILENAME_FORMAT = 0xC5; 00419 // Two or more uncompacted log file detected 00420 const unsigned int ERROR_LOGFILES_LIST = 0xC6; 00421 // Log line size too large 00422 const unsigned int ERROR_LOGLINE_TOOLARGE = 0xC7; 00423 // Failed to remove a log 00424 const unsigned int ERROR_LOGFILE_REMOVE_FAILED = 0xC8; 00425 // Failed to executa e search in logs. 00426 const unsigned int ERROR_LOGROTATION_SEARCH_FAILED = 0xC9; 00427 // Error when initializing LogRoration. 00428 const unsigned int ERROR_INITIALIZE_LOGROTATION = 0xD0; 00429 // Failed to create a name for a file with a result of a search. 00430 const unsigned int ERROR_CREATE_SEARCHRESULT_FILENAME = 0xD1; 00431 // Failed to open a file with a result of a search. 00432 const unsigned int ERROR_OPEN_SEARCHRESULT_FILE = 0xD2; 00433 // Failed to read from a file with a result of a search. 00434 const unsigned int ERROR_READ_SEARCHRESULT_FILE = 0xD3; 00435 // Invalid search result file identification. 00436 const unsigned int ERROR_INVALID_SEARCHRESULT_IDENTIFICATION = 0xD4; 00437 // failed to remove a search result file. 00438 const unsigned int ERROR_REMOVE_SEARCHRESULT_FILE = 0xD5; 00439 // Error when initializing SearchLogs. 00440 const unsigned int ERROR_INITIALIZE_SEARCHLOGS = 0xD6; 00441 // Invalid search type. 00442 const unsigned int ERROR_SEARCHLOGS_SEARCH_TYPE = 0xD7; 00443 // Invalid time interval. 00444 const unsigned int ERROR_SEARCHLOGS_TIME_INTERVAL = 0xD8; 00445 00446 // Outros erros relacionados aos logs. 00447 00448 // Erro usado pelo modulo quando a linha do log nao e definida nas opcoes da 00449 // opcao userlogs para salvar os logs de comportamento. 00450 const unsigned int ERROR_LOGLINE_NOT_DEFINED = 0xD9; 00451 00452 // Failed to open log file 00453 const unsigned int ERROR_LOGFILE = 0xF1; 00454 // Failed to create configuration file 00455 const unsigned int ERROR_CREATE_CONFIGFILE = 0xF2; 00456 // Failed to open configuration file 00457 const unsigned int ERROR_OPEN_CONFIGFILE = 0xF3; 00458 // Configuration file is corrupted 00459 const unsigned int ERROR_INVALID_CONFIGFILE = 0xF4; 00460 // Name for RIO root directory is too large 00461 const unsigned int ERROR_LARGE_ROOTNAME = 0xF5; 00462 // Failed to create RIO root directory 00463 const unsigned int ERROR_CREATE_ROOT = 0xF6; 00464 00465 // Client closed the connection tcp - added by Adriane ------------------------ 00466 const unsigned int ERROR_CLOSED_CONNECTION = 0xF7; 00467 // ---------------------------------------------------------------------------- 00468 const unsigned int ERROR_PERMISSION_DENIED = 0xF8; 00469 00470 // Novo erro usado para identificar que o servidor nao possui suporte a uma 00471 // nova chamada remota de procedimento usada para retornas os pares IP, porta 00472 // do Servidor RIO e dos Storage Servers. Usado pela implementacao para dar 00473 // suporte aos clientes atras de NAT. 00474 const unsigned int ERROR_NO_MAPPING = 0xF9; 00475 00476 // Mascara para obter somente o codigo de erro (criei esta constante para evitar 00477 // uma dependencia da posicao do erro no codigo de erro. 00478 const unsigned int ERROR_CODE_MASK = 0x000000FF; 00479 00480 string GetErrorDescription( const unsigned int ); 00481 // Funcao simular a perror, mas usando RioErr ao inves de cerr. 00482 /*** 00483 * Rioperror e uma versao (identica a perror), que usa RioErr ao inves de cerr 00484 * @param msg mensagen a ser impressa antes do erro - assim como o perror, a 00485 * saida sera "msg: erro". 00486 */ 00487 void Rioperror( const char * msg ); 00488 00489 class debugCerr 00490 { 00491 public: 00492 debugCerr(); 00493 // Definicoes das funcoes retiradas da classe cerr (no endereco: 00494 // http://www.cplusplus.com/reference/iostream/ostream/operator%3C%3C.html) 00495 /*** 00496 * Sobrecarga do operator<< utilizada para formatar linhas de debug; 00497 * @param s � a inst�ncia da classe debugCerr utilizada na formata��o. 00498 * @param data s�o os dados que ser�o enviados a cerr. 00499 */ 00500 debugCerr& operator<< ( bool val ); 00501 00502 debugCerr& operator<< ( short val ); 00503 debugCerr& operator<< ( unsigned short val ); 00504 debugCerr& operator<< ( int val ); 00505 debugCerr& operator<< ( unsigned int val ); 00506 debugCerr& operator<< ( long val ); 00507 debugCerr& operator<< ( unsigned long val ); 00508 debugCerr& operator<< ( long long int val ); 00509 debugCerr& operator<< ( unsigned long long int val ); 00510 debugCerr& operator<< ( float val ); 00511 debugCerr& operator<< ( double val ); 00512 debugCerr& operator<< ( long double val ); 00513 debugCerr& operator<< ( void* val ); 00514 00515 debugCerr& operator<< ( streambuf* sb ); 00516 00517 debugCerr& operator<< ( ostream& ( *pf ) ( ostream& ) ); 00518 debugCerr& operator<< ( ios& ( *pf ) ( ios& ) ); 00519 debugCerr& operator<< ( ios_base& ( *pf )( ios_base& ) ); 00520 }; 00521 00522 // Definicoes das funcoes retiradas da classe cerr (no endereco: 00523 // http://www.cplusplus.com/reference/iostream/ostream/operator%3C%3C.html) 00524 debugCerr& operator<< ( debugCerr& out, char c ); 00525 debugCerr& operator<< ( debugCerr& out, signed char c ); 00526 debugCerr& operator<< ( debugCerr& out, unsigned char c ); 00527 debugCerr& operator<< ( debugCerr& out, const char *s ); 00528 debugCerr& operator<< ( debugCerr& out, const signed char *s ); 00529 debugCerr& operator<< ( debugCerr& out, const unsigned char *s ); 00530 debugCerr& operator<< ( debugCerr& out, string s ); 00531 00532 extern debugCerr RioErr; 00533 00534 /*** 00535 * myInfo retorna o pid da thread e a hora atual. � usado nas mensagens de debug 00536 * ou dos logs do servidor, storage, PL e/ou clientes. 00537 * @param parseHour Informa se a hora deve ser convertida para o formato 00538 * HH:MM:SS ou se deve ser mantida no formado original (n�mero de segundos desde 00539 * a EPOCH. 00540 * @return retorna um const char * no formato [XXXXXX|YYYYYYY], onde XXXXXX � o 00541 * pid da therad atual e YYYYYYY � o n�mero de segundos deste a EPOCH, ou 00542 * [XXXXXX|HH:MM:SS], semelhante ao anterior, mas com a hora convertida para o 00543 * formato em quest�o. 00544 */ 00545 char *myInfo( bool parseHour = true ); 00546 00547 /*** 00548 * showtimenow pode ser usado para fins de debug. Funciona como as fun��es 00549 * "ping" e "pong" do matlag, isto �, quando se chama showtimenow ele diz 00550 * quantos microsegundos se passaram desde a ultima vez que ele foi executado. 00551 * Muito util pra se saber quanto tempo uma funcao, um comando ou um trecho de 00552 * codigo leva pra ser executado. 00553 * Exemplo de uso: 00554 * ... 00555 * showtimenow( "Antes do comando sleep" ); 00556 * sleep(3); 00557 * showtimenow( "Depois do comando sleep" ); 00558 * ... 00559 * Exibir� algo como 00560 * @param msg Mensagem meramente informativa que pode ser passada. 00561 */ 00562 void showtimenow( string msg ); 00563 00564 #endif // __RIOERROR_H_