2024-03-27 11:19:39 +00:00
|
|
|
#pragma once
|
2024-04-03 16:47:30 +08:00
|
|
|
|
2024-03-27 11:19:39 +00:00
|
|
|
#include "maat_utils.h"
|
|
|
|
|
#include "maat_command.h"
|
2024-04-03 16:47:30 +08:00
|
|
|
#include "ip_matcher/ip_matcher.h"
|
|
|
|
|
|
2024-09-27 11:38:41 +00:00
|
|
|
struct maat_cmd_condition {
|
|
|
|
|
const char *object_uuids_str[8];
|
|
|
|
|
int object_num;
|
|
|
|
|
int negate_option;
|
|
|
|
|
const char *attribute_name;
|
|
|
|
|
};
|
2024-04-03 16:47:30 +08:00
|
|
|
int write_json_to_redis(const char *json_filename, char *redis_ip, int redis_port,
|
|
|
|
|
int redis_db, struct log_handle *logger);
|
|
|
|
|
|
2024-08-22 03:11:15 +00:00
|
|
|
int rule_table_set_line(struct maat *maat_inst, const char *table_name,
|
2024-09-27 11:38:41 +00:00
|
|
|
enum maat_operation op, uuid_t rule_uuid,
|
|
|
|
|
const char *user_region, struct maat_cmd_condition conditions[],
|
|
|
|
|
int condition_num, int expire_after);
|
2024-04-03 16:47:30 +08:00
|
|
|
|
2024-08-22 10:26:59 +00:00
|
|
|
int object2object_table_set_line(struct maat *maat_inst, const char *table_name,
|
|
|
|
|
enum maat_operation op, long long object_id,
|
|
|
|
|
long long sub_object_id, int expire_after);
|
2024-04-03 16:47:30 +08:00
|
|
|
|
2024-03-27 11:19:39 +00:00
|
|
|
int expr_table_set_line(struct maat *maat_inst, const char *table_name,
|
|
|
|
|
enum maat_operation op, long long item_id,
|
2024-08-22 10:26:59 +00:00
|
|
|
long long object_id, const char *keywords,
|
2024-08-19 11:04:17 +00:00
|
|
|
const char *district, int expr_type, int expire_after);
|
2024-04-03 16:47:30 +08:00
|
|
|
|
2024-03-27 11:19:39 +00:00
|
|
|
int interval_table_set_line(struct maat *maat_inst, const char *table_name,
|
2024-08-13 03:35:50 +00:00
|
|
|
enum maat_operation op, long long item_id,
|
2024-08-22 10:26:59 +00:00
|
|
|
long long object_id, const char *port_str,
|
2024-08-13 03:35:50 +00:00
|
|
|
const char *district, int expire_after);
|
2024-04-03 16:47:30 +08:00
|
|
|
|
2024-03-27 11:19:39 +00:00
|
|
|
int ip_table_set_line(struct maat *maat_inst, const char *table_name,
|
|
|
|
|
enum maat_operation op, long long item_id,
|
2024-08-22 10:26:59 +00:00
|
|
|
long long object_id, const char *ip, int expire_after);
|
2024-04-03 16:47:30 +08:00
|
|
|
|
2024-03-27 11:19:39 +00:00
|
|
|
int flag_table_set_line(struct maat *maat_inst, const char *table_name,
|
2024-04-03 16:47:30 +08:00
|
|
|
enum maat_operation op, long long item_id,
|
2024-08-22 10:26:59 +00:00
|
|
|
long long object_id, long long flag,
|
2024-04-03 16:47:30 +08:00
|
|
|
long long flag_mask, int expire_after);
|
|
|
|
|
|
|
|
|
|
void random_keyword_generate(char *keyword_buf, size_t sz);
|