yasnd/yasnd.h

62 lines
1.7 KiB
C
Raw Normal View History

#ifndef YASND_H
#define YASND_H
// Debug verbosity
#define DEBUG_BASE 1
#define DEBUG_ALL 2
// IPC message types
#define SMS_SEND_TYPE 1
#define SMS_RECEIVE_TYPE 2
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <stdbool.h>
2011-11-30 16:21:34 +04:00
#include <string.h>
#define _GNU_SOURCE
#include <sched.h>
// Structure, that described single checked host
typedef struct {
char* hostname; // address of host
2011-12-19 15:19:18 +04:00
int lpt_pin; // pin on LPT control circuit for reset
pid_t helper_pid; // pid of helper('pinger') child process
int fail_count; // how many times in a row host was unreachable
bool alert_sent; // variable, that changed when host goes online/offline
bool reaction_obtained; // variable, that changed when reaction on it's behaviour obtained
} host_decl;
// Structure, that described single IPC message
typedef struct {
long mtype; /* Message type */
char mtext[100];
} mymsgbuf;
// External functions
extern void log_event(const char *message);
extern void log_debug(const char *message,int verbosity);
extern void* allocate_memory(int bytes);
extern bool gammu_init();
extern bool gammu_send_sms(const char* message);
2011-12-20 17:02:34 +04:00
extern bool gammu_read_sms();
extern void ipc_init();
extern void ipc_free();
extern int send_message(int qid, mymsgbuf* qbuf);
extern void gammu_free();
2011-11-30 16:21:34 +04:00
// External variables
extern int hosts_count; // count of hosts
extern int debug_flag;
extern char* recipient_number;
extern char* phone_device; // phone device for gammu, for example: "/dev/ttyACM0"
extern char* phone_model; // gammu phone model, for example: "at"
extern char* phone_connection; // gammu phone connection type, for example: "at"
extern bool sms_send_enable;
extern int qid;
#endif