DEVEL15-openafs-string-header-cleanup-20071030
[openafs.git] / src / bucoord / bc.p.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  * 
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #include <afs/budb_client.h>
11 #include <afs/afsutil.h>
12
13 #ifdef HAVE_STDIO_H
14 #include <stdio.h>
15 #endif /* HAVE_STDIO_H */
16
17 #include <string.h>
18
19 /*
20  * Represents a host in the config database.
21  */
22 struct bc_hostEntry {
23     struct bc_hostEntry *next;  /*Ptr to next record */
24     char *name;                 /*Stringname for host */
25     struct sockaddr_in addr;    /*Corresponding sockaddr */
26     afs_int32 portOffset;       /*Port=standardPort+portOffset-allows multiple TC on a host */
27 };
28
29 /*
30  * Global backup program configuration information.
31  */
32 struct bc_config {
33     char *path;                 /*Root directory for config info */
34     struct bc_hostEntry *dbaseHosts;    /*Hosts providing the backup database service */
35     struct bc_hostEntry *tapeHosts;     /*Hosts providing the tape drives */
36     struct bc_volumeSet *vset;  /*List of all volume sets */
37     struct bc_dumpSchedule *dsched;     /*Dump schedule list */
38     udbClientTextT configText[TB_NUM];  /* configuration text handles */
39     char tmpTextFileNames[TB_NUM][AFSDIR_PATH_MAX];     /* names of temp files created to store config text recd from buserver */
40 };
41
42 /*
43   * Central status information relating to per-opcode routine information.
44   */
45 struct bc_opstatus {
46     int isCmdLineOpcode;        /*Is this the opcode being done for the command line? */
47 };
48
49 /*
50  * Representation of a Volume Set, namely the specification for a group of
51  * related volumes. Each volume set has a name and a list of volume
52  * descriptions, one for each line in the volumeset configuration file.
53  */
54 #define VSFLAG_TEMPORARY 1      /* Volume set is temporary */
55
56 struct bc_volumeSet {
57     struct bc_volumeSet *next;  /*Ptr to next volume set record */
58     char *name;                 /*Volume set name */
59     afs_int32 flags;            /* flags */
60     struct bc_volumeEntry *ventries;    /*List of component volume entries */
61 };
62
63 /*
64  * Represents the name of a volume specifier in a volume set.
65  */
66 struct bc_volumeEntry {
67     struct bc_volumeEntry *next;        /*Ptr to next record in list */
68     char *serverName;           /*Host name for volume spec */
69     struct sockaddr_in server;  /*Host sockaddr for volume spec */
70     char *partname;             /*Partition pattern name */
71     afs_int32 partition;        /*Partition number for volume spec */
72     char *name;                 /*Volume pattern name */
73 };
74
75 /*
76  * Represents an individual volume to be dumped, not a collection.
77  */
78 struct bc_volumeDump {
79     struct bc_volumeDump *next; /*Ptr to next record */
80     afs_int32 vid;              /*Volume id, or 0 if not known */
81     struct bc_volumeEntry *entry;       /*Back pointer: information about server (obs?) */
82     char *name;                 /*Individual volume name */
83     afs_int32 volType;          /*Volume type */
84     afs_int32 date;             /*From date (for full, incremental or whatever) */
85     afs_int32 cloneDate;        /* time of this volume's snapshot */
86     afs_int32 partition;        /* partition containing this volume */
87     struct sockaddr_in server;  /* server to obtain data from */
88 };
89
90 /*
91  * Represents a dump schedule node, representing one type of dump (e.g. the
92  * safe5 daily incremental)
93  */
94 struct bc_dumpSchedule {
95     struct bc_dumpSchedule *next;       /*Ptr to next record */
96     char *name;                 /*Dump sched name */
97     char *vsname;               /*Volume set name to dump */
98     afs_int32 period;           /*Period in minutes */
99     afs_int32 periodType;       /*Qualifier on above, for exceptions like 'monthly' */
100     char *parentName;           /*Parent dump schedule name-unused PA */
101     struct bc_dumpSchedule *parent;     /*These are built at run-time */
102     struct bc_dumpSchedule *firstChild;
103     struct bc_dumpSchedule *nextSibling;
104     afs_int32 level;            /*Level of the dump (do we need this?) */
105     afs_int32 expDate;          /* expiration date */
106     afs_int32 expType;          /* absolute or relative expiration */
107 };
108
109 /*
110  * Private: represents a queued dump/restore item.
111  */
112 struct bc_dumpTask {
113     int (*callProc) ();
114     struct bc_config *config;
115     struct bc_volumeDump *volumes;
116     char *dumpName;             /*Dump name we're doing */
117     char *volSetName;           /*Volume set we're dumping */
118     afs_int32 flags;
119     afs_int32 dumpID;           /*Dump ID we're running */
120     int oldFlag;                /* if a restore, whether we're doing it to the same vol#s */
121     struct sockaddr_in destServer;      /* destination server for restore command */
122     afs_int32 destPartition;    /* destination partition for restore command */
123     afs_int32 fromDate;         /* date from which to do a restore command */
124     afs_int32 parentDumpID;     /* parent dump ID */
125     afs_int32 dumpLevel;        /* dump level being performed */
126     char *newExt;               /* new volume extension if any, if oldFlag is false */
127     afs_int32 bytesTransferred; /* How many bytes sent */
128     afs_int32 volumeBeingDumped;        /* the volume being processed */
129     afs_int32 *portOffset;      /* used to derive the ports of the TCs */
130     afs_int32 portCount;        /* number of points in the portOffset array */
131     afs_int32 expDate;          /* for dumps - expiration date */
132     afs_int32 expType;          /* for dumps - abs. or relative expiration */
133     int doAppend;               /* for dumps - append this dump to the dump set */
134     int dontExecute;            /* dont execute the dump or restore */
135 };
136
137 #define BC_DI_INUSE     1       /* entry not used */
138
139 #define DBHOSTFILE      "dbasehosts"
140 #define TAPEHOSTFILE    "tapehosts"
141 #define DSNAME          "dumpschedule"
142 #define VSNAME          "volumeset"
143
144 #define BC_MAXSIMDUMPS      64
145 #define BC_MAXPORTS         128 /* max number of port offsets for volrestore */
146 /* debugging support */
147 #define dprintf(x)