aboutsummaryrefslogtreecommitdiffstats
path: root/tbl_qcmd.h
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2017-05-02 17:27:02 +0100
committerFreeArtMan <dos21h@gmail.com>2017-05-02 17:27:02 +0100
commit8933fc1b3890fe892737c1f3e85cc77585f67993 (patch)
tree328b2c0e10c48dae1d9ac0c607d0b8ca419ea047 /tbl_qcmd.h
parentfc91eba3845a9e9c741da41ba467c042cbb4ca85 (diff)
downloadagni-8933fc1b3890fe892737c1f3e85cc77585f67993.tar.gz
agni-8933fc1b3890fe892737c1f3e85cc77585f67993.zip
Commands are now removed from command queue if they are there too long. Commands removed if response for command is recieved
Diffstat (limited to 'tbl_qcmd.h')
-rw-r--r--tbl_qcmd.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/tbl_qcmd.h b/tbl_qcmd.h
index 43357e5..bef4043 100644
--- a/tbl_qcmd.h
+++ b/tbl_qcmd.h
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <mqueue.h>
#include <string.h>
+#include <time.h>
#include "debug.h"
#include "util.h"
@@ -44,6 +45,8 @@ typedef struct tbl_exec
tble_exec **cmd;
} tbl_exec;
+#define QCMD_DEFAULT_TIMEOUT 10 //default amount of seconds to wait replay
+
#define QCMD_NONE 0 //nothing happening with this command
#define QCMD_TIMEOUT 1 //command running to long without result
#define QCMD_DONE 2 //comand finsihed execution
@@ -262,7 +265,7 @@ Output:
int tbl_qcmd_chk(tbl_qcmd *tbl);
/*
-delete command from the list
+delete command from the list, by command position in array
Input:
tbl - array of executed commands
idx - index in array that should be removed
@@ -270,7 +273,20 @@ Output:
0 - if everything whent ok
-1 - if there was some kind of mistake
*/
-int tbl_qcmd_del(tbl_qcmd *tbl, int idx);
+int tbl_qcmd_del_by_idx(tbl_qcmd *tbl, int idx);
+
+/*
+delete command from the list, search command id in the list and delete
+Input:
+ tbl - array of executed commands
+ idx - command id that should be deleted
+Output:
+ 1 - command found and removed
+ 0 - command havent been found or deleted
+ -1 - if there was some kind of error
+*/
+int tbl_qcmd_del_by_id(tbl_qcmd *tbl, int idx);
+
/*
@@ -370,6 +386,8 @@ Output:
*/
int tbl_qcmd_print_tbl(tbl_qcmd *tbl, int flags);
+
+
/*
Input:
Output:
@@ -386,6 +404,18 @@ Output:
*/
int tbl_qcmd_destroy_table(tbl_qcmd *tbl);
+/*
+Check table of commands, remove timedout commands if there was no response.
+Input:
+ tbl - name of command table to use
+Output:
+ 1 0 how many commands where affected, state changes, removed commands and so on
+ 0 - if everything whent ok
+ -1 - some kind of error
+*/
+int tbl_qcmd_mng_states(tbl_qcmd *tbl);
+
+
/*mvar things*/
//shitty macro