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


C++ MFILE::get_buf方法代码示例

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


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

示例1: get_reply

// get reply from server.  Caller must free buf
//
int RPC_CLIENT::get_reply(char*& mbuf) {
    char buf[8193];
    MFILE mf;
    int n;

    while (1) {
        n = recv(sock, buf, 8192, 0);
        if (n <= 0) return ERR_READ;
        buf[n]=0;
        mf.puts(buf);
        if (strchr(buf, '\003')) break;
    }
    mf.get_buf(mbuf, n);
    return 0;
}
开发者ID:Ashod,项目名称:Boinc,代码行数:17,代码来源:gui_rpc_client.cpp

示例2: get_reply

/// Get reply from server. 
/// Caller must free the buffer.
///
/// \param[in,out] mbuf Reference to a pointer which will point to the
///                     string received from the rpc-server.
/// \return Zero on success, ERR_READ on error.
int RPC_CLIENT::get_reply(char*& mbuf) {
    MFILE mf;
    int n;

    while (true) {
        char buf[8193];
        n = recv(sock, buf, sizeof(buf) - 1, 0);
        if (n <= 0) {
            return ERR_READ;
        }
        buf[n]=0;
        mf.puts(buf);
        if (strchr(buf, '\003')) {
            break;
        }
    }
    mf.get_buf(mbuf, n);
    return 0;
}
开发者ID:phenix3443,项目名称:synecdoche,代码行数:25,代码来源:gui_rpc_client.C

示例3: handle_rpc


//.........这里部分代码省略.........
    } else if (match_req(request_msg, "get_global_prefs_override")) {
        handle_get_global_prefs_override(mf);
    } else if (match_req(request_msg, "set_global_prefs_override")) {
        handle_set_global_prefs_override(request_msg, mf);
    } else if (match_req(request_msg, "get_cc_config")) {
        handle_get_cc_config(mf);
    } else if (match_req(request_msg, "set_cc_config")) {
        handle_set_cc_config(request_msg, mf);
    } else if (match_req(request_msg, "read_cc_config")) {
        mf.printf("<success/>\n");
        read_config_file(false);
        config.show();
        log_flags.show();
        gstate.set_ncpus();
        gstate.request_schedule_cpus("Core client configuration");
        gstate.request_work_fetch("Core client configuration");
#ifndef USE_REC
    } else if (match_req(request_msg, "set_debts")) {
        handle_set_debts(request_msg, mf);
#endif
    } else if (match_req(request_msg, "get_notices")) {
        handle_get_notices(request_msg, *this, mf, false);
        clear_notice_refresh();
    } else if (match_req(request_msg, "battery_info")) {
        handle_battery_info(request_msg, is_local, mf);
    } else {

        // RPCs after this point require authentication,
        // and enable network communication for 5 minutes,
        // overriding other factors.
        // Things like attaching projects, etc.
        //

        double saved_time = gstate.gui_rpcs.time_of_last_rpc_needing_network;
        gstate.gui_rpcs.time_of_last_rpc_needing_network = gstate.now;

        if (match_req(request_msg, "retry_file_transfer")) {
            handle_file_transfer_op(request_msg, mf, "retry");
        } else if (match_req(request_msg, "project_reset")) {
            handle_project_op(request_msg, mf, "reset");
        } else if (match_req(request_msg, "project_update")) {
            handle_project_op(request_msg, mf, "update");
        } else if (match_req(request_msg, "get_project_config")) {
            handle_get_project_config(request_msg, mf);
        } else if (match_req(request_msg, "get_project_config_poll")) {
            handle_get_project_config_poll(request_msg, mf);
        } else if (match_req(request_msg, "lookup_account")) {
            handle_lookup_account(request_msg, mf);
        } else if (match_req(request_msg, "lookup_account_poll")) {
            handle_lookup_account_poll(request_msg, mf);
        } else if (match_req(request_msg, "create_account")) {
            handle_create_account(request_msg, mf);
        } else if (match_req(request_msg, "create_account_poll")) {
            handle_create_account_poll(request_msg, mf);
        } else if (match_req(request_msg, "project_attach")) {
            handle_project_attach(request_msg, mf);
        } else if (match_req(request_msg, "project_attach_poll")) {
            handle_project_attach_poll(request_msg, mf);
        } else if (match_req(request_msg, "acct_mgr_rpc")) {
            handle_acct_mgr_rpc(request_msg, mf);
        } else if (match_req(request_msg, "acct_mgr_rpc_poll")) {
            handle_acct_mgr_rpc_poll(request_msg, mf);

        // DON'T JUST ADD NEW RPCS HERE - THINK ABOUT THEIR
        // AUTHENTICATION AND NETWORK REQUIREMENTS FIRST

        } else {
            mf.printf("<error>unrecognized op: %s</error>\n", request_msg);
            gstate.gui_rpcs.time_of_last_rpc_needing_network = saved_time;
        }
    }

    mf.printf("</boinc_gui_rpc_reply>\n\003");
    m.get_buf(p, n);
    if (http_request) {
        char buf[1024];
        sprintf(buf,
            "HTTP/1.1 200 OK\n"
            "Date: Fri, 31 Dec 1999 23:59:59 GMT\n"
            "Server: BOINC client\n"
            "Connection: close\n"
            "Content-Type: text/xml; charset=utf-8\n"
            "Content-Length: %d\n\n",
            n
        );
        send(sock, buf, strlen(buf), 0);
    }
    if (p) {
        send(sock, p, n, 0);
        p[n-1]=0;   // replace 003 with NULL
        if (log_flags.gui_rpc_debug) {
            if (n > 128) p[128] = 0;
            msg_printf(0, MSG_INFO,
                "[gui_rpc] GUI RPC reply: '%s'\n", p
            );
        }
        free(p);
    }
    return retval;
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:101,代码来源:gui_rpc_server_ops.cpp

示例4: handle_rpc


//.........这里部分代码省略.........
        handle_project_op(request_msg, mf, "resume");
    } else if (match_req(request_msg, "set_run_mode")) {
        handle_set_run_mode(request_msg, mf);
    } else if (match_req(request_msg, "set_gpu_mode")) {
        handle_set_gpu_mode(request_msg, mf);
    } else if (match_req(request_msg, "quit")) {
        handle_quit(request_msg, mf);
    } else if (match_req(request_msg, "acct_mgr_info")) {
        handle_acct_mgr_info(request_msg, mf);
    } else if (match_req(request_msg, "read_global_prefs_override")) {
        mf.printf("<success/>\n");
        gstate.read_global_prefs();
        gstate.request_schedule_cpus("Preferences override");
        gstate.request_work_fetch("Preferences override");
    } else if (match_req(request_msg, "get_project_init_status")) {
        handle_get_project_init_status(request_msg, mf);
    } else if (match_req(request_msg, "get_global_prefs_file")) {
        handle_get_global_prefs_file(mf);
    } else if (match_req(request_msg, "get_global_prefs_working")) {
        handle_get_global_prefs_working(mf);
    } else if (match_req(request_msg, "get_global_prefs_override")) {
        handle_get_global_prefs_override(mf);
    } else if (match_req(request_msg, "set_global_prefs_override")) {
        handle_set_global_prefs_override(request_msg, mf);
    } else if (match_req(request_msg, "get_cc_config")) {
        handle_get_cc_config(mf);
    } else if (match_req(request_msg, "set_cc_config")) {
        handle_set_cc_config(request_msg, mf);
    } else if (match_req(request_msg, "read_cc_config")) {
        mf.printf("<success/>\n");
        read_config_file(false);
        msg_printf(0, MSG_INFO, "Re-read config file");
        config.show();
        log_flags.show();
        gstate.set_ncpus();
        gstate.request_schedule_cpus("Core client configuration");
        gstate.request_work_fetch("Core client configuration");
    } else if (match_req(request_msg, "set_debts")) {
        handle_set_debts(request_msg, mf);
    } else {

        // RPCs after this point require authentication,
        // and enable network communication for 5 minutes, overriding other factors.
        // Things like attaching projects, etc.
        //

        double saved_time = gstate.gui_rpcs.time_of_last_rpc_needing_network;
        gstate.gui_rpcs.time_of_last_rpc_needing_network = gstate.now;

        if (match_req(request_msg, "retry_file_transfer")) {
            handle_file_transfer_op(request_msg, mf, "retry");
        } else if (match_req(request_msg, "project_reset")) {
            handle_project_op(request_msg, mf, "reset");
        } else if (match_req(request_msg, "project_update")) {
            handle_project_op(request_msg, mf, "update");
        } else if (match_req(request_msg, "get_project_config")) {
            handle_get_project_config(request_msg, mf);
        } else if (match_req(request_msg, "get_project_config_poll")) {
            handle_get_project_config_poll(request_msg, mf);
        } else if (match_req(request_msg, "lookup_account")) {
            handle_lookup_account(request_msg, mf);
        } else if (match_req(request_msg, "lookup_account_poll")) {
            handle_lookup_account_poll(request_msg, mf);
        } else if (match_req(request_msg, "create_account")) {
            handle_create_account(request_msg, mf);
        } else if (match_req(request_msg, "create_account_poll")) {
            handle_create_account_poll(request_msg, mf);
        } else if (match_req(request_msg, "project_attach")) {
            handle_project_attach(request_msg, mf);
        } else if (match_req(request_msg, "project_attach_poll")) {
            handle_project_attach_poll(request_msg, mf);
        } else if (match_req(request_msg, "acct_mgr_rpc")) {
            handle_acct_mgr_rpc(request_msg, mf);
        } else if (match_req(request_msg, "acct_mgr_rpc_poll")) {
            handle_acct_mgr_rpc_poll(request_msg, mf);

        // DON'T JUST ADD NEW RPCS HERE - THINK ABOUT THEIR
        // AUTHENTICATION AND NETWORK REQUIREMENTS FIRST

        } else {
            mf.printf("<error>unrecognized op: %s</error>\n", request_msg);
            gstate.gui_rpcs.time_of_last_rpc_needing_network = saved_time;
        }
    }

    mf.printf("</boinc_gui_rpc_reply>\n\003");
    m.get_buf(p, n);
    if (p) {
        send(sock, p, n, 0);
        p[n-1]=0;   // replace 003 with NULL
        if (log_flags.guirpc_debug) {
            if (n > 50) p[50] = 0;
            msg_printf(0, MSG_INFO,
                "[guirpc_debug] GUI RPC reply: '%s'\n", p
            );
        }
        free(p);
    }
    return retval;
}
开发者ID:Rytiss,项目名称:native-boinc-for-android,代码行数:101,代码来源:gui_rpc_server_ops.cpp


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