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


C++ TrexStatelessPort::get_owner方法代码示例

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


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

示例1: return

/**
 * fetch the port status
 * 
 * @author imarom (09-Dec-15)
 * 
 * @param params 
 * @param result 
 * 
 * @return trex_rpc_cmd_rc_e 
 */
trex_rpc_cmd_rc_e
TrexRpcCmdGetPortStatus::_run(const Json::Value &params, Json::Value &result) {
    uint8_t port_id = parse_port(params, result);

    TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(port_id);

    result["result"]["owner"]         = (port->get_owner().is_free() ? "" : port->get_owner().get_name());
    result["result"]["state"]         = port->get_state_as_string();
    result["result"]["max_stream_id"] = port->get_max_stream_id();

    return (TREX_RPC_CMD_OK);
}
开发者ID:chetangaonker,项目名称:trex-core,代码行数:22,代码来源:trex_rpc_cmd_general.cpp

示例2:

void
TrexRpcCommand::verify_ownership(const Json::Value &params, Json::Value &result) {
    std::string handler = parse_string(params, "handler", result);
    uint8_t port_id = parse_port(params, result);

    TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(port_id);

    if (port->get_owner().is_free()) {
        generate_execute_err(result, "please acquire the port before modifying port state");
    }

    if (!port->get_owner().verify(handler)) {
        generate_execute_err(result, "port is not owned by you or your current executing session");
    }
}
开发者ID:cisco-system-traffic-generator,项目名称:trex-core,代码行数:15,代码来源:trex_rpc_cmd.cpp

示例3: catch

/**
 * push a remote PCAP on a port
 *
 */
trex_rpc_cmd_rc_e
TrexRpcCmdPushRemote::_run(const Json::Value &params, Json::Value &result) {

    uint8_t port_id = parse_port(params, result);
    std::string  pcap_filename  = parse_string(params, "pcap_filename", result);
    double       ipg_usec       = parse_double(params, "ipg_usec", result);
    double       speedup        = parse_double(params, "speedup", result);
    uint32_t     count          = parse_uint32(params, "count", result);
    double       duration       = parse_double(params, "duration", result);
    bool         is_dual        = parse_bool(params,   "is_dual", result, false);
    std::string  slave_handler  = parse_string(params, "slave_handler", result, "");

    TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(port_id);

    /* for dual mode - make sure slave_handler matches */
    if (is_dual) {
        TrexStatelessPort *slave = get_stateless_obj()->get_port_by_id(port_id ^ 0x1);
        if (!slave->get_owner().verify(slave_handler)) {
            generate_execute_err(result, "incorrect or missing slave port handler");
        }
    }


    try {
        port->push_remote(pcap_filename, ipg_usec, speedup, count, duration, is_dual);
    } catch (const TrexException &ex) {
        generate_execute_err(result, ex.what());
    }

    result["result"] = Json::objectValue;
    return (TREX_RPC_CMD_OK);

}
开发者ID:cisco-system-traffic-generator,项目名称:trex-core,代码行数:37,代码来源:trex_rpc_cmd_general.cpp

示例4: return

/**
 * returns the current owner of the device
 * 
 * @author imarom (08-Sep-15)
 * 
 * @param params 
 * @param result 
 * 
 * @return trex_rpc_cmd_rc_e 
 */
trex_rpc_cmd_rc_e
TrexRpcCmdGetOwner::_run(const Json::Value &params, Json::Value &result) {
    Json::Value &section = result["result"];

    uint8_t port_id = parse_port(params, result);

    TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(port_id);
    section["owner"] = port->get_owner().get_name();

    return (TREX_RPC_CMD_OK);
}
开发者ID:RaminNietzsche,项目名称:trex-core,代码行数:21,代码来源:trex_rpc_cmd_general.cpp

示例5: catch

/**
 * acquire device
 * 
 */
trex_rpc_cmd_rc_e
TrexRpcCmdAcquire::_run(const Json::Value &params, Json::Value &result) {

    uint8_t port_id = parse_port(params, result);

    const string  &new_owner  = parse_string(params, "user", result);
    bool force = parse_bool(params, "force", result);
    uint32_t session_id = parse_uint32(params, "session_id", result);

    /* if not free and not you and not force - fail */
    TrexStatelessPort *port = get_stateless_obj()->get_port_by_id(port_id);

    try {
        port->acquire(new_owner, session_id, force);
    } catch (const TrexException &ex) {
        generate_execute_err(result, ex.what());
    }

    result["result"] = port->get_owner().get_handler();

    return (TREX_RPC_CMD_OK);
}
开发者ID:RaminNietzsche,项目名称:trex-core,代码行数:26,代码来源:trex_rpc_cmd_general.cpp


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