Loading src/common/network/proto/rpc_types.c +70 −0 Original line number Diff line number Diff line Loading @@ -354,3 +354,73 @@ hg_proc_ADM_adhoc_context_t(hg_proc_t proc, void* data) { return ret; } hg_return_t hg_proc_ADM_pfs_context_t(hg_proc_t proc, void* data) { hg_return_t ret = HG_SUCCESS; ADM_pfs_context_t* ctx = (ADM_pfs_context_t*) data; ADM_pfs_context_t tmp = NULL; hg_size_t ctx_length = 0; switch(hg_proc_get_op(proc)) { case HG_ENCODE: // find out the length of the context ctx_length = *ctx ? sizeof(adm_pfs_context) : 0; ret = hg_proc_hg_size_t(proc, &ctx_length); if(ret != HG_SUCCESS) { break; } if(!ctx_length) { return HG_SUCCESS; } // if not NULL, write the context tmp = *ctx; ret = hg_proc_adm_pfs_context(proc, tmp); if(ret != HG_SUCCESS) { break; } break; case HG_DECODE: { // find out the length of the context ret = hg_proc_hg_size_t(proc, &ctx_length); if(ret != HG_SUCCESS) { break; } if(!ctx_length) { *ctx = NULL; break; } // if not NULL, read the context tmp = (ADM_pfs_context_t) calloc(1, sizeof(struct adm_pfs_context)); ret = hg_proc_adm_pfs_context(proc, tmp); if(ret != HG_SUCCESS) { break; } // return the newly-created ctx *ctx = tmp; break; } case HG_FREE: tmp = *ctx; free(tmp); ret = HG_SUCCESS; break; } return ret; } Loading
src/common/network/proto/rpc_types.c +70 −0 Original line number Diff line number Diff line Loading @@ -354,3 +354,73 @@ hg_proc_ADM_adhoc_context_t(hg_proc_t proc, void* data) { return ret; } hg_return_t hg_proc_ADM_pfs_context_t(hg_proc_t proc, void* data) { hg_return_t ret = HG_SUCCESS; ADM_pfs_context_t* ctx = (ADM_pfs_context_t*) data; ADM_pfs_context_t tmp = NULL; hg_size_t ctx_length = 0; switch(hg_proc_get_op(proc)) { case HG_ENCODE: // find out the length of the context ctx_length = *ctx ? sizeof(adm_pfs_context) : 0; ret = hg_proc_hg_size_t(proc, &ctx_length); if(ret != HG_SUCCESS) { break; } if(!ctx_length) { return HG_SUCCESS; } // if not NULL, write the context tmp = *ctx; ret = hg_proc_adm_pfs_context(proc, tmp); if(ret != HG_SUCCESS) { break; } break; case HG_DECODE: { // find out the length of the context ret = hg_proc_hg_size_t(proc, &ctx_length); if(ret != HG_SUCCESS) { break; } if(!ctx_length) { *ctx = NULL; break; } // if not NULL, read the context tmp = (ADM_pfs_context_t) calloc(1, sizeof(struct adm_pfs_context)); ret = hg_proc_adm_pfs_context(proc, tmp); if(ret != HG_SUCCESS) { break; } // return the newly-created ctx *ctx = tmp; break; } case HG_FREE: tmp = *ctx; free(tmp); ret = HG_SUCCESS; break; } return ret; }