diff options
Diffstat (limited to 'tbl_qcmd.h')
-rw-r--r-- | tbl_qcmd.h | 48 |
1 files changed, 25 insertions, 23 deletions
@@ -21,6 +21,7 @@ typedef struct tble_exec char *name; /*module name, can be used just for note*/ char *cmd; /*command name*/ int type; + void *(*callback)(void *); //callback } tble_exec; #define TBL_PF_EXEC_ID 1<<1 @@ -35,18 +36,21 @@ Fields: */ typedef struct tbl_exec { + int id; int size; int max_size; - tble_exec **reg_cmd; + tble_exec **cmd; } tbl_exec; -#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 -#define QCMD_RUNNING 3 //command still in execution state -#define QCMD_PREPARE 4 //something need to be done before make it to run -#define QCMD_REPLY 5 //this is replay for command -#define QCMD_NOTFOUDN 6 //command isnot found +#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 +#define QCMD_RUNNING 3 //command still in execution state +#define QCMD_PREPARE 4 //something need to be done before make it to run +#define QCMD_REPLY 5 //there is replay for command +#define QCMD_NOTFOUND 6 //command cant find executor +#define QCMD_READY 7 //command ready to start execution +#define QCMD_INIT 8 //command is set, need to find executor /* Fields: */ @@ -61,7 +65,8 @@ typedef struct tble_qcmd char *param; //params ALLOC mqd_t out_q; //UNUSED mqd_t in_q; //UNUSED - int idx_exec; //table unique id of executor, check if still there ;] + int tid; //table id + int tidx; //table unique id of executor, check if still there ;] } tble_qcmd; //list of print fields @@ -74,7 +79,8 @@ typedef struct tble_qcmd #define TBL_PF_QCMD_PARAM 1<<7 #define TBL_PF_QCMD_OUT_Q 1<<8 #define TBL_PF_QCMD_IN_Q 1<<9 -#define TBL_PF_QCMD_IDX_EXEC 1<<10 +#define TBL_PF_QCMD_TID 1<<10 +#define TBL_PF_QCMD_TIDX 1<<11 #define TBL_PF_QCMD_ALL 0x0fffffff @@ -84,6 +90,7 @@ Fields: */ typedef struct tbl_qcmd { + int id; int size; int max_size; tble_qcmd **cmd; /*list of command executing and waiting for replay*/ @@ -166,10 +173,10 @@ Input: tbl - table of executed commands cmd - command name to search in the list Output: - >=0 - if everything whent ok - -1 - if there was some kind of mistake + !NULL - if everything whent ok, NOFREE + NULL - if there was some kind of mistake */ -tble_exec *tbl_exec_search_cmd(tbl_exec *tbl, char *cmd); +tble_exec *tbl_exec_search_cmd(tbl_exec *tbl, tble_qcmd *cmd); int tbl_exec_print(tble_exec *tble, int flags); @@ -203,15 +210,12 @@ Output: tbl_qcmd* tbl_qcmd_c(int size); /* -add info from executor to command +Match command with execution table. Set id if its match some command. +There could be multiple tables Input: - tbl - array of executed commands - cmd - command to be added to execution list Output: - 0 - if everything whent ok - -1 - if there was some kind of mistake */ -int tbl_qcmd_set_exec(tble_qcmd *qcmd, tble_exec *exec); +int tbl_qcmd_exec(tbl_qcmd *tcmd, tbl_exec *texec); /* add command to executed array @@ -260,7 +264,8 @@ int tbl_qcmd_resp(tbl_qcmd *tbl, tble_cmd_resp *resp); /* -create cmd param. take command and create parametrs to pass +create cmd param. take command and create parametrs to pass to executor. +command should be in right state to do so. It should be READY Input: Output: !NULL - if everything whent ok @@ -335,9 +340,6 @@ Output: int tbl_qcmd_destroy_table(tbl_qcmd *tbl); - - - /*mvar things*/ //shitty macro #define MVAR_ALLOC_STRC(VNAME,VTYPE,VRET)\ |