aboutsummaryrefslogtreecommitdiffstats
path: root/tbl_qcmd.c
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-04-20 16:17:32 +0100
committerFreeArtMan <dos21h@gmail.com>2017-04-20 16:17:32 +0100
commitfc91eba3845a9e9c741da41ba467c042cbb4ca85 (patch)
tree8f2e0fb9ac5aa873e1e53a6dbde7338bc1866be9 /tbl_qcmd.c
parent5007608202739ed1835ffc10a54dba02bc0f361f (diff)
downloadagni-fc91eba3845a9e9c741da41ba467c042cbb4ca85.tar.gz
agni-fc91eba3845a9e9c741da41ba467c042cbb4ca85.zip
callback execution works
Diffstat (limited to 'tbl_qcmd.c')
-rw-r--r--tbl_qcmd.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/tbl_qcmd.c b/tbl_qcmd.c
index deef61f..3071999 100644
--- a/tbl_qcmd.c
+++ b/tbl_qcmd.c
@@ -70,6 +70,42 @@ int tbl_exec_in_s(tbl_exec *tbl, char *cmd)
return -1;
}
+int tbl_exec_run(tbl_exec *tbl, char *cmd, void **resp)
+{
+ int ret=-1;
+
+ int i;
+ tble_exec *el=NULL;
+
+ if ((tbl == NULL) || (cmd == NULL) || (resp==NULL) || (*resp != NULL))
+ {
+ PERM();
+ return -1;
+ }
+
+ for (i=0;i<tbl->size;i++)
+ {
+ el = tbl->cmd[i];
+ if (strncmp(el->cmd, cmd, strlen(el->cmd))==0)
+ {
+ void *ret_resp=NULL;
+
+ //execute callback
+ PRINT("EXEC CLB ID %d\n",i);
+ ret_resp = el->callback(NULL); //no params for now
+
+ //return
+ if (ret_resp != NULL)
+ {
+ *resp = ret_resp;
+ ret = i;
+ }
+ }
+ }
+
+ return ret;
+}
+
tble_exec *tbl_exec_search_cmd(tbl_exec *tbl, tble_qcmd *cmd)
{
tble_exec *ret = NULL;