summaryrefslogtreecommitdiff
path: root/cesar/host
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/host')
-rw-r--r--cesar/host/fcall/src/fcall.c9
-rw-r--r--cesar/host/fcall/src/probe.c31
2 files changed, 17 insertions, 23 deletions
diff --git a/cesar/host/fcall/src/fcall.c b/cesar/host/fcall/src/fcall.c
index 0719f8261f..57634449ef 100644
--- a/cesar/host/fcall/src/fcall.c
+++ b/cesar/host/fcall/src/fcall.c
@@ -155,7 +155,7 @@ int fcall_fill_hdr(
errno = EINVAL;
return -1;
}
-
+
param->id[FUNCTION_CALL_ID_MAX_SIZE - 1] = '\0'; /* just for security */
/* add the function id */
if(sci_msg_push(msg, strlen(param->id) + 1) < (int)strlen(param->id) + 1)
@@ -165,7 +165,7 @@ int fcall_fill_hdr(
return -1;
}
memcpy(msg->data_begin, param->id, strlen(param->id) + 1);
-
+
/* add fcall header */
if(sci_msg_push(msg, sizeof(struct fcall_msg_hdr)) < (int)sizeof(struct fcall_msg_hdr))
{
@@ -180,7 +180,7 @@ int fcall_fill_hdr(
msg->hdr.fcall->param_nb = param->param_nb;
msg->hdr.fcall->msg_id = htons(param->msg_id);
msg->hdr.fcall->flags = flags;
-
+
return 0;
}
@@ -421,6 +421,9 @@ int fcall_recv(sci_msg_t *msg, void *fcall_data)
return -1;
}
+ /* RESET THE MESSAGE DATA BEGIN POINTER!!! */
+ msg->data_begin = msg->data_end;
+
/* call the function */
station_log(fcall->sci->station, STATION_LOG_INFO, STATION_LOGTYPE_FCALL,
"%s calling function '%s'(%p) with %d parameters",
diff --git a/cesar/host/fcall/src/probe.c b/cesar/host/fcall/src/probe.c
index 4986821477..76a09e3da3 100644
--- a/cesar/host/fcall/src/probe.c
+++ b/cesar/host/fcall/src/probe.c
@@ -140,9 +140,7 @@ int probe_recv(fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void
int index_param, index_var;
probe_ctx_t *probe;
static fcall_param_t param_result;
- static sci_msg_t msg_result;
- static unsigned char buffer[FUNCTION_CALL_PARAM_MAX_SIZE];
-
+
probe = (probe_ctx_t *)data;
DBG_ASSERT(fcall);
@@ -161,16 +159,10 @@ int probe_recv(fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void
errno = EINVAL;
return -1;
}
-
+
/* init result structures */
fcall_param_init(&param_result, (*param)->id, (*param)->msg_id);
- if(sci_msg_init(&msg_result, buffer, sizeof(buffer)) < 0)
- {
- station_log(fcall->sci->station, STATION_LOG_ERROR, STATION_LOGTYPE_PROBE,
- "%s: errno = %d because cannot init result structures", __FUNCTION__, errno);
- return -1;
- }
-
+
if((*param)->param_nb == 0)
{
/* we want all the var list */
@@ -180,7 +172,7 @@ int probe_recv(fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void
{
fcall_param_add(
&param_result,
- &msg_result,
+ *msg,
probe->var_table[index_var].id,
probe->var_table[index_var].length,
probe->var_table[index_var].addr
@@ -188,7 +180,7 @@ int probe_recv(fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void
}
}
}
-
+
else
{
/* normal get or set request */
@@ -213,7 +205,7 @@ int probe_recv(fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void
);
fcall_param_add(
&param_result,
- &msg_result,
+ *msg,
probe->var_table[index_var].id,
probe->var_table[index_var].length,
probe->var_table[index_var].addr
@@ -243,7 +235,7 @@ int probe_recv(fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void
);
fcall_param_add(
&param_result,
- &msg_result,
+ *msg,
probe->var_table[index_var].id,
0,
NULL
@@ -256,8 +248,8 @@ int probe_recv(fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void
if(index_var >= probe->var_nb)
{
/* variable not registered */
- msg_result.hdr.fcall->param_nb = 0;
- msg_result.hdr.fcall->flags |= FUNCTION_CALL_FLAG_FAILED;
+ (*msg)->hdr.fcall->param_nb = 0;
+ (*msg)->hdr.fcall->flags |= FUNCTION_CALL_FLAG_FAILED;
station_log(fcall->sci->station, STATION_LOG_NOTICE, STATION_LOGTYPE_PROBE,
"%s var '%s' not registered",
__FUNCTION__,
@@ -266,10 +258,9 @@ int probe_recv(fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void
}
}
}
-
+
/* switch param and msg for result */
*param = &param_result;
- *msg = &msg_result;
-
+
return param_result.param_nb;
}