...
 
Commits (3)
......@@ -105,7 +105,7 @@ void *intercomm_rpc_server_handler(void *thread_data) {
}
case CONTROLLER_RPC__RPCMESSAGE__TYPE_INVOKE_REQUEST: {
if (handle_remote_invoke_messages(client, request) < 0) {
c_log_err("ERROR:%s:Could not honor remote_invoke request");
c_log_err("ERROR:%s:Could not honor remote_invoke request", __func__);
}
break;
......@@ -114,7 +114,7 @@ void *intercomm_rpc_server_handler(void *thread_data) {
if (handle_fulfill_embedded_messages(client, request) < 0) {
c_log_err("Could not honor fulfill_embedded msg");
client_reply_error(client->transport, "Could not honor fulfill_embedded msg");
return;
return NULL;
}
break;
......@@ -123,7 +123,7 @@ void *intercomm_rpc_server_handler(void *thread_data) {
if (handle_remote_revoke_messages(client, request) < 0) {
c_log_err("Could not fulfill RemoteRevoke req");
client_reply_error(client->transport, "Could not fulfill RemoteRevoke req");
return;
return NULL;
}
break;
......@@ -132,7 +132,7 @@ void *intercomm_rpc_server_handler(void *thread_data) {
if (handle_grant_remote_cap_messages(client, request) < 0) {
c_log_err("Could not fulfill GrantRemoteCap req");
client_reply_error(client->transport, "Could not fulfill GrantRemoteCap req");
return;
return NULL;
}
break;
......@@ -141,7 +141,7 @@ void *intercomm_rpc_server_handler(void *thread_data) {
if (handle_rp_recv_remote_cap_messages(client, request) < 0) {
c_log_err("Could not fulfill RPRecvRemoteCap req");
client_reply_error(client->transport, "Could not fulfill RPRecvRemoteCap req");
return;
return NULL;
}
break;
......
......@@ -1887,6 +1887,15 @@ int cn_rp_push(cn_rp_t *rp, struct cn_rp_elem *elem) {
return 0;
}
int cn_rp_peek(cn_rp_t *rp, struct cn_rp_elem **o_elem) {
cn_obj_lock(rp);
struct cn_rp_elem * next_elem = (struct cn_rp_elem *) g_queue_peek_tail(rp->queue);
cn_obj_unlock(rp);
if (next_elem == NULL) { return -1; }
*o_elem = next_elem;
return 0;
}
/* Pop the next item from the queue. Note: DOES NOT DECREF PRINCIPAL. The caller
* needs to decref the principal when it is appropriate. */
int cn_rp_pop_noput(cn_rp_t *rp, struct cn_rp_elem **o_elem) {
......
......@@ -1084,6 +1084,9 @@ int cn_rp_push(cn_rp_t *rp, struct cn_rp_elem *elem);
* the queue. Useful for error recovery. */
int cn_rp_pushfront(cn_rp_t *rp, struct cn_rp_elem *elem);
/* Pek at the next (principal, cptr) pair off the rp's queue */
int cn_rp_peek(cn_rp_t *rp, struct cn_rp_elem **o_elem);
/* Pop the next (principal, cptr) pair off the rp's queue */
int cn_rp_pop(cn_rp_t *rp, struct cn_rp_elem *elem);
......
This diff is collapsed.
......@@ -52,6 +52,62 @@ void fill_shadow_flow_struct_from_shadow_flow_msg(
&(shadow->shadow_flow.dst_node_info));
}
int fill_shadow_struct_from_shadow_msg(ControllerRPC__ShadowReturnResponse* shadow_cap, char* from_ctlr_id, cn_shadow_t** shadow) {
cn_shadow_t *recvd_shadow;
if (cn_shadow_new(&recvd_shadow) < 0) {
c_log_err("ERROR:%s: Failed to create Shadow after receiving remote cptr. "
"Remote end did fine though.", __func__);
return -1;
}
recvd_shadow->remote_end = strdup(shadow_cap->shadow_host);
recvd_shadow->cap_id = ul2cptr(shadow_cap->shadow_cap_id);
recvd_shadow->cap_type = (cn_objtype_t)shadow_cap->shadow_cap_type;
recvd_shadow->obj_id = shadow_cap->shadow_obj_id;
if(shadow_cap->shadow_cap_type == CN_FLOW) {
fill_shadow_flow_struct_from_shadow_flow_msg(
shadow_cap->shadow_flow,
from_ctlr_id,
recvd_shadow);
}
*shadow = recvd_shadow;
return 0;
}
int fill_shadow_response_from_cptr(cn_node_t* requester_proxy, cptr_t cptr, ControllerRPC__ShadowReturnResponse** shadow_resp) {
struct cnode *recvd_cnode;
cn_principal_get(requester_proxy->principal, cptr, &recvd_cnode);
cn_obj_t* recvd_obj = cn_cnode_object(recvd_cnode);
uint64_t recvd_obj_id = (uint64_t)recvd_obj;
cap_cnode_put(recvd_cnode);
ControllerRPC__ShadowReturnResponse* shadow_cap = malloc(sizeof(ControllerRPC__ShadowReturnResponse));
controller_rpc__shadow_return_response__init(shadow_cap);
shadow_cap->shadow_cap_id = cptr2ul(cptr);
shadow_cap->shadow_host = my_controller_id;
shadow_cap->shadow_cap_type = recvd_obj->type;
shadow_cap->shadow_obj_id = recvd_obj_id;
if(recvd_obj->type == CN_FLOW) {
cn_flow_t* recvd_flow = (cn_flow_t*) recvd_obj;
shadow_cap->type_case = CONTROLLER_RPC__SHADOW_RETURN_RESPONSE__TYPE_SHADOW_FLOW;
ControllerRPC__ShadowReturnResponse__ShadowFlow *shadow_flow =
malloc(sizeof(ControllerRPC__ShadowReturnResponse__ShadowFlow));
controller_rpc__shadow_return_response__shadow_flow__init(shadow_flow);
shadow_cap->shadow_flow = shadow_flow;
cn_obj_lock(recvd_flow);
shadow_flow->node_obj_id = (uint64_t)(recvd_flow->node->principal);
ControllerRPC__NodeInfo *flow_node_info = malloc(sizeof(ControllerRPC__NodeInfo));
controller_rpc__node_info__init(flow_node_info);
shadow_flow->node_info = flow_node_info;
fill_node_info_message_from_node(recvd_flow->node, my_controller_id, flow_node_info);
cn_obj_unlock(recvd_flow);
}
*shadow_resp = shadow_cap;
return 0;
}
int fill_capability_message(ControllerRPC__Capability *to_seal_cap, cn_principal_t *as, cptr_t cptr) {
struct cnode* cnode;
if ( cn_principal_get(as, cptr, &cnode) < 0) {
......
......@@ -14,4 +14,13 @@ void fill_shadow_flow_struct_from_shadow_flow_msg(
ControllerRPC__ShadowReturnResponse__ShadowFlow *msg,
const char* from_ctlr_id,
cn_shadow_t* shadow);
int fill_shadow_response_from_cptr(
cn_node_t* requester_proxy,
cptr_t cptr,
ControllerRPC__ShadowReturnResponse** shadow_resp);
int fill_shadow_struct_from_shadow_msg(
ControllerRPC__ShadowReturnResponse* shadow_cap,
char* from_ctlr_id,
cn_shadow_t** shadow);
#endif
......@@ -153,6 +153,19 @@ message MethodInvokeRequest {
required fixed64 requester_id = 1;
required fixed64 cap_id = 2;
}
message NodeGrantGrant {
required fixed64 requester_id = 1;
required fixed64 node_grant_cap_id = 2;
required Capability cap = 3;
}
message MembraneSend {
required fixed64 requester_id = 1;
}
message MembraneRecv {
required fixed64 requester_id = 1;
required NodeInfo requester_info = 2;
required fixed64 mem_cap = 3;
}
message SealerUnsealerSeal {
required fixed64 requester_id = 1;
required NodeInfo requester_info = 2;
......@@ -164,19 +177,18 @@ message MethodInvokeRequest {
required fixed64 requester_id = 1;
required Capability cap = 2;
}
message NodeGrantGrant {
required fixed64 requester_id = 1;
required fixed64 node_grant_cap_id = 2;
required Capability cap = 3;
}
oneof type {
RPSend rp_send = 1;
RPRecv rp_recv = 2;
ReqNodeInfo node_info = 3;
NodeReset node_reset = 4;
SealerUnsealerSeal sealer_unsealer_seal = 5;
SealerUnsealerUnseal sealer_unsealer_unseal = 6;
NodeGrantGrant node_grant_grant = 7;
NodeGrantGrant node_grant_grant = 5;
MembraneSend membrane_send = 6;
MembraneRecv membrane_recv = 7;
SealerUnsealerSeal sealer_unsealer_seal = 8;
SealerUnsealerUnseal sealer_unsealer_unseal = 9;
}
}
......