Beispiel #1
0
void CDownloads_History::OnForceUpdate()
{
	for (int i = 0; i < GetItemCount (); i++)
	{
		UpdateRecord (i);
	}
}
Beispiel #2
0
VSCDeviceIPC::VSCDeviceIPC(QTreeWidgetItem *parent, DeviceParam &pParam)
    : QTreeWidgetItem(parent)
{
	m_Param = pParam;
    UpdateOnline(FALSE);
	UpdateRecord(FALSE);
}
// updates an existing record with the data in the CRecord object
// use CRecord* ReadRecord(id) to read in the data, then modify it and call this func to update it
void	//** Thread Safe **
ADataStore::UpdateRecord(CRecord* inRecP) {
	ASSERT(inRecP != nil);	// еее pass by reference
	DB_DEBUG("UpdateRecord("<<inRecP->GetRecordID()<<")");
	AutoLockRecord lock(inRecP);	// automatically unlock the record as we exit this code block
	DatabaseRec* p = inRecP->GetRecordDataPtr();
	UpdateRecord(p);
}
Beispiel #4
0
	void CVLDatabase::SetFaceID(int index, const string &faceId)
	{
		CheckIndex(index);
		CopyFaceID(allItems[index]->faceId, allItems[index]->faceIdLength, faceId.c_str(), (DWORD) faceId.length());
		if (opened)
		{
			UpdateRecord(index);
		}
	}
Beispiel #5
0
DWORD WINAPI RecordUptimeThread(LPVOID param)
{
	bRecUpdated=FALSE;
	if (!noadvapi32) {
		while (1) {
			bRecUpdated=UpdateRecord();
			Sleep(RUPTIME_DELAY);
		}
	}
	ExitThread(0);
}
Beispiel #6
0
void TOrdEntryForm::UpdateIfModified()
{
  if (OrderWasModified()) {
    switch (RecState) {
      case rsEdit : UpdateRecord(); break;
      case rsNew  : AddRecord(); break;
    }
    OvcVirtualListbox1->Repaint();
    DataListIsModified = true;
  }
}
Beispiel #7
0
	void CVLDatabase::SetFeatures(int index, const void *features, DWORD size)
	{
		CheckIndex(index);
		heap.Free(allItems[index]->features);
		allItems[index]->features = heap.Alloc((DWORD)size);
		::memcpy(allItems[index]->features, features, size);
		allItems[index]->featuresSize = size;
		if (opened)
		{
			UpdateRecord(index);
		}
	}
Beispiel #8
0
void CDownloads_History::AddRecord(fsDLHistoryRecord *rec)
{
	m_mxAddDel.Lock ();

	
	int iItem = AddItem ("", GetSysColor (COLOR_WINDOW), GetSysColor (COLOR_WINDOWTEXT), 0, TRUE);

	SetItemData (iItem, (DWORD) rec);

	
	UpdateRecord (iItem);

	m_mxAddDel.Unlock ();
}
	// create or update a record for a specified key
	void Untyped::Put(Key aKey, const void *aValue)
	{
		// convert key to a slot
		// (HACK: assume key is already a hash)
		size_t slot = FindSlot(aKey);

		// if the slot is not empty...
		if (slot != EMPTY)
		{
			// update the record
			UpdateRecord(GetRecord(slot), aValue);
			return;
		}

		// grow if the database is full
		if (mCount >= mLimit)
			Grow();

		// add a new record
		void *record = AllocRecord(aKey);
		CreateRecord(record, aValue);
	}
// updates, or adds if doesn't already exist
RecIDT	//** Thread Safe **
ADataStore::WriteRecord(CRecord* inRecP) {
	ASSERT(inRecP != nil);	// еее pass by reference
	DB_DEBUG("WriteRecord("<<inRecP->GetRecordID()<<")");
	bool addIt = false;
	RecIDT id = inRecP->GetRecordID();
	AutoLockRecord lock(inRecP);	// automatically unlock the record as we exit this code block
	DatabaseRec* p = inRecP->GetRecordDataPtr();
	Try_{
		UpdateRecord(p);
	}
	Catch_(err) {
		if (err != dbItemNotFound) {
			Throw_(err);
		} else {
			addIt = true;
	    }
	}
	if (addIt) {
		id = AddRecord(p);
    }
	return id;
}
Beispiel #11
0
int main( void )
{
  FILE *FilePointer = OpenFile(FilePointer, 'w'); // Open file for writing
  Node* Head = malloc(sizeof(Node));

  BootStrapFile(FilePointer); // Create our base file
  fclose(FilePointer); // Close the file

  FilePointer = OpenFile(FilePointer, 'r'); // Reopen the file for reading
  ReadFile(FilePointer, Head); // Read file into linked lists
  PrintLinkedList( Head ); // Print the linked list
  fclose(FilePointer);
  FreeLinkedList(&Head);

  Head = (Node* )realloc(Head, sizeof(Node));
  FilePointer = OpenFile(FilePointer, 'r');
  ReadFile( FilePointer, Head );
  ManualEntry( Head );
  fclose(FilePointer);
  FilePointer = OpenFile(FilePointer, 'w'); // Reopen the file for reading

  WriteToFile( FilePointer, Head );
  fclose( FilePointer );
  FreeLinkedList( &Head );

  Head = (Node* )realloc(Head, sizeof(Node));
  FilePointer = OpenFile(FilePointer, 'r');
  ReadFile( FilePointer, Head );

  UpdateRecord( Head ); // Update record
  PrintLinkedList( Head );

  DeleteRecord( Head );
  PrintLinkedList( Head );

}
Beispiel #12
0
int clsEntityWorker::DoWithPaxosCmd(clsPaxosCmd *poPaxosCmd)
{
	int iRet;

	uint32_t iAcceptorID = poPaxosCmd->GetSrcAcceptorID();
	uint32_t iEntityID = poPaxosCmd->GetEntityID();
	uint32_t iEntry = poPaxosCmd->GetEntry();

	AssertNotEqual(iAcceptorID, m_iLocalAcceptorID);

	EntityInfo_t *ptEntityInfo = m_poEntityMng->GetEntityInfo(iEntityID);
	assert(ptEntityInfo != NULL);

	CertainLogDebug("iAcceptorID %u iEntityID %u iEntry %u iMaxChosenEntry %u",
			iAcceptorID, iEntityID, iEntry, ptEntityInfo->iMaxChosenEntry);

	if (ptEntityInfo->iMaxChosenEntry >= iEntry)
	{
		EntryInfo_t *ptInfo = m_poEntryMng->FindEntryInfo(iEntityID, iEntry);

		const EntryRecord_t &tRecord = poPaxosCmd->GetSrcRecord();

		// ptInfo == NULL means chosen, as ptInfo is cleanup once it's chosen.

		if (ptInfo == NULL)
		{
			if (tRecord.bChosen)
			{
				return 0;
			}

			clsPaxosCmd *po = new clsPaxosCmd(m_iLocalAcceptorID,
					iEntityID, iEntry);
			po->SetDestAcceptorID(iAcceptorID);
			po->SetForCatchUp(true);

			iRet = m_poPLogReqQueue->PushByOneThread(po);
			if (iRet != 0)
			{
				CertainLogError("PushByOneThread ret %d", iRet);
				delete po, po = NULL;

				return -1;
			}

			return 0;
		}

		CertainLogError("iEntityID %u iEntry %u iMaxChosenEntry %u",
				iEntityID, iEntry, ptEntityInfo->iMaxChosenEntry);
	}

	uint32_t iGlobalMaxChosenEntry = iEntry - 1;
	if (ptEntityInfo->iMaxChosenEntry < iGlobalMaxChosenEntry)
	{
		CheckForCatchUp(ptEntityInfo, iGlobalMaxChosenEntry);
		ptEntityInfo->iMaxChosenEntry = iGlobalMaxChosenEntry;
	}

	EntryInfo_t *ptInfo = m_poEntryMng->FindEntryInfo(iEntityID, iEntry);
	if (ptInfo == NULL)
	{
		ptInfo = m_poEntryMng->CreateEntryInfo(iEntityID, iEntry);
		assert(ptInfo != NULL);
	}

	if (ptInfo->bUncertain)
	{
		uint32_t iWaitingListSize = ptInfo->ptWaitingList->size();
		if (iWaitingListSize > 10)
		{
			CertainLogError("iEntityID %u iEntry %u iWaitingListSize %u",
					iEntityID, iEntry, iWaitingListSize);
			return -2;
		}

		ptInfo->ptWaitingList->push_back(poPaxosCmd);
		return 1;
	}

	assert(ptInfo->poMachine->GetEntryState() != kEntryStateChosen);

	// It should have created the ptInfo for the entry not more than
	// iMaxChosenEntry, and it won't be cleanup until chosen.
	assert(ptInfo->poMachine->GetEntryState() != kEntryStateChosen);

	iRet = UpdateRecord(poPaxosCmd);
	if (iRet != 0)
	{
		CertainLogError("UpdateRecord ret %d", iRet);
	}

	return 0;
}
Beispiel #13
0
void DataStore::ImportDataFromFile(std::string const &file)
{
    std::ifstream infile(file);
    std::string line;
    std::getline(infile, line); //skip first line (assume it's always a header)

    std::vector<std::pair<Record, bool>> vRecordsToAdd; //boolean keeps track if Record already exists in datastore

    //Add all Records from input file to temporary storage
    while (std::getline(infile, line)) {
        std::vector<std::string> const tokens(Utility::Tokenize(line, "|"));

        if (tokens.size() != 6)
            throw std::runtime_error("Bad record in file (found " + std::to_string(tokens.size()) + " fields, expected 6)");

        Record const rec(tokens);
        vRecordsToAdd.emplace_back(std::make_pair(rec, false));
    }

    std::cout << vRecordsToAdd.size() << " record(s) read from file" << std::endl;

    //Read data store (from file) and update existing records
    size_t numUpdated(0);
    Open();
    size_t const size(GetNumRecords());
    for (size_t ii = 0; ii < size; ++ii) {
        Record const oldRec(FetchRecord(ii));

        for (auto &pp : vRecordsToAdd) {
            Record const &rec  (pp.first);
            bool         &added(pp.second);

            if (added)
                continue;

            if (rec == oldRec) {
                UpdateRecord(rec, ii);
                added = true;
                ++numUpdated;
            }
        }
    }

    if (numUpdated > 0)
        std::cout << numUpdated << " record(s) updated in datastore" << std::endl;

    //Finally, add brand new records to datastore
    size_t numAdded(0);
    for (auto const &pp : vRecordsToAdd) {
        Record const &rec(pp.first);
        bool   const &added(pp.second);

        if (!added) {
            AddRecord(rec);
            ++numAdded;
        }
    }

    if (numAdded > 0)
        std::cout << numAdded << " record(s) added to datastore" << std::endl;

    Close();
}
void CCodeCheckpointDebugMgr::UpdateRecords()
{
	//Retrieve the latest snapshot
	ICodeCheckpointMgr* pCodeCheckpointMgr = gEnv->pCodeCheckpointMgr;
	if (pCodeCheckpointMgr)
	{
		size_t nextSnapshotCount = pCodeCheckpointMgr->GetTotalCount();

		size_t currIdx = 0;

		TCheckpointDebugList::iterator unwatchedIt = m_unwatchedPoints.begin(),watchedIt = m_watchedPoints.begin();

		///Update existing points with their snapshot
		size_t currSnapShotcount = m_watchedPoints.size() + m_unwatchedPoints.size();
		while( currIdx < currSnapShotcount && currIdx < nextSnapshotCount)
		{
			string name = pCodeCheckpointMgr->GetCheckPointName(currIdx);
			const CCodeCheckpoint* pCheckpoint = pCodeCheckpointMgr->GetCheckpoint(currIdx);

			///Check if we are a watched point
			if(watchedIt != m_watchedPoints.end() && (name == watchedIt->m_name))
			{
				CheckpointDebugRecord& currentRec = *watchedIt;
				UpdateRecord(pCheckpoint, currentRec);
				++watchedIt;
			}
			//Otherwise checked if we are unwatched point
			else if(unwatchedIt != m_unwatchedPoints.end() && (name == unwatchedIt->m_name))
			{
				CheckpointDebugRecord& currentRec = *unwatchedIt;
				UpdateRecord(pCheckpoint, currentRec);	
				++unwatchedIt;
			}
			///This should never happen, as each existing point should already have been inserted into either the watched or unwatched vector.
			else
			{
				CRY_ASSERT(false);
			}

			++currIdx;
		}

		///Add entities that are new to this snapshot
		while(currIdx < nextSnapshotCount)
		{
			const char* name = pCodeCheckpointMgr->GetCheckPointName(currIdx);
			const CCodeCheckpoint* pCheckpoint = pCodeCheckpointMgr->GetCheckpoint(currIdx);

			CheckpointDebugRecord newRecord(pCheckpoint, name, currIdx);

			//If we have a current request to watch this point, make sure it goes into watched points
			TBookmarkMap::iterator bookmarkedIt = m_bookmarkedNames.find(name);
			if(bookmarkedIt != m_bookmarkedNames.end())
			{
				newRecord.UpdateWatched(bookmarkedIt->second);
				m_watchedPoints.push_back(newRecord);
				//Clean up the bookmark as its already been hit
				m_bookmarkedNames.erase(bookmarkedIt);
			}
			else
				m_unwatchedPoints.push_back(newRecord);


			++currIdx;
		}
	}
}
Beispiel #15
0
int main( int argc, char **argv ) {
int i, c;
master_record_t		record;
nffile_t			*nffile;

	when = ISO2UNIX(strdup("200407111030"));
	while ((c = getopt(argc, argv, "h")) != EOF) {
		switch(c) {
			case 'h':
				break;
			default:
				fprintf(stderr, "ERROR: Unsupported option: '%c'\n", c);
				exit(255);
		}
	}

	extension_info.map = (extension_map_t *)malloc(sizeof(extension_map_t) + 32 * sizeof(uint16_t));
	if ( !extension_info.map ) {
		fprintf(stderr, "malloc() error in %s line %d: %s\n", __FILE__, __LINE__, strerror (errno));
		exit(255);
	}
	extension_info.map->type = ExtensionMapType;
	extension_info.map->map_id = 0;
	i = 0;
	extension_info.map->ex_id[i++] = EX_IO_SNMP_2;
	extension_info.map->ex_id[i++] = EX_AS_2;
	extension_info.map->ex_id[i++] = EX_MULIPLE;
	extension_info.map->ex_id[i++] = EX_NEXT_HOP_v4;
	extension_info.map->ex_id[i++] = EX_NEXT_HOP_BGP_v4;
	extension_info.map->ex_id[i++] = EX_VLAN;
	extension_info.map->ex_id[i++] = EX_OUT_PKG_4;
	extension_info.map->ex_id[i++] = EX_OUT_BYTES_4;
	extension_info.map->ex_id[i++] = EX_AGGR_FLOWS_4;
 	extension_info.map->ex_id[i++] = EX_MAC_1;
 	extension_info.map->ex_id[i++] = EX_MAC_2;
 	extension_info.map->ex_id[i++] = EX_MPLS;
 	extension_info.map->ex_id[i++] = EX_ROUTER_IP_v4;
 	extension_info.map->ex_id[i++] = EX_ROUTER_ID;
 	extension_info.map->ex_id[i++] = EX_BGPADJ;
	extension_info.map->ex_id[i] = 0;
	extension_info.map->size = sizeof(extension_map_t) + i * sizeof(uint16_t);

    // align 32bits
    if (( extension_info.map->size & 0x3 ) != 0 ) {
        extension_info.map->size += 4 - ( extension_info.map->size & 0x3 );
    }

	extension_info.map->extension_size = 0;
	i=0;
	while (extension_info.map->ex_id[i]) {
		int id = extension_info.map->ex_id[i];
		extension_info.map->extension_size += extension_descriptor[id].size;
		i++;
	}
	memset((void *)&record, 0, sizeof(record));

	nffile = OpenNewFile("-", NULL, 0, 0, NULL);
	if ( !nffile ) {
		exit(255);
	}

	AppendToBuffer(nffile, (void *)extension_info.map, extension_info.map->size);
	
	record.map_ref = extension_info.map;
	record.type	= CommonRecordType;

	record.flags   		= 0;
	record.exporter_sysid = 1;
	record.tcp_flags   	= 1;
	record.tos 		   	= 2;
	record.fwd_status	= 0;
	record.srcport 	 	= 1024;
	record.dstport 	 	= 25;
	record.prot 	 	= IPPROTO_TCP;
	record.input 	 	= 12;
	record.output 	 	= 14;
	record.srcas 	 	= 775;
	record.dstas 	 	= 8404;
	SetIPaddress(&record,  PF_INET, "172.16.1.66", "192.168.170.100");
	SetNextIPaddress(&record,  PF_INET, "172.72.1.2");
	SetBGPNextIPaddress(&record,  PF_INET, "172.73.2.3");
	SetRouterIPaddress(&record,  PF_INET, "127.0.0.1");
	record.engine_type	= 5;
	record.engine_id	= 6;
	record.dPkts 	 	= 202;
	record.dOctets 	 	= 303;
	record.dst_tos		= 128;
	record.dir			= 1;
	record.src_mask		= 16;
	record.dst_mask		= 24;
	record.src_vlan		= 82;
	record.dst_vlan		= 93;
	record.out_pkts		= 212;
	record.out_bytes	= 3234;
	record.aggr_flows	= 3;
	record.in_src_mac	= 0x0234567890aaLL;
	record.out_dst_mac	= 0xffeeddccbbaaLL;
	record.out_src_mac	= 0xaa3456789002LL;
	record.in_dst_mac	= 0xaaeeddccbbffLL;
	record.mpls_label[0] = 1010 << 4;
	record.mpls_label[1] = 2020 << 4;
	record.mpls_label[2] = 3030 << 4;
	record.mpls_label[3] = 4040 << 4;
	record.mpls_label[4] = 5050 << 4;
	record.mpls_label[5] = 6060 << 4;
	record.mpls_label[6] = 7070 << 4;
	record.mpls_label[7] = 8080 << 4;
	record.mpls_label[8] = 9090 << 4;
	record.mpls_label[9] = (100100 << 4) + 1;
	record.client_nw_delay_usec = 2;
	record.server_nw_delay_usec = 22;
	record.appl_latency_usec = 222;
	record.bgpNextAdjacentAS = 45804;
	record.bgpPrevAdjacentAS = 32775;

	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.2.66", "192.168.170.101");
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	record.dPkts 	 	= 101;
	record.dOctets 	 	= 102;
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.3.66", "192.168.170.102");
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.4.66", "192.168.170.103");
	record.srcport 	 = 2024;
	record.prot 	 = IPPROTO_UDP;
	record.tcp_flags = 1;
	record.tos 		 = 1;
	record.dPkts 	 = 1001;
	record.dOctets 	 = 1002;
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.5.66", "192.168.170.104");
	record.srcport 	 	= 3024;
	record.prot 	 	= 51;
	record.tcp_flags 	= 2;
	record.tos 		 	= 2;
	record.dPkts 	 	= 10001;
	record.dOctets 	 	= 10002;
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.6.66", "192.168.170.105");
	record.srcport 	 	= 4024;
	record.prot 	 	= IPPROTO_TCP;
	record.tcp_flags 	= 4;
	record.tos 		 	= 3;
	record.dPkts 	 	= 100001;
	record.dOctets 	 	= 100002;
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.7.66", "192.168.170.106");
	record.srcport 	 	= 5024;
	record.tcp_flags 	= 8;
	record.tos 		 	= 4;
	record.dPkts 	 	= 1000001;
	record.dOctets 	 	= 1000002;
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.8.66", "192.168.170.107");
	record.tcp_flags 	= 1;
	record.tos 		 	= 4;
	record.dPkts 	 	= 10000001;
	record.dOctets 	 	= 1001;
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.9.66", "192.168.170.108");
	record.srcport 	 	= 6024;
	record.tcp_flags 	= 16;
	record.tos 		 	= 5;
	record.dPkts 	 	= 500;
	record.dOctets 	 	= 10000001;
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.10.66", "192.168.170.109");
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.11.66", "192.168.170.110");
	record.srcport 		= 7024;
	record.tcp_flags 	= 32;
	record.tos 		 	= 255;
	record.dPkts 	 	= 5000;
	record.dOctets 	 	= 100000001;
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.12.66", "192.168.170.111");
	record.srcport 	 	= 8024;
	record.tcp_flags 	= 63;
	record.tos 		 	= 0;
	record.dOctets 	 	= 1000000001;
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.13.66", "192.168.170.112");
	record.srcport 	 	= 0;
	record.dstport 	 	= 8;
	record.prot 	 	= 1;
	record.tcp_flags 	= 0;
	record.tos 		 	= 0;
	record.dPkts 	 	= 50002;
	record.dOctets 	 	= 50000;
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.160.160.166", "172.160.160.180");
	record.srcport 	 = 10024;
	record.dstport 	 = 25000;
	record.prot 	 = IPPROTO_TCP;
	record.dPkts 	 = 500001;
	record.dOctets 	 = 500000;
	fprintf(stderr, "IPv4 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET6, "fe80::2110:abcd:1234:0", "fe80::2110:abcd:1235:4321");
//	SetNextIPaddress(&record,  PF_INET6, "2003:234:aabb::211:24ff:fe80:d01e");
//	SetBGPNextIPaddress(&record,  PF_INET6, "2004:234:aabb::211:24ff:fe80:d01e");
	record.srcport 	 = 1024;
	record.dstport 	 = 25;
	record.tcp_flags = 27;
	record.dPkts 	 = 10;
	record.dOctets 	 = 15100;
	fprintf(stderr, "IPv6 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET6, "2001:234:aabb::211:24ff:fe80:d01e", "2001:620::8:203:baff:fe52:38e5");
	record.srcport 	 = 10240;
	record.dstport 	 = 52345;
	record.dPkts 	 = 10100;
	record.dOctets 	 = 15000000;
	fprintf(stderr, "IPv6 32bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	record.dPkts 	 = 10100000;
	record.dOctets 	 = 0x100000000LL;
	fprintf(stderr, "IPv6 32bit packets 64bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	record.dPkts 	 = 0x100000000LL;
	record.dOctets 	 = 15000000;
	fprintf(stderr, "IPv6 64bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	record.dOctets 	 = 0x200000000LL;
	fprintf(stderr, "IPv6 64bit packets 64bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.14.18", "192.168.170.113");
//	SetNextIPaddress(&record,  PF_INET, "172.72.1.2");
//	SetBGPNextIPaddress(&record,  PF_INET, "172.73.2.3");
	record.srcport 	 = 10240;
	record.dstport 	 = 52345;
	record.dPkts 	 = 10100000;
	record.dOctets 	 = 0x100000000LL;
	fprintf(stderr, "IPv4 32bit packets 64bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.15.18", "192.168.170.114");
	record.dPkts 	 = 0x100000000LL;
	record.dOctets 	 = 15000000;
	fprintf(stderr, "IPv4 64bit packets 32bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	SetIPaddress(&record,  PF_INET, "172.16.16.18", "192.168.170.115");
	record.dOctets 	 = 0x200000000LL;
	fprintf(stderr, "IPv4 64bit packets 64bit bytes\n");
	UpdateRecord(&record);
	PackRecord(&record, nffile);

	extension_info.map->ex_id[0] = EX_IO_SNMP_4;

	extension_info.map->extension_size = 0;
	i=0;
	while (extension_info.map->ex_id[i]) {
		int id = extension_info.map->ex_id[i];
		extension_info.map->extension_size += extension_descriptor[id].size;
		i++;
	}

	memcpy(nffile->buff_ptr, (void *)extension_info.map, extension_info.map->size);
	nffile->buff_ptr += extension_info.map->size;
	nffile->block_header->NumRecords++;
	nffile->block_header->size 		+= extension_info.map->size;

	UpdateRecord(&record);
	fprintf(stderr, "4 bytes interfaces, 2 bytes AS numbers %d %d\n", record.fwd_status, nffile->block_header->NumRecords);
	PackRecord(&record, nffile);

	extension_info.map->ex_id[0] = EX_IO_SNMP_2;
	extension_info.map->ex_id[1] = EX_AS_4;

	extension_info.map->extension_size = 0;
	i=0;
	while (extension_info.map->ex_id[i]) {
		int id = extension_info.map->ex_id[i];
		extension_info.map->extension_size += extension_descriptor[id].size;
		i++;
	}

	memcpy(nffile->buff_ptr, (void *)extension_info.map, extension_info.map->size);
	nffile->buff_ptr += extension_info.map->size;
	nffile->block_header->NumRecords++;
	nffile->block_header->size 		+= extension_info.map->size;

	UpdateRecord(&record);
	fprintf(stderr, "2 bytes interfaces, 4 bytes AS numbers %d %d\n", record.fwd_status, nffile->block_header->NumRecords);
	PackRecord(&record, nffile);

	extension_info.map->ex_id[0] = EX_IO_SNMP_4;

	extension_info.map->extension_size = 0;
	i=0;
	while (extension_info.map->ex_id[i]) {
		int id = extension_info.map->ex_id[i];
		extension_info.map->extension_size += extension_descriptor[id].size;
		i++;
	}

	memcpy(nffile->buff_ptr, (void *)extension_info.map, extension_info.map->size);
	nffile->buff_ptr += extension_info.map->size;
	nffile->block_header->NumRecords++;
	nffile->block_header->size 		+= extension_info.map->size;

	UpdateRecord(&record);
	fprintf(stderr, "4 bytes interfaces, 4 bytes AS numbers %d %d\n", record.fwd_status, nffile->block_header->NumRecords);
	PackRecord(&record, nffile);

	if ( nffile->block_header->NumRecords ) {
		if ( WriteBlock(nffile) <= 0 ) {
			fprintf(stderr, "Failed to write output buffer to disk: '%s'" , strerror(errno));
		} 
	}

	return 0;
}
Beispiel #16
0
/* Convert the event from the callbacks in actions */
void InputManager::customEvent( QEvent *event )
{
    int i_type = event->type();
    IMEvent *ple = static_cast<IMEvent *>(event);

    if( i_type == IMEvent::ItemChanged )
        UpdateMeta( ple->item() );

    if( !hasInput() )
        return;

    /* Actions */
    switch( i_type )
    {
    case IMEvent::PositionUpdate:
        UpdatePosition();
        break;
    case IMEvent::StatisticsUpdate:
        UpdateStats();
        break;
    case IMEvent::ItemChanged:
        /* Ignore ItemChanged_Type event that does not apply to our input */
        if( p_item == ple->item() )
        {
            UpdateStatus();
            // UpdateName();
            UpdateArt();
            UpdateMeta();
            /* Update duration of file */
        }
        break;
    case IMEvent::ItemStateChanged:
        // TODO: Fusion with above state
        UpdateStatus();
        // UpdateName();
        // UpdateNavigation(); This shouldn't be useful now
        // UpdateTeletext(); Same
        break;
    case IMEvent::NameChanged:
        UpdateName();
        break;
    case IMEvent::MetaChanged:
        UpdateMeta();
        UpdateName(); /* Needed for NowPlaying */
        UpdateArt(); /* Art is part of meta in the core */
        break;
    case IMEvent::InfoChanged:
        UpdateInfo();
        break;
    case IMEvent::ItemTitleChanged:
        UpdateNavigation();
        UpdateName(); /* Display the name of the Chapter, if exists */
        break;
    case IMEvent::ItemRateChanged:
        UpdateRate();
        break;
    case IMEvent::ItemEsChanged:
        UpdateTeletext();
        // We don't do anything ES related. Why ?
        break;
    case IMEvent::ItemTeletextChanged:
        UpdateTeletext();
        break;
    case IMEvent::InterfaceVoutUpdate:
        UpdateVout();
        break;
    case IMEvent::SynchroChanged:
        emit synchroChanged();
        break;
    case IMEvent::CachingEvent:
        UpdateCaching();
        break;
    case IMEvent::BookmarksChanged:
        emit bookmarksChanged();
        break;
    case IMEvent::InterfaceAoutUpdate:
        UpdateAout();
        break;
    case IMEvent::RecordingEvent:
        UpdateRecord();
        break;
    case IMEvent::ProgramChanged:
        UpdateProgramEvent();
        break;
    case IMEvent::EPGEvent:
        UpdateEPG();
        break;
    default:
        msg_Warn( p_intf, "This shouldn't happen: %i", i_type );
        assert(0);
    }
}
Beispiel #17
0
void idWorldManager::Think( void )
{
	int i;
	UpdateRecord();

	for (i = 0; i < 3; i++)
	{
		idVec4 markerColor;
		idVec3 markerPos;
		int markerRadius = 24;

		if (records[i].playing)
		{
			UpdatePlay(i);
		}
		else
		{
			continue;
		}

		if (state == OFF && index != -1 /*caser*/)
		{
			continue;
		}

		if (this->index == i)
		{
			continue;
		}

		if (!records[i].ghost->IsHidden())
		{
			if ((int)(gameLocal.time * 0.004) % 3 == 0)
			{
				markerRadius = 12;
			}

			switch (i)
			{
				case 0:		markerColor = idVec4(.25, .75, 1, 1); break; //blue.
				case 1:		markerColor = idVec4(.74, .9, .26, 1); break;  //green.
				default:	markerColor = idVec4(1, .6, 0, 1); break; //orange.
			}

			//blue .25, .75, 1
			//yellow 1, .8, 0, 1
			//red .9, .25, .25

			markerPos = records[i].ghost->GetPhysics()->GetOrigin() + idVec3(0,0,85);
			gameRenderWorld->DebugLine( markerColor, markerPos + idVec3(0,0,-markerRadius), markerPos + idVec3(0,0,markerRadius) );
			gameRenderWorld->DebugLine( markerColor, markerPos + idVec3(0,-markerRadius,0), markerPos + idVec3(0,markerRadius,0) );
			gameRenderWorld->DebugLine( markerColor, markerPos + idVec3(-markerRadius,0,0), markerPos + idVec3(markerRadius,0,0) );

			if (index == -1)
			{
				//draw lines.
				int k;

				if (recordlines[i].lines.Num() >= 3)
				{
					for (k = 0; k < recordlines[i].lines.Num() - 1; k++)
					{
						if (k > 2) //BC hack. The initial lines are garbage data. So, just skip them.
						{
							gameRenderWorld->DebugLine( markerColor, 
								recordlines[i].lines[k].position1, recordlines[i].lines[k].position2 );
						}
					}


					//This is the dangly bit that connects the last recordline position to the character model's feet.
					if (records[i].index < recordlines[i].lines.Num() && i > 1)
					{
						gameRenderWorld->DebugLine( markerColor, 
							recordlines[i].lines[records[i].index].position1,
							records[i].ghost->GetPhysics()->GetOrigin() );
					}
				}
			}
		}
	}
}