summaryrefslogtreecommitdiff
path: root/include/maat_command.h
blob: b0cf21130bc8e500e4fbbce812427551a9517863 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
**********************************************************************************************
*	File: maat_command.h
*   Description: 
*	Authors: Liu WenTan <[email protected]>
*	Date:    2022-10-31
*   Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
***********************************************************************************************
*/

#ifndef _MAAT_COMMAND_H_
#define _MAAT_COMMAND_H_

#ifdef __cplusplus
extern "C"
{
#endif

#include <limits.h>

#include "maat.h"

struct maat_cmd_line {
	const char *table_name;
	const char *table_line;
	const char *rule_uuid_str;		// for MAAT_OP_DEL, only rule_id and table_name are necessary.
	int expire_after;	//expired after $timeout$ seconds, set to 0 for never timeout.
};

/**
 * @brief write one line to redis
 * 
 * @retval 
 *      success: number of successfully updated rule.
 *      failed: -1
*/
int maat_cmd_set_line(struct maat *maat_instance, const struct maat_cmd_line *line_rule, enum maat_operation op);

int maat_cmd_set_file(struct maat *maat_instance, const char *key, const char *value, 
                      size_t size, enum maat_operation op);
                      
long long maat_cmd_incrby(struct maat *maat_instance, const char *key, int increment);

int maat_cmd_flushDB(struct maat *maat_instance);

#ifdef __cplusplus
}
#endif

#endif