source: MondoRescue/branches/stable/monitas/structs.h@ 352

Last change on this file since 352 was 352, checked in by bcornec, 18 years ago

monitas v0.1a

File size: 2.6 KB
Line 
1/* structs.h
2
3
406/16
5- added CLIENT_RCFILE
6- added .bodyAux to msg record structure
7
806/14
9- added SERVER_COMDEV and CLIENT_COMDEV
10
1106/11
12- added busy to s_registered_client_record structure
13- added compare_ok, compare_fail
14
1505/27
16- added pthread.h
17
1805/11
19- added file transfer flags to type t_msg
20
21*/
22
23
24
25#include <pthread.h>
26#include <stdio.h>
27#include <string.h>
28#include <errno.h>
29#include <pthread.h>
30#include <sys/file.h>
31#include <sys/types.h>
32#include <sys/stat.h>
33#include <signal.h>
34#include <sys/socket.h>
35#include <unistd.h>
36#include <netdb.h>
37#include <stdlib.h>
38#include <sys/time.h>
39#include <sys/wait.h>
40#include <sys/poll.h>
41#include <time.h>
42#include <ctype.h>
43#include <unistd.h>
44#include <fcntl.h>
45
46
47#define log_it(x,y) { log_it_SUB(g_logfile,x,y); }
48#define CLIENT_RCFILE "/root/.monitas-client.rc"
49#define CLIENT_COMDEV "/var/spool/monitas/client-input.dev"
50#define SERVER_COMDEV "/var/spool/monitas/server-input.dev"
51#define SERVER_STATUS_FILE "/var/spool/monitas/server-status.txt"
52#define MAX_STR_LEN 510
53#define MAX_PENDING 8 /* silently limited to 5 by BSD, says a Linux manual */
54#define MAX_CLIENTS 100
55#define MSG_BODY_SIZE 200 /* 512 doesn't work; don't ask me why */
56#define XFER_BUF_SIZE 16384 /* for sending archives between client and server */
57 /* NB: 32768 doesn't work; don't ask me why */
58typedef enum { false=0, true=1} bool;
59typedef enum { unused=0, login, logout, ping, pong, login_ok, logout_ok,
60 login_fail, logout_fail, backup_ok, backup_fail,
61 restore_ok, restore_fail, compare_ok, compare_fail,
62 trigger_backup, trigger_restore, trigger_compare,
63 begin_stream, end_stream, user_req, progress_rpt } t_msg;
64typedef enum { debug, info, warn, error, fatal } t_loglevel;
65
66
67struct s_client2server_msg_record /* msg from client to server */
68{
69 t_msg msg_type;
70 long magic;
71 int port; /* which port to contact client on */
72 char body[MSG_BODY_SIZE];
73 char bodyAux[MSG_BODY_SIZE];
74};
75
76
77
78struct s_server2client_msg_record /* msg from client */
79{
80 t_msg msg_type;
81 long magic; /* if pong/ack then it equals the magic# of the packet to which it's replying; else, 0 */
82 int dummy;
83 char body[MSG_BODY_SIZE];
84 char bodyAux[MSG_BODY_SIZE];
85};
86
87
88
89struct s_registered_client_record
90{
91 char hostname_pretty[128]; /* specified by client in login packet */
92 char ipaddr[20]; /* xxx.yyy.zzz.nnn of client */
93 int port;
94 bool busy; /* backing up / restoring / comparing */
95 char last_progress_rpt[MAX_STR_LEN+1];
96};
97
98
99
100struct s_clientlist
101{
102 int items;
103 struct s_registered_client_record el[MAX_CLIENTS];
104};
105
106
Note: See TracBrowser for help on using the repository browser.