Пример #1
0
int main( void ) 
{

	char buffer[50];

	u32bit latency, bandwidth;

	ifstream driverFile( "SignalDriverFile.txt" );

	driverFile >> bandwidth;
	driverFile >> latency;
	
	driverFile.getline( buffer, sizeof(buffer) ); // Saltamos el resto de la linea

	cout << "BANDWIDTH: " << bandwidth << endl;
	cout << "MAX LATENCY: " << latency << endl;

	Signal s( "Signal Test", bandwidth, latency );
	
	while ( !driverFile.eof() ) {		
		driverFile.getline( buffer, sizeof(buffer) );		
		executeOperation( s, buffer, sizeof(buffer) );		
	}
	
	driverFile.close();
		
	return 0;

}
Пример #2
0
	void launch(){
		RuntimeErrorValidator * validator = NULL;

		if(isInfoEnabled())
			info("Quedando a la espera de peticiones para realizar operaciones FSS");

		MpsMessage * request = NULL;

		while(isFssRunningStatus()){
			validator = buildErrorSuccessValidator();
			request = receiveMpsMessage(getFileSystemSocket(), validator);

			if(request == NULL || hasError(validator)){
				error("Se produjo un error en la recepcion, finalizando la aplicacion");
				close(getFileSystemSocket());
				exit(1);
			}

			if(isDebugEnabled())
				debug("Reciviendo peticion MPS");

			if(isDebugEnabled())
				debug(concatAll(3 , "Header.DescriptorId: '" , strndup(request->descriptorId , 16) , "'"));

			if(isDebugEnabled())
				debug( concatAll(3 , "Payload.Arguments: '" , formatListToPreetyString(request->commands) , "'"));

			if(isDebugEnabled())
				debug(concatAll(3 , "Payload.OperationName: '" , request->operationName , "'"));

			executeOperation(getFileSystemSocket() , request , validator);
		}

	}
Пример #3
0
void FileTransferCore::remoteFolderCreateOperation(FileInfo file, const TCHAR *pathToTargetRoot)
{
    m_state = MKDIR_STATE;

    executeOperation(new RemoteFolderCreateOperation(m_logWriter,
                                                     file,
                                                     pathToTargetRoot));
}
Пример #4
0
void FileTransferCore::remoteFilesDeleteOperation(const FileInfo *filesInfoToDelete,
                                                 size_t filesCount,
                                                 const TCHAR *pathToTargetRoot)
{
  m_state = REMOVE_STATE;
  executeOperation(new RemoteFilesDeleteOperation(m_logWriter,
                                                  filesInfoToDelete, filesCount,
                                                  pathToTargetRoot));
}
Пример #5
0
void FileTransferCore::localFilesDeleteOperation(const FileInfo *filesToDelete,
                                                 UINT32 filesCount,
                                                 const TCHAR *pathToTargetRoot)
{
  m_state = LOCAL_REMOVE_STATE;
  executeOperation(new LocalFilesDeleteOperation(m_logWriter,
                                                 filesToDelete, filesCount,
                                                 pathToTargetRoot));
}
Пример #6
0
void FileTransferCore::remoteFileRenameOperation(FileInfo sourceFileInfo,
                                                 FileInfo targetFileInfo,
                                                 const TCHAR *pathToTargetRoot)
{
  m_state = RENAME_STATE;

  executeOperation(new RemoteFileRenameOperation(m_logWriter,
                                                 sourceFileInfo,
                                                 targetFileInfo,
                                                 pathToTargetRoot));
}
Пример #7
0
	int main(void) {

		configure();

		//testFormat();
		//testCreate();
		//testCreatingBitVector();
		//testUpdateSize();
		//testGettingFileInformation();
		//testAddingSectors();
		//testListingFiles();
		//testFreeingSectors();
		//testGetCurrentSize();

		//testListImplementation();
		//testListImplementation2();

		if(isInfoEnabled())
			info("Conectando con modulo KSS");

		ListenSocket s = openClientConnection(getKssHost() , getKssPort());

		if(s == INVALID_SOCKET){
			error("no se puede abrir la coneccion");
			return EXIT_FAILURE;
		}

		if(isInfoEnabled())
			info("Quedando a la espera de peticiones para realizar operaciones FSS");

		RuntimeErrorValidator * validator ;
		MpsRequest * request = NULL;

		while(isFssRunningStatus()){
			validator = buildErrorSuccessValidator();
			request = receiveMpsRequest(s , validator);
			validator = buildErrorSuccessValidator();
			info("Reciviendo peticion MPS");

			if(isInfoEnabled())
				info(concatAll(3 , "Header.DescriptorId: '" , strndup(request->descriptorId , 16) , "'"));

			if(isInfoEnabled())
				info( concatAll(3 , "Payload.Arguments: '" , formatListToPreetyString(request->arguments) , "'"));

			if(isInfoEnabled())
				info(concatAll(3 , "Payload.OperationName: '" , request->operationName , "'"));

			executeOperation(s , request , validator);
		}

		return EXIT_SUCCESS;
	}
void TokenStreamRewriteEngine::toStream( std::ostream& out,
													  const std::string& programName,
													  size_t firstToken,
													  size_t lastToken ) const
{
	if( tokens.size() == 0 )
		return;

	program_map::const_iterator rewriter = programs.find(programName);

	if ( rewriter == programs.end() )
		return;

	// get the prog and some iterators in it...
	const operation_list& prog = rewriter->second;
	operation_list::const_iterator
		rewriteOpIndex = prog.begin(),
		rewriteOpEnd = prog.end();

	size_t tokenCursor = firstToken;
	// make sure we don't run out of the tokens we have...
	if( lastToken > (tokens.size() - 1) )
		lastToken = tokens.size() - 1;

		while ( tokenCursor <= lastToken )
		{
//			std::cout << "tokenCursor = " << tokenCursor << " first prog index = " << (*rewriteOpIndex)->getIndex() << std::endl;

			if( rewriteOpIndex != rewriteOpEnd )
			{
				size_t up_to_here = std::min(lastToken,(*rewriteOpIndex)->getIndex());
				while( tokenCursor < up_to_here )
					out << tokens[tokenCursor++]->getText();
			}
			while ( rewriteOpIndex != rewriteOpEnd &&
					  tokenCursor == (*rewriteOpIndex)->getIndex() &&
					  tokenCursor <= lastToken )
			{
				tokenCursor = (*rewriteOpIndex)->execute(out);
				++rewriteOpIndex;
			}
			if( tokenCursor <= lastToken )
				out << tokens[tokenCursor++]->getText();
		}
	// std::cout << "Handling tail operations # left = " << std::distance(rewriteOpIndex,rewriteOpEnd) << std::endl;
	// now see if there are operations (append) beyond last token index
	std::for_each( rewriteOpIndex, rewriteOpEnd, executeOperation(out) );
	rewriteOpIndex = rewriteOpEnd;
}
Пример #9
0
void FileTransferCore::uploadOperation(const FileInfo *filesToDownload,
                                       size_t filesCount,
                                       const TCHAR *pathToSourceRoot,
                                       const TCHAR *pathToTargetRoot)
{
  m_state = UPLOAD_STATE;

  UploadOperation *uOp = new UploadOperation(m_logWriter,
                                             filesToDownload,
                                             filesCount,
                                             pathToSourceRoot,
                                             pathToTargetRoot);
  uOp->setCopyProcessListener(this);
  executeOperation(uOp);
}
Пример #10
0
void OperationList::redoOperation(void)
{
	if(isRedoAvailable())
	{
		Operation *operation=NULL;
		bool chain_active=false;
		Exception error;
		unsigned chain_size=0, pos=0;

		if(!this->signalsBlocked())
			chain_size=getChainSize();

		do
		{
			//Gets the current operation
			operation=operations[current_index];

			/* If it is detected that the operation is chained with other
			and active chaining flag is cleared marks the flag to start
			the execution several operations at once */
			if(!ignore_chain && !chain_active &&
				 operation->chain_type!=Operation::NO_CHAIN)
				chain_active=true;

			/* If the chaining is active and the current operation is not part of
			chain or it is at the start of chain, aborts execution of the operation */
			else if(chain_active &&
							(operation->chain_type==Operation::CHAIN_START ||
							 operation->chain_type==Operation::NO_CHAIN))
				break;

			try
			{
				if(chain_size > 0)
				{
					//Emits a signal with the current progress of operation execution
					pos++;
					emit s_operationExecuted((pos/static_cast<float>(chain_size))*100,
																	 trUtf8("Redoing operation on object:: %1 (%2)")
																	 .arg(operation->pool_obj->getName())
																	 .arg(operation->pool_obj->getTypeName()),
																	 operation->pool_obj->getObjectType());
				}

				//Executes the redo operation (second argument as 'true')
				executeOperation(operation, true);
			}
			catch(Exception &e)
			{
				error=e;
			}
			current_index++;
		}
		/* Performs the operations while the current operation is part of chain
		 or the redo option is available */
		while(!ignore_chain && isRedoAvailable()  && operation->chain_type!=Operation::NO_CHAIN);

		if(error.getErrorType()!=ERR_CUSTOM)
			throw Exception(error.getErrorMessage(), error.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__);
	}
}
Пример #11
0
void FileTransferCore::remoteFileListOperation(const TCHAR *pathToFile)
{
  m_state = FILE_LIST_STATE;
  executeOperation(new RemoteFileListOperation(m_logWriter, pathToFile));
}