New API call iso_image_get_pvd_times().

This commit is contained in:
Thomas Schmitt 2013-03-12 17:42:13 +01:00
parent 6905ab3e56
commit a4f07eb3b3
5 changed files with 93 additions and 1 deletions

View File

@ -241,6 +241,10 @@ typedef struct
char *copyright_file_id; char *copyright_file_id;
char *abstract_file_id; char *abstract_file_id;
char *biblio_file_id; char *biblio_file_id;
char *creation_time;
char *modification_time;
char *expiration_time;
char *effective_time;
/* extension information */ /* extension information */
@ -2089,6 +2093,10 @@ void ifs_fs_free(IsoFilesystem *fs)
free(data->copyright_file_id); free(data->copyright_file_id);
free(data->abstract_file_id); free(data->abstract_file_id);
free(data->biblio_file_id); free(data->biblio_file_id);
free(data->creation_time);
free(data->modification_time);
free(data->expiration_time);
free(data->effective_time);
free(data->input_charset); free(data->input_charset);
free(data->local_charset); free(data->local_charset);
@ -2317,7 +2325,15 @@ int read_pvm(_ImageFsData *data, uint32_t block)
data->copyright_file_id[0] = 0; data->copyright_file_id[0] = 0;
data->abstract_file_id[0] = 0; data->abstract_file_id[0] = 0;
data->biblio_file_id[0] = 0; data->biblio_file_id[0] = 0;
} }
data->creation_time =
iso_util_strcopy_untail((char*) pvm->vol_creation_time, 17);
data->modification_time =
iso_util_strcopy_untail((char*) pvm->vol_modification_time, 17);
data->expiration_time =
iso_util_strcopy_untail((char*) pvm->vol_expiration_time, 17);
data->effective_time =
iso_util_strcopy_untail((char*) pvm->vol_effective_time, 17);
data->nblocks = iso_read_bb(pvm->vol_space_size, 4, NULL); data->nblocks = iso_read_bb(pvm->vol_space_size, 4, NULL);
@ -3553,6 +3569,8 @@ int iso_image_import(IsoImage *image, IsoDataSource *src,
iso_image_set_copyright_file_id(image, data->copyright_file_id); iso_image_set_copyright_file_id(image, data->copyright_file_id);
iso_image_set_abstract_file_id(image, data->abstract_file_id); iso_image_set_abstract_file_id(image, data->abstract_file_id);
iso_image_set_biblio_file_id(image, data->biblio_file_id); iso_image_set_biblio_file_id(image, data->biblio_file_id);
iso_image_set_pvd_times(image, data->creation_time,
data->modification_time, data->expiration_time, data->effective_time);
if (features != NULL) { if (features != NULL) {
*features = malloc(sizeof(IsoReadImageFeatures)); *features = malloc(sizeof(IsoReadImageFeatures));

View File

@ -145,6 +145,10 @@ void iso_image_unref(IsoImage *image)
free(image->copyright_file_id); free(image->copyright_file_id);
free(image->abstract_file_id); free(image->abstract_file_id);
free(image->biblio_file_id); free(image->biblio_file_id);
free(image->creation_time);
free(image->modification_time);
free(image->expiration_time);
free(image->effective_time);
if (image->used_inodes != NULL) if (image->used_inodes != NULL)
free(image->used_inodes); free(image->used_inodes);
if (image->system_area_data != NULL) if (image->system_area_data != NULL)
@ -335,6 +339,37 @@ const char *iso_image_get_biblio_file_id(const IsoImage *image)
return image->biblio_file_id; return image->biblio_file_id;
} }
int iso_image_set_pvd_times(IsoImage *image,
char *creation_time, char *modification_time,
char *expiration_time, char *effective_time)
{
if (creation_time == NULL || modification_time == NULL ||
expiration_time == NULL || effective_time == NULL)
return ISO_NULL_POINTER;
image->creation_time = strdup(creation_time);
image->modification_time = strdup(modification_time);
image->expiration_time = strdup(expiration_time);
image->effective_time = strdup(effective_time);
if (image->creation_time == NULL || image->modification_time == NULL ||
image->expiration_time == NULL || image->effective_time == NULL)
return ISO_OUT_OF_MEM;
return ISO_SUCCESS;
}
int iso_image_get_pvd_times(IsoImage *image,
char **creation_time, char **modification_time,
char **expiration_time, char **effective_time)
{
if (image->creation_time == NULL || image->modification_time == NULL ||
image->expiration_time == NULL || image->effective_time == NULL)
return ISO_NULL_POINTER;
*creation_time = image->creation_time;
*modification_time = image->modification_time;
*expiration_time = image->expiration_time;
*effective_time = image->effective_time;
return ISO_SUCCESS;
}
int iso_image_get_msg_id(IsoImage *image) int iso_image_get_msg_id(IsoImage *image)
{ {
return image->id; return image->id;

View File

@ -49,6 +49,10 @@ struct Iso_Image
char *copyright_file_id; char *copyright_file_id;
char *abstract_file_id; char *abstract_file_id;
char *biblio_file_id; char *biblio_file_id;
char *creation_time;
char *modification_time;
char *expiration_time;
char *effective_time;
/* el-torito boot catalog */ /* el-torito boot catalog */
struct el_torito_boot_catalog *bootcat; struct el_torito_boot_catalog *bootcat;
@ -234,4 +238,8 @@ int iso_image_set_checksums(IsoImage *image, char *checksum_array,
uint32_t idx_count, int flag); uint32_t idx_count, int flag);
int iso_image_set_pvd_times(IsoImage *image,
char *creation_time, char *modification_time,
char *expiration_time, char *effective_time);
#endif /*LIBISO_IMAGE_H_*/ #endif /*LIBISO_IMAGE_H_*/

View File

@ -3027,6 +3027,36 @@ void iso_image_set_biblio_file_id(IsoImage *image, const char *biblio_file_id);
*/ */
const char *iso_image_get_biblio_file_id(const IsoImage *image); const char *iso_image_get_biblio_file_id(const IsoImage *image);
/**
* Get the four timestamps from the Primary Volume Descriptor of the imported
* ISO image. The timestamps are strings which are either empty or consist
* of 17 digits of the form YYYYMMDDhhmmsscc.
* None of the returned string pointers shall be used for altering or freeing
* data. They are just for reading.
*
* @param image
* The image to be inquired.
* @param vol_creation_time
* Returns a pointer to the Volume Creation time:
* When "the information in the volume was created."
* @param vol_modification_time
* Returns a pointer to Volume Modification time:
* When "the information in the volume was last modified."
* @param vol_expiration_time
* Returns a pointer to Volume Expiration time:
* When "the information in the volume may be regarded as obsolete."
* @param vol_effective_time
* Returns a pointer to Volume Expiration time:
* When "the information in the volume may be used."
* @return
* ISO_SUCCESS or error
*
* @since 1.2.8
*/
int iso_image_get_pvd_times(IsoImage *image,
char **creation_time, char **modification_time,
char **expiration_time, char **effective_time);
/** /**
* Create a new set of El-Torito bootable images by adding a boot catalog * Create a new set of El-Torito bootable images by adding a boot catalog
* and the default boot image. * and the default boot image.

View File

@ -98,6 +98,7 @@ iso_image_get_data_preparer_id;
iso_image_get_mips_boot_files; iso_image_get_mips_boot_files;
iso_image_get_msg_id; iso_image_get_msg_id;
iso_image_get_publisher_id; iso_image_get_publisher_id;
iso_image_get_pvd_times;
iso_image_get_root; iso_image_get_root;
iso_image_get_session_md5; iso_image_get_session_md5;
iso_image_get_system_area; iso_image_get_system_area;