00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00029 #ifndef LIBUAU_H
00030 #define LIBUAU_H
00031
00032 #include <stdlib.h>
00033
00034 #include <glib.h>
00035
00036 #define LUAU_VERSION_MAJOR 0
00037 #define LUAU_VERSION_MINOR 1
00038 #define LUAU_VERSION_PATCH 6
00039
00040 #define LUAU_XML_INTERFACE_MAJOR 1
00041 #define LUAU_XML_INTERFACE_MINOR 1
00042
00043 #define LUAU_EMPTY 0x00
00044 #define LUAU_RPM 0x01
00045 #define LUAU_DEB 0x02
00046 #define LUAU_SRC 0x04
00047 #define LUAU_EXEC 0x08
00048 #define LUAU_AUTOPKG 0x10
00049 #define LUAU_UNKNOWN 0x80
00050
00051 #ifdef __cplusplus
00052 extern "C" {
00053 #endif
00054
00055
00056
00058 typedef guint32 APkgType;
00059
00061 typedef enum { LUAU_SOFTWARE, LUAU_MESSAGE, LUAU_LIBUPDATE } AUpdateType;
00062 typedef enum { LUAU_QUANT_FROM, LUAU_QUANT_TO, LUAU_QUANT_FOR } AQuantType;
00063 typedef enum { LUAU_QUANT_DATA_DATE, LUAU_QUANT_DATA_VERSION, LUAU_QUANT_DATA_INTERFACE, LUAU_QUANT_DATA_KEYWORD, LUAU_QUANT_DATA_INVALID } AQuantDataType;
00064
00065
00066 typedef void (*AErrorFunc) (const char * string, const char* filename, const char* function, int lineno);
00067 typedef int (*APromptFunc)(const char * title, const char* msg, int nTotal, int nDefault, const char *choice1, va_list args);
00068
00069 typedef void (*ACallback) (void *data);
00070 typedef void (*AFloatCallback) (float data);
00071 typedef void (*ACallbackWithData) (void *callback_data, void *user_data);
00072 typedef int (*AProgressCallback) (void *clientp, double dltotal, double dlnow, double ultotal, double ulnow);
00073
00075 typedef struct {
00076 short day;
00077 short month;
00078 int year;
00079 } ADate;
00080
00082 typedef struct {
00083 APkgType type;
00084 GPtrArray *mirrors;
00085 char md5sum[33];
00086 guint32 size;
00087 } APackage;
00088
00090 typedef struct {
00091 int major;
00092 int minor;
00093 } AInterface;
00094
00096 typedef struct {
00097
00098 char *id;
00099 GPtrArray *keywords;
00100 AUpdateType type;
00101 ADate *date;
00102 char *shortDesc;
00103 char *fullDesc;
00105 GPtrArray *quantifiers;
00107
00108 APkgType availableFormats;
00109 GPtrArray *packages;
00110 char *newVersion;
00111 char *newDisplayVersion;
00112 AInterface interface;
00114
00115
00116
00117 char *newURL;
00118 } AUpdate;
00119
00121 typedef struct {
00122 char *data;
00123 size_t size;
00124 } AData;
00125
00126 typedef struct {
00127 AQuantType qtype;
00128 AQuantDataType dtype;
00129 void *data;
00130 } AQuantifier;
00131
00133 typedef struct {
00134 char *id;
00135 char *shortname;
00136 char *fullname;
00137 char *desc;
00138 char *url;
00139 char *version;
00140 char *displayVersion;
00141 ADate *date;
00142 AInterface interface;
00143 GPtrArray *keywords;
00144 } AProgInfo;
00145
00146
00147
00148
00150 gboolean luau_getUpdateInfo(AUpdate *update, const char* updateID, const AProgInfo *progInfo);
00152 GPtrArray* luau_checkForUpdates(const AProgInfo *info);
00153
00155 gboolean luau_installUpdate(const AProgInfo *info, const AUpdate *newUpdate, const APkgType type);
00157 char* luau_downloadUpdate(const AProgInfo *info, const AUpdate *newUpdate, const APkgType type, const char* filename);
00159 gboolean luau_installPackage(const char* filename, const APkgType type);
00160
00162 void luau_registerErrorFunc(AErrorFunc errorFunc);
00164 void luau_registerPromptFunc(APromptFunc promptFunc);
00166 void luau_registerProgressCallback(AProgressCallback callback);
00168 void luau_resetErrorFunc(void);
00170 void luau_resetPromptFunc(void);
00172 void luau_resetProgressCallback(void);
00173
00174
00175
00176
00177
00179 char* luau_dateString(const ADate *date);
00181 char* luau_multPackageTypeString(APkgType types);
00183 const char* luau_packageTypeString(APkgType type);
00185 char* luau_progInfoString(const AProgInfo *info);
00187 char* luau_keywordsString(const GPtrArray *keywords);
00189 char* luau_interfaceString(const AInterface *interface);
00191 const char* luau_updateTypeString(AUpdateType type);
00192
00193
00195 gboolean luau_parseDate(ADate *date, const char *string);
00197 APkgType luau_parsePkgType(const char* typeString);
00199 gboolean luau_parseInterface(AInterface *interface, const char *intStr);
00200
00201
00203 GSList* luau_packageTypeList(APkgType types);
00205 APackage* luau_getUpdatePackage(const AUpdate *update, APkgType pkgType);
00207 gboolean luau_isOfType(APkgType query, APkgType type);
00208 char * luau_getPackageURL(APackage *pkgInfo);
00209
00210
00212 int luau_datecmp(ADate *d1, ADate *d2);
00213
00214
00216 int luau_versioncmp(const char *required, const char *current);
00217
00218
00220 void luau_setKeyword(GPtrArray *keywords, const char *newKeyword);
00222 gboolean luau_unsetKeyword(GPtrArray *keywords, const char *oldKeyword);
00224 gboolean luau_checkKeyword(const GPtrArray *keywords, const char *needle);
00226 gboolean luau_isIncompatible(AUpdate *update);
00228 gboolean luau_isHidden(AUpdate *update);
00230 gboolean luau_isOld(AUpdate *update);
00232 gboolean luau_isVisible(AUpdate *update);
00233
00234
00235
00237 gboolean luau_satisfiesInterface(const AInterface *wanted, const AInterface *needed);
00238
00239
00240 gboolean luau_satisfiesQuant(const AQuantifier *needed, const AProgInfo *installed);
00241 AQuantDataType luau_parseQuantDataType(const char *str);
00242
00243
00245 void luau_copyUpdate(AUpdate *dest, const AUpdate *src);
00247 void luau_copyPackage(APackage *dest, const APackage *src);
00249 void luau_copyProgInfo(AProgInfo *dest, const AProgInfo *src);
00251 void luau_copyInterface(AInterface *dest, const AInterface *src);
00253 void luau_copyDate(ADate *dest, const ADate *src);
00255 void luau_copyQuants(GPtrArray *dest, const GPtrArray *src);
00257 void luau_copyQuant(AQuantifier *dest, const AQuantifier *src);
00258
00259
00261 void luau_freeUpdateArray(GPtrArray *updates);
00263 void luau_freeProgInfo(AProgInfo *ptr);
00265 void luau_freeUpdateInfo(AUpdate *ptr);
00267 void luau_freePkgInfo(APackage *ptr);
00268
00269 #ifdef __cplusplus
00270 }
00271 #endif
00272
00273 #endif