当前位置: 首页>>代码示例>>C++>>正文


C++ PacketsPattern::getReceiverAddress方法代码示例

本文整理汇总了C++中PacketsPattern::getReceiverAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ PacketsPattern::getReceiverAddress方法的具体用法?C++ PacketsPattern::getReceiverAddress怎么用?C++ PacketsPattern::getReceiverAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PacketsPattern的用法示例。


在下文中一共展示了PacketsPattern::getReceiverAddress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: doTest

    int doTest()
    {
        // should be valid?
        //RTPSession tx();
        ExtZrtpSession tx(/*pattern.getSsrc(),*/ pattern.getSenderAddress(), pattern.getSenderPort());
//        config.clear();
//        config.setStandardConfig();
        config.addAlgo(PubKeyAlgorithm, zrtpPubKeys.getByName("DH2k"));
        config.addAlgo(PubKeyAlgorithm, zrtpPubKeys.getByName("EC38"));
        config.addAlgo(PubKeyAlgorithm, zrtpPubKeys.getByName("EC25"));

         config.addAlgo(HashAlgorithm, zrtpHashes.getByName("S384"));

//          config.addAlgo(CipherAlgorithm, zrtpSymCiphers.getByName("2FS3"));
//          config.addAlgo(CipherAlgorithm, zrtpSymCiphers.getByName("AES3"));

        config.addAlgo(SasType, zrtpSasTypes.getByName("B256"));

        tx.initialize("test_t.zid", true, &config);
        // At this point the Hello hash is available. See ZRTP specification
        // chapter 9.1 for further information when an how to use the Hello
        // hash.
        int numSupportedVersion = tx.getNumberSupportedVersions();
        cout << "TX Hello hash 0: " << tx.getHelloHash(0) << endl;
        cout << "TX Hello hash 0 length: " << tx.getHelloHash(0).length() << endl;
        if (numSupportedVersion > 1) {
            cout << "TX Hello hash 1: " << tx.getHelloHash(1) << endl;
            cout << "TX Hello hash 1 length: " << tx.getHelloHash(1).length() << endl;
        }
        tx.setUserCallback(new MyUserCallback(&tx));

        tx.setSchedulingTimeout(10000);
        tx.setExpireTimeout(1000000);

        tx.startRunning();

        tx.setPayloadFormat(StaticPayloadFormat(sptPCMU));

        if (!tx.addDestination(pattern.getReceiverAddress(), pattern.getReceiverPort()) ) {
            return 1;
        }
        tx.startZrtp();

        // 2 packets per second (packet duration of 500ms)
        uint32 period = 500;
        uint16 inc = tx.getCurrentRTPClockRate()/2;
        TimerPort::setTimer(period);
        uint32 i;
        for (i = 0; i < pattern.getPacketsNumber(); i++ ) {
            tx.putData(i*inc,
                       pattern.getPacketData(i),
                       pattern.getPacketSize(i));
            cout << "Sent some data: " << i << endl;
            Thread::sleep(TimerPort::getTimer());
            TimerPort::incTimer(period);
        }
        tx.putData(i*inc, (unsigned char*)"exit", 5);
        Thread::sleep(TimerPort::getTimer());
        return 0;
    }
开发者ID:victoryckl,项目名称:ZRTPCPP,代码行数:60,代码来源:zrtptest.cpp

示例2: rx

    int
    doTest() {
        ExtZrtpSession rx(pattern.getSsrc()+1, pattern.getReceiverAddress(), pattern.getReceiverPort());

        rx.initialize("test_r.zid");

        rx.setSchedulingTimeout(10000);
        rx.setExpireTimeout(1000000);

        rx.startRunning();
        rx.setPayloadFormat(StaticPayloadFormat(sptPCMU));
        // arbitrary number of loops to provide time to start transmitter
        if (!rx.addDestination(pattern.getSenderAddress(), pattern.getSenderPort()) ) {
            return 1;
        }
        rx.startZrtp();
        for ( int i = 0; i < 5000 ; i++ ) {
            const AppDataUnit* adu;
            while ( (adu = rx.getData(rx.getFirstTimestamp())) ) {
                cerr << "got some data: " << adu->getData() << endl;
                if (*adu->getData() == 'e') {
                    delete adu;
                    return 0;
                }
                delete adu;
            }
            Thread::sleep(70);
        }
        return 0;
    }
开发者ID:victoryckl,项目名称:ZRTPCPP,代码行数:30,代码来源:zrtptest.cpp


注:本文中的PacketsPattern::getReceiverAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。