示例#1
0
event_map_t * EITCache::LoadChannel(uint chanid)
{
    if (!lock_channel(chanid, lastPruneTime))
        return NULL;

    MSqlQuery query(MSqlQuery::InitCon());

    QString qstr =
        "SELECT eventid,tableid,version,endtime "
        "FROM eit_cache "
        "WHERE chanid        = :CHANID   AND "
        "      endtime       > :ENDTIME  AND "
        "      status        = :STATUS";

    query.prepare(qstr);
    query.bindValue(":CHANID",   chanid);
    query.bindValue(":ENDTIME",  lastPruneTime);
    query.bindValue(":STATUS",   EITDATA);


    if (!query.exec() || !query.isActive())
    {
        MythDB::DBError("Error loading eitcache", query);
        return NULL;
    }

    event_map_t * eventMap = new event_map_t();

    while (query.next())
    {
        uint eventid = query.value(0).toUInt();
        uint tableid = query.value(1).toUInt();
        uint version = query.value(2).toUInt();
        uint endtime = query.value(3).toUInt();

        (*eventMap)[eventid] = construct_sig(tableid, version, endtime, false);
    }

    if (eventMap->size())
        LOG(VB_EIT, LOG_INFO, LOC + QString("Loaded %1 entries for channel %2")
                .arg(eventMap->size()).arg(chanid));

    entryCnt += eventMap->size();
    return eventMap;
}
示例#2
0
int 
initiate_certcomm_mode (SA *sa)
{
     int pos;
     
     /*
      * these algs should, ideally, come from the PF_KEY, and they should
      * have some implied preference and logical construction. For now just
      * stick 'em here in plain serial, logical OR.
      */

    sa->hash_alg = HASH_SHA;
    sa->encr_alg = ET_DES_CBC;
    sa->auth_alg = DSS_SIG;

    sa->group_desc = 1;		/* the default Oakley group */

    /* Nike : We use the Aggressive mode */
    construct_header(sa, NIKE_CERTCOMM, 0, ISA_SA);
    pos = sizeof(isakmp_hdr);
    construct_isakmp_sa(sa, ISA_KE, &pos);
    construct_ke(sa, ISA_CERT, &pos);
    construct_cert(sa, ISA_SIG, &pos);
    construct_sig(sa, 0, &pos);
#if 0
    switch (sa->auth_alg)
    {
	case PRESHRD:
		construct_id(sa, ISA_HASH, &pos);
		construct_hash(sa, 0, &pos);
		break;
        default:
		break;
    }
#endif
    return(0);
}