1 /*****************************************************************************
2 * vlc_update.h: VLC update and plugins download
3 *****************************************************************************
4 * Copyright (C) 2005 the VideoLAN team
7 * Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either release 2 of the License, or
12 * (at your option) any later release.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
30 * \defgroup update Update
35 #define UPDATE_FILE_TYPE_ALL (~0)
36 #define UPDATE_FILE_TYPE_NONE 0
38 #define UPDATE_FILE_TYPE_UNDEF 1
39 #define UPDATE_FILE_TYPE_INFO 2
40 #define UPDATE_FILE_TYPE_SOURCE 4
41 #define UPDATE_FILE_TYPE_BINARY 8
42 #define UPDATE_FILE_TYPE_PLUGIN 16
44 #define UPDATE_RELEASE_STATUS_ALL (~0)
45 #define UPDATE_RELEASE_STATUS_NONE 0
47 #define UPDATE_RELEASE_STATUS_OLDER 1
48 #define UPDATE_RELEASE_STATUS_EQUAL 2
49 #define UPDATE_RELEASE_STATUS_NEWER 4
51 #define UPDATE_RELEASE_TYPE_STABLE 1
52 #define UPDATE_RELEASE_TYPE_TESTING 2
53 #define UPDATE_RELEASE_TYPE_UNSTABLE 4
56 #define UPDATE_SUCCESS 1
59 #define UPDATE_MIRROR 4
60 #define UPDATE_RELEASE 8
61 #define UPDATE_FILE 16
62 #define UPDATE_RESET 32
65 * Describes an update file
69 int i_type; ///< File type
70 char* psz_md5; ///< MD5 hash
71 long int l_size; ///< File size in bytes
72 char* psz_url; ///< Relative (to a mirror) or absolute url
73 char* psz_description; ///< Plain text description
77 * Describes an update VLC release number
79 struct update_release_t
81 char* psz_major; ///< Version major string
82 char* psz_minor; ///< Version minor string
83 char* psz_revision; ///< Version revision string
84 char* psz_extra; ///< Version extra string
86 char* psz_svn_revision; ///< SVN revision
88 int i_type; ///< Release type
90 int i_status; ///< Release status compared to current VLC version
92 struct update_file_t* p_files; ///< Files list
93 int i_files; ///< Number of files in the files list
99 struct update_mirror_t
101 char *psz_name; ///< Mirror name
102 char *psz_location; ///< Mirror geographical location
103 char *psz_type; ///< Mirror type (FTP, HTTP, ...)
105 char *psz_base_url; ///< Mirror base url
110 * The update object. Stores (and caches) all information relative to updates
114 libvlc_int_t *p_libvlc;
118 struct update_release_t *p_releases; ///< Releases (version) list
119 int i_releases; ///< Number of releases
120 vlc_bool_t b_releases; ///< True if we have a releases list
122 struct update_mirror_t *p_mirrors; ///< Mirrors list
123 int i_mirrors; ///< Number of mirrors
124 vlc_bool_t b_mirrors; ///< True if we have a mirrors list
128 * The update iterator structure. Usefull to browse the update object seamlessly
130 struct update_iterator_t
132 update_t *p_u; ///< Pointer to VLC update object
134 int i_r; ///< Position in the releases list
135 int i_f; ///< Position in the release's files list
136 int i_m; ///< Position in the mirrors list
138 int i_t; ///< File type bitmask
139 int i_rs; ///< Release status bitmask
140 int i_rt; ///< Release type bitmask
144 int i_type; ///< Type
145 char* psz_md5; ///< MD5 hash
146 long int l_size; ///< Size in bytes
147 char* psz_url; ///< Absolute URL
148 char* psz_description; ///< Description
149 } file; ///< Local 'copy' of the current file's information
152 char *psz_version; ///< Version string
153 char *psz_svn_revision; ///< SVN revision
154 int i_status; ///< Status
155 int i_type; ///< Type
156 } release; ///< Local 'copy' of the current release's information
159 char *psz_name; ///< Name
160 char *psz_location; ///< Geographical location
161 char *psz_type; ///< Type (HTTP, FTP, ...)
162 } mirror; ///< Local 'copy' of the current mirror's information
165 #define update_New( a ) __update_New( VLC_OBJECT( a ) )
167 VLC_EXPORT( update_t *, __update_New, ( vlc_object_t * ) );
168 VLC_EXPORT( void, update_Delete, (update_t * ) );
169 VLC_EXPORT( void, update_Check, ( update_t *, vlc_bool_t ) );
171 VLC_EXPORT( update_iterator_t *, update_iterator_New, ( update_t * ) );
172 VLC_EXPORT( void, update_iterator_Delete, ( update_iterator_t * ) );
173 VLC_EXPORT( unsigned int, update_iterator_Action, ( update_iterator_t *, int ) );
174 VLC_EXPORT( unsigned int, update_iterator_ChooseMirrorAndFile, ( update_iterator_t *, int, int, int ) );
175 VLC_EXPORT( void, update_download, ( update_iterator_t *, char * ) );