2024-07-16 03:16:27 +02:00
|
|
|
/*
|
|
|
|
* Alertik: a tiny 'syslog' server & notification tool for Mikrotik routers.
|
|
|
|
* This is free and unencumbered software released into the public domain.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NOTIFIERS_H
|
|
|
|
#define NOTIFIERS_H
|
|
|
|
|
|
|
|
/* Uncomment/comment to enable/disable the following settings. */
|
|
|
|
// #define CURL_VERBOSE
|
|
|
|
// #define VALIDATE_CERTS
|
|
|
|
// #define DISABLE_NOTIFICATIONS
|
|
|
|
|
2024-07-19 03:41:19 +02:00
|
|
|
/*
|
|
|
|
* Notifier indexes.
|
|
|
|
*/
|
2024-07-26 03:40:19 +02:00
|
|
|
#define NUM_NOTIFIERS 8
|
|
|
|
#define NOTIFY_IDX_TELE 0
|
|
|
|
#define NOTIFY_IDX_SLACK 1
|
2024-07-28 23:00:36 +02:00
|
|
|
#define NOTIFY_IDX_TEAMS 2
|
|
|
|
#define NOTIFY_IDX_DISCORD 3
|
2024-07-26 03:40:19 +02:00
|
|
|
#define NOTIFY_IDX_GENRC1 (NUM_NOTIFIERS-4)
|
|
|
|
#define NOTIFY_IDX_GENRC2 (NUM_NOTIFIERS-3)
|
|
|
|
#define NOTIFY_IDX_GENRC3 (NUM_NOTIFIERS-2)
|
|
|
|
#define NOTIFY_IDX_GENRC4 (NUM_NOTIFIERS-1)
|
2024-07-19 03:41:19 +02:00
|
|
|
|
2024-07-16 03:16:27 +02:00
|
|
|
#define CURL_USER_AGENT "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 " \
|
|
|
|
"(KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
|
|
|
|
|
2024-07-18 03:41:58 +02:00
|
|
|
/* Minimum time (in secs) between two */
|
|
|
|
#define LAST_SENT_THRESHOLD_SECS 10
|
|
|
|
|
2024-07-16 03:16:27 +02:00
|
|
|
/* Notifiers list, like:
|
|
|
|
* - Telegram
|
|
|
|
* - Slack
|
|
|
|
* - Discord
|
|
|
|
* - Teams
|
|
|
|
*/
|
|
|
|
extern const char *const notifiers_str[NUM_NOTIFIERS];
|
|
|
|
|
|
|
|
/* Notifier struct. */
|
|
|
|
struct notifier {
|
2024-07-28 23:00:36 +02:00
|
|
|
void *data;
|
|
|
|
void(*setup)(struct notifier *self);
|
|
|
|
int(*send_notification)(const struct notifier *self, const char *msg);
|
2024-07-16 03:16:27 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern struct notifier notifiers[NUM_NOTIFIERS];
|
2024-07-18 03:41:58 +02:00
|
|
|
extern int is_within_notify_threshold(void);
|
|
|
|
extern void update_notify_last_sent(void);
|
2024-07-16 03:16:27 +02:00
|
|
|
|
|
|
|
#endif /* NOTIFIERS_H */
|