コード例 #1
0
ファイル: send_igmp_query.c プロジェクト: aloughlam/lnst
int main(int argc, char** argv)
{
    struct parameters params;
    parse_args(argc, argv, &params);

    int sockfd = init_raw_socket(params.interface);

    switch(params.query_type) {
    case IGMP_GENERAL_QUERY:
        general_query(sockfd, params.interface);
        break;
    case IGMP_GROUP_SPECIFIC_QUERY:
        group_specific_query(sockfd, params.interface,
                             params.destaddr, params.multiaddr,
                             params.max_resp_time);
        break;
    case IGMP_GROUP_AND_SOURCE_SPECIFIC_QUERY:
        group_and_source_specific_query(sockfd,params.interface,
                                        params.destaddr, params.multiaddr,
                                        &params.sourceaddr, 1,
                                        params.max_resp_time);

        break;
    }

    return EXIT_SUCCESS;
}
コード例 #2
0
ファイル: userdata.cpp プロジェクト: Barlend/Cutegram
void UserData::init_buffer()
{
    p->mutes.clear();
    p->favorites.clear();
    p->msg_updates.clear();
    p->general.clear();

    QSqlQuery mute_query(p->db);
    mute_query.prepare("SELECT id, mute FROM mutes");
    mute_query.exec();

    while( mute_query.next() )
    {
        const QSqlRecord & record = mute_query.record();
        p->mutes.insert( record.value(0).toInt(), record.value(1).toInt() );
    }

    QSqlQuery faves_query(p->db);
    faves_query.prepare("SELECT id, favorite FROM favorites");
    faves_query.exec();

    while( faves_query.next() )
    {
        const QSqlRecord & record = faves_query.record();
        p->favorites.insert( record.value(0).toInt(), record.value(1).toInt() );
    }

    QSqlQuery llinks_query(p->db);
    llinks_query.prepare("SELECT id, canLoad FROM loadLink");
    llinks_query.exec();

    while( llinks_query.next() )
    {
        const QSqlRecord & record = llinks_query.record();
        p->loadLink.insert( record.value(0).toInt(), record.value(1).toInt() );
    }

    QSqlQuery notifies_query(p->db);
    notifies_query.prepare("SELECT id, value FROM notifysettings");
    notifies_query.exec();

    while( notifies_query.next() )
    {
        const QSqlRecord & record = notifies_query.record();
        p->notifies.insert( record.value(0).toInt(), record.value(1).toInt() );
    }

    QSqlQuery tags_query(p->db);
    tags_query.prepare("SELECT tag FROM tags");
    tags_query.exec();

    while( tags_query.next() )
    {
        const QSqlRecord & record = tags_query.record();
        p->tags.insert( record.value(0).toString(), true );
    }

    QSqlQuery msg_upd_query(p->db);
    msg_upd_query.prepare("SELECT id, message, date FROM updatemessages");
    msg_upd_query.exec();

    while( msg_upd_query.next() )
    {
        const QSqlRecord & record = msg_upd_query.record();
        MessageUpdate msg;
        msg.id = record.value(0).toULongLong();
        msg.message = record.value(1).toString();
        msg.date = record.value(2).toLongLong();

        p->msg_updates[msg.id] = msg;
    }

    QSqlQuery general_query(p->db);
    general_query.prepare("SELECT gkey, gvalue FROM general");
    general_query.exec();

    while( general_query.next() )
    {
        const QSqlRecord & record = general_query.record();
        p->general.insert( record.value(0).toString(), record.value(1).toString() );
    }
}