Example #1
0
void MCEXboxRemote1::populateProtocol(
  QObject *guiObject)
{
  if (threadableProtocol)
  {
    // Keyset already populated.
    return;
  }

  MCERemote1g::populateProtocol(guiObject);

  addKey("A", Green_Key, 0x12, 8);
  addKey("X", Blue_Key, 0x13, 8);
  addKey("B", Red_Key, 0x25, 8);
  addKey("Y", Yellow_Key, 0x26, 8);
}
		void ExtensionSecurityBlock::encrypt(dtn::data::Bundle& bundle, const SecurityKey &key, dtn::data::Bundle::iterator it, const dtn::data::EID& source, const dtn::data::EID& destination)
		{
			uint32_t salt = 0;

			// load the rsa key
			RSA *rsa_key = key.getRSA();

			// key used for encrypting the block. the key will be encrypted using RSA
			unsigned char ephemeral_key[ibrcommon::AES128Stream::key_size_in_bytes];
			createSaltAndKey(salt, ephemeral_key, ibrcommon::AES128Stream::key_size_in_bytes);

			dtn::security::ExtensionSecurityBlock& esb = SecurityBlock::encryptBlock<ExtensionSecurityBlock>(bundle, it, salt, ephemeral_key);

			// set the source and destination address of the new block
			if (source != bundle.source) esb.setSecuritySource( source );
			if (destination != bundle.destination) esb.setSecurityDestination( destination );

			// encrypt the ephemeral key and place it in _ciphersuite_params
			addSalt(esb._ciphersuite_params, salt);
			addKey(esb._ciphersuite_params, ephemeral_key, ibrcommon::AES128Stream::key_size_in_bytes, rsa_key);
			esb._ciphersuite_flags |= CONTAINS_CIPHERSUITE_PARAMS;

			// free the rsa key
			key.free(rsa_key);
		}
void AutoBan::removeIp(long ip) {
	long tabsize = m_tableSize - 1;
	unsigned long i = (unsigned long)ip & tabsize;
	
	do {
		if(m_detectKeys[i] == ip) {
			m_detectKeys[i] = 0;
			i = (i + 1) & tabsize;
			while ( m_detectKeys[i] ) {
				long key      = m_detectKeys[i];
				DetectVal *val = &m_detectVals[i];
				m_detectKeys[i] = 0;
				m_numEntries--;
				addKey(key, val);
				i = (i + 1) & tabsize;
			}

			m_numEntries--;
			break;
		}
		if(m_detectKeys[i] == 0) {
			break;
		}
		i = (i + 1) & tabsize;
	} while(1);
}
Example #4
0
void QKeyList::contextMenuEvent(QContextMenuEvent* evt)
{
    QMenu menu(this);
    QAction* addObjItem = menu.addAction(tr("Add Object"));
    QAction* delObjItem = menu.addAction(tr("Remove Object"));

    if (currentItem() == NULL)
        delObjItem->setEnabled(false);

    QAction* sel = menu.exec(evt->globalPos());
    if (sel == addObjItem) {
        QFindKeyDialog dlg(this);
        if (fKeys.size() > 0)
            dlg.init(PrpShopMain::ResManager(), fKeys.back()->getLocation(),
                     fKeys.back()->getType());
        else
            dlg.init(PrpShopMain::ResManager(), fContainer->getLocation());
        if (dlg.exec() == QDialog::Accepted) {
            addKey(dlg.selection());
            emit itemAdded(dlg.selection());
        }
    } else if (sel == delObjItem) {
        int idx = indexOfTopLevelItem(currentItem());
        delItem(idx);
        emit itemRemoved(idx);
    }
}
bool AutoBan::restore() {
	char tmp[512 * 512];
	SafeBuf p(tmp, 512 * 512);
	if(p.fillFromFile("autoban-saved.dat")<0)
		return false;
	if (p.length() <= 0 ) return true;
	char* buf = (char*) p.getBufStart();
	char* bufEnd = (char*) p.getBufEnd();
	// catLoop:
	long numEntries = *(long*)buf;
	buf += sizeof(long);
	for(long i = 0; i < numEntries; i++) {
		if ( buf + 4 > bufEnd ) break;
		long ip = *(long*)buf;
		buf += sizeof(long);
		addKey(ip, (DetectVal*)buf);
		buf += sizeof(DetectVal);
		if(buf > bufEnd) return false;
	}
	log("autoban: read %li entries",numEntries);
	// more to read? return no if not
	// this was  a hack when catting two autoban-saved.dat files together
	//if ( buf + 4 < bufEnd && numEntries )
	//	goto catLoop;
	// all done
	return true;
}
Example #6
0
void AiwaAudio2b::populateProtocol(
  QObject *guiObject)
{
  if (threadableProtocol)
  {
    // If the pointer is not null, the keyset must already be populated.
    return;
  }

  AiwaAudio2::populateProtocol(guiObject);

  addKey("UP", Up_Key, 0x40, 8);
  addKey("DOWN", Down_Key, 0x41, 8);
  addKey("RIGHT", Right_Key, 0x42, 8);
  addKey("LEFT", Left_Key, 0x43, 8);
}
Example #7
0
void WDMediaPlayer1b::populateProtocol(
  QObject *guiObject)
{
  if (threadableProtocol)
  {
    // Keyset already populated.
    return;
  }

  WDMediaPlayer1a::populateProtocol(guiObject);

  addKey("0", Zero_Key, 0x11, 8);
  addKey("1", One_Key, 0x18, 8);
  addKey("2", Two_Key, 0x19, 8);
  addKey("4", Four_Key, 0x1C, 8);
  addKey("5", Five_Key, 0x1D, 8);
}
Example #8
0
	// Setup entity fields
	void VideoFeature::setupFields()
	{
		// Set table
		setTable("video_features");
		// Add fields
		addField("video_id");
		addField("feature_id");
		addField("data");
		addField("rows");
		addField("columns");
		addField("feature_certainty");
		// Set key
		addKey("video_id", false);
		addKey("feature_id", false);
		// Set lookup fields - what is appropriate here?
		//addLookupField("video_id");
	}
void ParseObjectCreate::add(const char* key, bool b) {
	addKey(key);
	if(b) {
		requestBody += "true";
	} else {
		requestBody += "false";
	}
}
Example #10
0
Graph::Graph(){
    //meta level               
    addKey("type","node","type","string");
    //firm level
    addKey("cycleNum","node","cycleNum","string");
    addKey("numFirms","node","numFirms","string");
    addKey("numIndividuals","node","numIndividuals","string");
    addKey("avgProductivity","node","avgProductivity","string");
    addKey("unitsLeft","node","unitsLeft","string");
    addKey("capital","node","capital","string");
    addKey("firmId","node","firmId","string");
    //individual level    
    addKey("productivity","node","firmId","productivity");
}
Example #11
0
void EmersonAudio1::populateProtocol(
    QObject *guiObject)
{
    if (threadableProtocol)
    {
        // Keyset already populated.
        return;
    }

    threadableProtocol = new F12Protocol(guiObject, index);

    connect(
        threadableProtocol,
        SIGNAL(errorMessage(QString)),
        this,
        SIGNAL(errorMessage(QString)));

    setPreData(0x5, 3);

    addKey("Volume Up", VolumeUp_Key, 0x04, 8);
    addKey("Pro Logic", NoiseReduction_Key, 0x05, 8);
    addKey("Volume Down", VolumeDown_Key, 0x08, 8);
    addKey("3 Channel", Unmapped_Key, 0x09, 8);
    addKey("Music", Unmapped_Key, 0x11, 8);
    addKey("Test Tone", Unmapped_Key, 0x21, 8);
    addKey("Power", Power_Key, 0x41, 8);
}
Example #12
0
void EmersonAudio2::populateProtocol(
    QObject *guiObject)
{
    if (threadableProtocol)
    {
        // Keyset already populated.
        return;
    }

    threadableProtocol = new F12Protocol(guiObject, index);

    connect(
        threadableProtocol,
        SIGNAL(errorMessage(QString)),
        this,
        SIGNAL(errorMessage(QString)));

    setPreData(0x3, 3);

    addKey("mute", Mute_Key, 0x05, 8);
    addKey("power", Power_Key, 0x09, 8);
    addKey("stop/clear", Stop_Key, 0x11, 8);
    addKey("play/pause", Play_Key, 0x21, 8);
    addKey("play/pause", Pause_Key, 0x21, 8);

    addKey("volume_up", VolumeUp_Key, 0x20, 8);
    addKey("volume_down", VolumeDown_Key, 0x40, 8);
}
void SimpleKeyableProperty<T>::addKey(const std::string &value, long double pos){
	try{
		addKey(string_to<T>(value), pos);
	}
	catch(std::exception &e){
		throw MaudioException("failed to add value");
	}
	return;
}
void ParseObjectCreate::addGeoPoint(const char* key, double lat, double lon) {
	addKey(key);
	String geoPoint = "{\"__type\":\"GeoPoint\",\"latitude\":";
	geoPoint += lat;
	geoPoint += ",\"longitude\":";
	geoPoint += lon;
	geoPoint += "}";
  requestBody += geoPoint;
}
Example #15
0
void LaskoFan2::populateProtocol(
  QObject *guiObject)
{
  if (threadableProtocol)
  {
    // Keyset already populated.
    return;
  }

  threadableProtocol = new NECProtocol(guiObject, index, false, true);

  setPreData(0x01, 8);

  addKey("power", Power_Key, 0x03, 8);
  addKey("speed", Fan_Key, 0x07, 8);
  addKey("timer", Timer_Key, 0x0B, 8);
  addKey("oscillate", Oscillate_Key, 0x0F, 8);
}
Example #16
0
void LaskoFan1::populateProtocol(
  QObject *guiObject)
{
  if (threadableProtocol)
  {
    // Keyset already populated.
    return;
  }

  threadableProtocol = new AirtechProtocol(guiObject, index);

  setPreData(0x6C, 7);

  addKey("power", Power_Key, 0x01, 5);
  addKey("fan speed", Fan_Key, 0x02, 5);
  addKey("timer", Timer_Key, 0x08, 5);
  addKey("rotation", Oscillate_Key, 0x10, 5);
}
Example #17
0
/* InputPrefsPanel::onListKeyDown
 * Called when a key is pressed in the keybind list
 *******************************************************************/
void InputPrefsPanel::onListKeyDown(wxKeyEvent& e)
{
	if (e.GetKeyCode() == WXK_DELETE)
		removeKey(list_binds->GetSelection());
	else if (e.GetKeyCode() == WXK_INSERT)
		addKey();
	else
		e.Skip();
}
Example #18
0
/**
 * Like updateKey but allow multiple items with same key
 */
static Tree addKey(Tree pl, Tree key, Tree val)
{
  if(isNil(pl))
    return cons(cons(key, val), nil);

  if(isBefore(key, left(hd(pl))))
    return cons(cons(key, val), pl);

  return cons(hd(pl), addKey(tl(pl), key, val));
}
Example #19
0
void SylvaniaFan1::populateProtocol(
  QObject *guiObject)
{
  if (threadableProtocol)
  {
    // Keyset already populated.
    return;
  }

  threadableProtocol = new AirtechProtocol(guiObject, index);

  setPreData(0x6C, 7);

  addKey("On/Off", Power_Key, 0x01, 5);
  addKey("Speed Adjust", Fan_Key, 0x02, 5);
  addKey("Mode", Mode_Key, 0x04, 5);
  addKey("Timer", Timer_Key, 0x08, 5);
  addKey("Swing", Oscillate_Key, 0x10, 5);
}
Example #20
0
// place un item dans un folder. Sans Remplacement
Tree addToFolder(Tree folder, Tree item)
{
  Tree label, content;

  if(!isUiFolder(folder, label, content))
  {
    fprintf(stderr, "ERROR in addFolder : not a folder\n");
  }

  return uiFolder(label, addKey(content, uiLabel(item), item));
}
KeyListViewIface& KeyListPresenter::getView() {
	if (itsKeyListView == 0) {
		itsKeyListView = getFactory().createKeyListView();
		getView().getBtnAddKey().pressedSig.connect([=] {addKey();});
		getView().getBtnReload().pressedSig.connect(
				[=] {reloadKeyList();});
		getView().getBtnEditKey().pressedSig.connect([=] {editKey();});
		getView().getBtnDelKey().pressedSig.connect([=] {deleteKey();});
		getView().selectionChangedSig.connect([=](int pIdx){selectionChanged(pIdx);});
	}
	return *itsKeyListView;
}
bool AutoBan::addIp(long ip, char action) {
	long now = getTime();
	DetectVal d;
	d.m_minuteExpires = now + 60;
	d.m_dayExpires = now + ONE_DAY;
	d.m_dayCount = 0;
	d.m_minuteCount = 0;
	d.m_timesBanned = 0;
	d.m_flags = action | FROMCONF;
	bool retval = addKey(ip, &d);
	
	return retval;
}
bool LLWLDayCycle::changeKeyTime(F32 oldTime, F32 newTime)
{
	// just remove and add back
	std::string name = mTimeMap[oldTime];

	bool stat = removeKey(oldTime);
	if(stat == false) 
	{
		return stat;
	}

	return addKey(newTime, name);
}
Example #24
0
void YamahaAudio2b::populateProtocol(
  QObject *guiObject)
{
  if (threadableProtocol)
  {
    // If the pointer is not null, the keyset must already be populated.
    return;
  }

  YamahaAudio2::populateProtocol(guiObject);

  addKey("SOURCE_DIRECT", Unmapped_Key, 0x56, 8);
}
Example #25
0
void SamsungDVD1a::populateProtocol(
  QObject *guiObject)
{
  if (threadableProtocol)
  {
    // If the pointer is not null, the keyset must already be populated.
    return;
  }

  SamsungDVD1::populateProtocol(guiObject);

  addKey("hdmi_sel", Unmapped_Key, 0x15EA, 16);
}
Example #26
0
void JVCTV1b::populateProtocol(
  QObject *guiObject)
{
  if (threadableProtocol)
  {
    // If the pointer is not null, the keyset must already be populated.
    return;
  }

  JVCTV1::populateProtocol(guiObject);

  addKey("sleep_timer", Sleep_Key, 0x03, 8);
}
Example #27
0
void JVCTV1a::populateProtocol(
  QObject *guiObject)
{
  if (threadableProtocol)
  {
    // If the pointer is not null, the keyset must already be populated.
    return;
  }

  JVCTV1::populateProtocol(guiObject);

  addKey("+10", DoubleDigit_Key, 0x71, 8);
}
Example #28
0
	// Setup entity fields
	void Feature::setupFields()
	{
		// Set table
		setTable("features");
		// Add fields
		addField("feature_id");
		addField("name");
		addField("type");
		// Set key
		addKey("feature_id");
		// Set lookup fields
		addLookupField("name");
	}
Example #29
0
	// Setup entity fields
	void GtKeyFrames::setupFields()
	{
		// Set table
		setTable("gt_keyframes");
		// Add fields
		addField("id");
		addField("ground_truth_id");
		addField("start");
		addField("end");
		addField("label");
		// Set key
		addKey("id");
	}
Example #30
0
void MinoltaCamera1::populateProtocol(
  QObject *guiObject)
{
  if (threadableProtocol)
  {
    // Keyset already populated.
    return;
  }

  LIRCProtocol *lp = new LIRCProtocol(
    guiObject, index,
    527, 436,
    527, 1331,
    9052, false);

  threadableProtocol = lp;
  lp->setHeaderPair(3872, 1708);
  lp->setTrailerPulse(527);

  addKey("one_sec", OpenShutter_Key, 0x2C538280, 32);
  addKey("two_sec", DelayedOpenShutter_Key, 0x2C538200, 32);
}