Imported Upstream version 2.6.1
[debian/amanda] / client-src / client_util.h
index 559c957e1cd28d725f39aac925e2ff859163c5e5..ed686c6e5cc17edaa88c990b9d00df3240d4bf61 100644 (file)
@@ -24,7 +24,7 @@
  * file named AUTHORS, in the root directory of this distribution.
  */
 /* 
- * $Id: client_util.h,v 1.1.2.10 2002/04/22 01:54:34 martinea Exp $
+ * $Id: client_util.h,v 1.14 2006/05/25 01:47:11 johnfranks Exp $
  *
  */
 
 #define CLIENT_UTIL_H
 
 #include "amanda.h"
+#include "conffile.h"
 #include "amfeatures.h"
 #include "sl.h"
+#include "util.h"              /* for bstrncmp() */
+#include "amandad.h"           /* for g_option_t */
+#include "amxml.h"             /* for dle_t      */
 
-typedef struct option_s {
-    char *str;
-    int compress;
-    int no_record;
-    int bsd_auth;
-    int createindex;
-    sl_t *exclude_file;
-    sl_t *exclude_list;
-    sl_t *include_file;
-    sl_t *include_list;
-    int exclude_optional;
+typedef struct backup_support_option_s {
+    int config;
+    int host;
+    int disk;
+    int max_level;
+    int index_line;
+    int index_xml;
+    int message_line;
+    int message_xml;
+    int record;
+    int include_file;
+    int include_list;
     int include_optional;
-#ifdef KRB4_SECURITY
-    int krb4_auth;
-    int kencrypt;
-#endif
-} option_t;
+    int exclude_file;
+    int exclude_list;
+    int exclude_optional;
+    int collection;
+    int calcsize;
+    int multi_estimate;
+    int smb_recover_mode;
+} backup_support_option_t;
+
+typedef struct client_script_result_s {
+    int exit_code;
+    proplist_t proplist;
+    GPtrArray *output;
+    GPtrArray *err;
+} client_script_result_t;
 
-typedef struct g_option_s {
-    char *str;
-    am_feature_t *features;
-    char *hostname;
-    int maxdumps;
-} g_option_t;
+char *build_exclude(dle_t *dle, int verbose);
+char *build_include(dle_t *dle, int verbose);
+void parse_options(char *str,
+                  dle_t *dle,
+                  am_feature_t *features,
+                  int verbose);
 
-#define NO_COMPR   0
-#define COMPR_FAST 1
-#define COMPR_BEST 2
-#define COMPR_SERVER_FAST 3
-#define COMPR_SERVER_BEST 4
+/* Count the size of an ARGV to store all properties of an application for
+ * a dle. include/exclude options are converted to properties.
+ *
+ * @param dle: the dle
+ * @returns: size of an ARGV needed.
+ */
+int application_property_argv_size(dle_t *dle);
 
-char *build_exclude P((char *disk, char *device, option_t *options, int verbose));
-char *build_include P((char *disk, char *device, option_t *options, int verbose));
-void init_options P((option_t *options));
-option_t *parse_options P((char *str,
-                          char *disk,
-                          char *device,
-                          am_feature_t *fs,
-                          int verbose));
+/* Add all properties of an application for a dle to an ARGV.
+ * include/exclude options are converted to properties.
+ *
+ * @param argvchild: the ARGV where to store properties.
+ * @param dle: the dle.
+ * @returns: Number of argument added to ARGV.
+ */
+int application_property_add_to_argv(char **argvchild,
+                                    dle_t *dle,
+                                    backup_support_option_t *bsu);
 
-void init_g_options P((g_option_t *g_options));
-g_option_t *parse_g_options P((char *str, int verbose));
+char *fixup_relative(char *name, char *device);
+backup_support_option_t *backup_support_option(char *program,
+                                              g_option_t *g_options,
+                                              char *disk,
+                                              char *amdevice,
+                                              GPtrArray **errarray);
+
+void run_client_script(script_t     *script,
+                      execute_on_t  execute_on,
+                      g_option_t   *g_options,
+                      dle_t        *dle);
+
+void run_client_scripts(execute_on_t  execute_on,
+                       g_option_t   *g_options,
+                       dle_t        *dle,
+                       FILE         *streamout);
+
+void run_calcsize(char *config, char *program, char *disk,
+                  char *dirname, GSList *levels,
+                  char *file_exclude, char *file_include);
+
+void check_access(char *filename, int mode);
+void check_file(char *filename, int mode);
+void check_dir(char *dirname, int mode);
+void check_suid(char *filename);
+double the_num(char * str, int pos);
+
+/* Convert a GSList returned from config_errors into an "ERROR "
+ * line suitable for inclusion in a NAK or REP packet.  Because we only
+ * get one ERROR line per packet, this includes only the first 
+ * error, with an indication that there are more to follow.
+ *
+ * @param errlist: the list of errors from config_errors
+ * @returns: newly allocated string containing the error messages
+ */
+char *config_errors_to_error_string(GSList *errlist);
 
 #endif