Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / bubasics / bubasics.h
blob628d4b082c4229cc3be5e59dc4033cd1c9e1c56e
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
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 */
10 #ifndef __BUBASIC__
11 #define __BUBASIC__
13 /* version numbers. This version information is accessed from more than
14 * one module. Version information is kept for:
15 * bucoord <-> butc interface
16 * butc <-> butm interface
17 * bu* <-> budb interface
19 * and as an interim measure, for
20 * dumpschedule files
21 * dump database files i.e. D*.db
24 /* Version of butc <-> butm interface
25 * These are not version flags as the name suggests.
28 #define BUTM_VERSIONFLAG_0 0 /* every size measure is in bytes */
29 #define BUTM_VERSIONFLAG_1 1 /* every size measure is in kbytes */
30 #define BUTM_VERSIONFLAG_2 2 /* afs 3.1 features */
32 /* current version of the interface */
33 #define BUTM_MAJORVERSION BUTM_VERSIONFLAG_2
35 /* versions for the bucoord <-> butc interface */
36 #define BUTC_VERSION_1 1 /* initial version, afs 3.1 */
37 #define BUTC_VERSION_2 2 /* 3.4 version - added voltype to tc_dumpDesc */
38 #define BUTC_VERSION_3 3 /* 3.4 version - labeltape change */
39 #define CUR_BUTC_VERSION BUTC_VERSION_3
41 /* TAPE_VERSION Version of the current tape format used by butc
42 * Notes:
44 * version 0: ?? - sizes in bytes
45 * version 1: Sizes in kbytes.
46 * version 2:
47 * 1) Tape expiration information in label
48 * 2) backup systems's EOT markers at the end of a dump
49 * version 3:
50 * 1) dump id and tape use count in label
51 * version 4:
52 * 1) Got rid of large EOT markers
53 * 2) Supports appended dumps
56 #define TAPE_VERSION_0 0
57 #define TAPE_VERSION_1 1
58 #define TAPE_VERSION_2 2
59 #define TAPE_VERSION_3 3
60 #define TAPE_VERSION_4 4
61 #define CUR_TAPE_VERSION TAPE_VERSION_4
63 #define BC_SCHEDULE_MAGIC 0x74327285 /* magic # for schedules */
64 #define BC_SCHEDULE_V3_1 1 /* afs 3.1 */
65 #define BC_SCHEDULE_VERSION BC_SCHEDULE_V3_1 /* current version */
67 #define BC_DUMPDB_MAGIC 0x10381645 /* magic # for dump db */
68 #define BC_DUMPDB_V3_1 1 /* afs 3.1 */
69 #define BC_DUMPDB_VERSION BC_DUMPDB_V3_1 /* current version */
71 /* define ports that move to system configuration later */
72 #define BC_MESSAGEPORT 7020 /* for communicating with backup coordinator */
73 #define BC_TAPEPORT 7025 /* for communicating with tape controller */
75 #ifndef AFSCONF_BUDBPORT
76 #define AFSCONF_BUDBPORT 7021 /* for communicating with backup database */
77 #endif
78 #define BUDB_SERVICE 22314 /* service id */
80 #define RX_SCINDEX_NULL 0 /* No security */
81 #define RX_SCINDEX_VAB 1 /* vice tokens, with bcrypt */
82 #define RX_SCINDEX_KAD 2 /* Kerberos/DES */
84 /* maximums for various text strings
85 * DON'T alter these values until all disk/tape structures can be handled
86 * correctly. In particular, volume names are 64.
89 /* dump states */
90 #define DUMP_FAILED 1 /* outright failed */
91 #define DUMP_PARTIAL 2 /* partial on tape */
92 #define DUMP_SUCCESS 3 /* all ok */
93 #define DUMP_RETRY 4 /* failed, but retry */
94 #define DUMP_NORETRYEOT 5 /* failed, and don't retry */
95 #define DUMP_NOTHING 6 /* Nothing was dumped */
96 #define DUMP_NODUMP 7 /* don't dump, and don't retry */
99 #define BU_MAXNAMELEN 32 /* max for misc. names: eg volumes */
100 #define BU_MAXTAPELEN 32 /* for tape names */
101 #define BU_MAXHOSTLEN 32 /* for server (machine) names */
102 #define BU_MAXTOKENLEN 16 /* identifiers */
103 #define BU_MAXUNAMELEN 256 /* length of a user name */
104 #define BU_MAXCELLLEN 256 /* length of a cell name */
106 /* proposed maximum name lengths PA */
107 #define BU_MAX_NAME 64 /* misc. names */
108 #define BU_MAX_DUMP_PATH 256 /* length of schedule path name */
110 #define BC_MAXPORTOFFSET 58510 /* max number of port offsets in database */
112 #ifndef NEVERDATE
113 #define NEVERDATE 037777777777 /* a date that will never come */
114 #endif
115 #ifndef NEVERSTRING
116 #define NEVERSTRING "NEVER \n"
117 #endif
118 #define cTIME(t) ( (*(t) == NEVERDATE) ? (char *)NEVERSTRING : (char *)ctime(t) )
120 #ifndef Date
121 #define Date afs_uint32
122 #endif
124 #define DUMP_TAPE_NAME "Ubik_db_dump" /* base database tape name */
126 /* for expiration date processing */
127 #define BC_NO_EXPDATE 0 /* no expiration date */
128 #define BC_ABS_EXPDATE 1 /* absolute expiration date */
129 #define BC_REL_EXPDATE 2 /* relative expiration date */
131 /*macro which generates tape names from tapeSetName */
132 #define tc_MakeTapeName(name,set,seq) \
133 sprintf (name, (set)->format, (seq) + (set)->b)
135 /* common structure definitions */
136 struct dlqlink {
137 struct dlqlink *dlq_next;
138 struct dlqlink *dlq_prev;
139 afs_int32 dlq_type;
140 void *dlq_structPtr; /* enclosing structure */
143 typedef struct dlqlink dlqlinkT;
144 typedef dlqlinkT *dlqlinkP;
147 /* invariants */
148 #define DLQ_HEAD 1001
150 #define DLQ_VOLENTRY 10
151 #define DLQ_FINISHTAPE 11
152 #define DLQ_USETAPE 12
153 #define DLQ_FINISHDUMP 13
154 #define DLQ_USEDUMP 14
156 /* simple assertion - for testing, don't halt processing */
158 #define DLQASSERT(condition) \
159 if ( (condition) == 0 ) \
161 printf("DLQASSERT: %s failed\n", #condition); \
164 /* function typing */
165 extern dlqlinkP dlqFront(dlqlinkP);
166 extern dlqlinkP dlqUnlinkb(dlqlinkP);
167 extern dlqlinkP dlqUnlinkf(dlqlinkP);
169 /* -----------------------------
170 * Status management
171 * -----------------------------
174 /* status management flags
176 * Key to comments:
177 * C - client side only
178 * S - server side only
179 * B - client or server
182 #define STARTING 0x1 /* C; still setting up, no server task yet */
183 #define ABORT_REQUEST 0x2 /* B; user requested abort */
184 #define ABORT_SENT 0x4 /* C; abort sent to server (REQ cleared) */
185 #define ABORT_DONE 0x8 /* S; abort complete on server */
186 #define ABORT_LOCAL 0x10 /* C; abort local task if contact lost */
187 #define TASK_DONE 0x20 /* B; task complete */
188 #define SILENT 0x400 /* C; don't be verbose about termination */
189 #define NOREMOVE 0x1000 /* C; don't remove from queue */
191 /* comm status */
192 #define CONTACT_LOST 0x40 /* B; contact lost */
194 /* errror handling */
195 #define TASK_ERROR 0x80 /* S; had fatal error, will terminate */
197 /* general status - copied back to client for jobs status */
198 #define DRIVE_WAIT 0x100 /* S; waiting for drive to become free */
199 #define OPR_WAIT 0x200 /* S; waiting for operator action */
200 #define CALL_WAIT 0x800 /* S; waiting for callout routine completion */
202 struct statusS {
203 dlqlinkT link;
205 afs_uint32 taskId; /* task identifier */
206 afs_uint32 dbDumpId; /* dump id */
207 afs_uint32 flags; /* as above */
208 afs_uint32 nKBytes; /* bytes xferred */
209 char volumeName[BU_MAXNAMELEN]; /* current volume (if any) */
210 afs_int32 volsFailed; /* # operation failures */
211 afs_int32 lastPolled; /* last successful poll */
213 /* bucoord local */
214 char taskName[64]; /* type of task */
215 afs_int32 port;
216 afs_int32 jobNumber;
217 afs_int32 volsTotal; /* total # vols */
218 afs_int32 scheduledDump; /* Time this dump was scheduled */
219 char *cmdLine; /* Command to exectute for this dump */
222 typedef struct statusS statusT;
223 typedef statusT *statusP;
225 #endif