xorriso  1.5.4.pl02
About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.
  Fossies Dox: xorriso-1.5.4.pl02.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

libjte.c File Reference
#include <stdio.h>
#include <ctype.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include "jte.h"
#include "checksum.h"
#include "libjte_private.h"
#include "libjte.h"
Include dependency graph for libjte.c:

Go to the source code of this file.

Functions

static int libjte__set_string (char **dest, char *source, int flag)
 
void libjte__version (int *major, int *minor, int *micro)
 
int libjte__is_compatible (int major, int minor, int micro, int flag)
 
int libjte_new (struct libjte_env **jte_handle, int flag)
 
int libjte_destroy (struct libjte_env **jte_handle)
 
int libjte_set_outfile (struct libjte_env *o, char *outfile)
 
int libjte_set_verbose (struct libjte_env *o, int verbose)
 
int libjte_set_checksum_algorithm (struct libjte_env *o, char *algorithm, int *size)
 
int libjte_set_template_path (struct libjte_env *o, char *jtemplate_out)
 
int libjte_set_jigdo_path (struct libjte_env *o, char *jjigdo_out)
 
int libjte_set_md5_path (struct libjte_env *o, char *path)
 
int libjte_set_checksum_path (struct libjte_env *o, char *path)
 
int libjte_set_min_size (struct libjte_env *o, int jte_min_size)
 
static int libjte_decode_checksum_string (struct libjte_env *o, char *checksum_code, int default_algo, int *algo)
 
int libjte_set_checksum_iso (struct libjte_env *o, char *checksum_code)
 
int libjte_set_checksum_template (struct libjte_env *o, char *checksum_code)
 
int libjte_set_compression (struct libjte_env *o, char *compression_code)
 
int libjte_add_exclude (struct libjte_env *o, char *pattern)
 
int libjte_add_md5_demand (struct libjte_env *o, char *pattern)
 
int libjte_add_checksum_demand (struct libjte_env *o, char *pattern)
 
int libjte_add_mapping (struct libjte_env *o, char *arg)
 
int libjte_set_image_size (struct libjte_env *o, off_t image_size)
 
int libjte_write_header (struct libjte_env *o)
 
int libjte_write_footer (struct libjte_env *o)
 
int libjte_write_unmatched (struct libjte_env *o, void *buffer, int size, int count)
 
int libjte_write_match_record (struct libjte_env *o, char *filename, char *mirror_name, int sector_size, off_t size, unsigned char md5[16])
 
int libjte_write_match_record2 (struct libjte_env *o, char *filename, char *mirror_name, int sector_size, off_t size, unsigned char *checksum)
 
int libjte_decide_file_jigdo (struct libjte_env *o, char *filename, off_t size, char **mirror_name, unsigned char md5[16])
 
int libjte_decide_file_jigdo2 (struct libjte_env *o, char *filename, off_t size, char **mirror_name, unsigned char *checksum)
 
int libjte_begin_data_file (struct libjte_env *o, char *filename, int sector_size, off_t size)
 
int libjte_show_data_chunk (struct libjte_env *o, void *buffer, int sector_size, int count)
 
int libjte_end_data_file (struct libjte_env *o)
 
int libjte_set_error_behavior (struct libjte_env *o, int to_stderr, int with_exit)
 
char * libjte_get_next_message (struct libjte_env *o)
 
int libjte_clear_msg_list (struct libjte_env *o, int flag)
 

Function Documentation

◆ libjte__is_compatible()

int libjte__is_compatible ( int  major,
int  minor,
int  micro,
int  flag 
)

Check whether all features of header file libjte.h from the given major.minor.micro revision triple can be delivered by the library version which is performing this call. if (! libjte__is_compatible(LIBJTE_VERSION_MAJOR, LIBJTE_VERSION_MINOR, LIBJTE_VERSION_MICRO, 0)) ...refuse to start the program with this dynamic library version...

Since
0.1.0
Parameters
majorobtained at build time
minorobtained at build time
microobtained at build time
flagBitfield for control purposes. Unused yet. Submit 0.
Returns
1= library can work for caller 0= library is not usable in some aspects. Caller must restrict itself to an earlier API version or must not use this library at all.

Definition at line 68 of file libjte.c.

References libjte__version().

Referenced by iso_init_with_flag(), and isoburn_initialize().

◆ libjte__set_string()

static int libjte__set_string ( char **  dest,
char *  source,
int  flag 
)
static

◆ libjte__version()

void libjte__version ( int *  major,
int *  minor,
int *  micro 
)

Obtain the three release version numbers of the library. These are the numbers encountered by the application when linking with libjte i.e. possibly not before run time. Better do not base the fundamental compatibility decision of an application on these numbers. For a reliable check use libjte__is_compatible().

Since
0.1.0
Parameters
majorThe maturity version (0 for now, as we are still learning)
minorThe development goal version.
microThe development step version.

Definition at line 60 of file libjte.c.

References LIBJTE_VERSION_MAJOR, LIBJTE_VERSION_MICRO, and LIBJTE_VERSION_MINOR.

Referenced by isoburn_initialize(), libjte__is_compatible(), and Xorriso_report_lib_versions().

◆ libjte_add_checksum_demand()

int libjte_add_checksum_demand ( struct libjte_env jte_handle,
char *  pattern 
)

Add a regular expression pattern to the list of files which must be found matching in the .checksum file. The pattern will be tested against the filenames that are handed to libjte_decide_file_jigdo() or libjte_begin_data_file() and do not find a matching entry in the .checksum file. If it matches, then said two functions will return error resp. perform exit() if this is enabled by libjte_set_error_behavior().

Since
2.0.0
Parameters
jte_handleThe environment to be manipulated.
Stringfor regcomp(3)
Returns
>0 means success, <=0 indicates failure

Definition at line 362 of file libjte.c.

References jte_add_include().

Referenced by Xorriso_jigdo_interpreter().

◆ libjte_add_exclude()

int libjte_add_exclude ( struct libjte_env jte_handle,
char *  pattern 
)

Add a regular expression pattern to the list of excluded filenames. The pattern will be tested against the filenames that are handed to libjte_decide_file_jigdo() or libjte_begin_data_file().

Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
Stringfor regcomp(3)
Returns
>0 means success, <=0 indicates failure

Definition at line 346 of file libjte.c.

References jte_add_exclude().

Referenced by Xorriso_jigdo_interpreter().

◆ libjte_add_mapping()

int libjte_add_mapping ( struct libjte_env jte_handle,
char *  arg 
)

Add a To=From pair to the list of mirror name mapping. The pair will be split at the '=' character. The mirror_name submitted to libjte_write_match_record() will be tested whether it begins by the From string. If so, then this string will be replaced by the To string and a ':' character. The resulting string will be used as data file name in the jigdo file.

libjte_decide_file_jigdo() gets the mirror_name from the matching line in the .checksum file and hands it to the application. libjte_begin_data_file() obtains the mirror name and processes it without bothering the application.

Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
argString of the form To=From
Returns
>0 means success, <=0 indicates failure

Definition at line 370 of file libjte.c.

References jte_add_mapping().

Referenced by Xorriso_jigdo_interpreter().

◆ libjte_add_md5_demand()

int libjte_add_md5_demand ( struct libjte_env jte_handle,
char *  pattern 
)

Add a regular expression pattern to the list of files which must be found matching in the .md5 file. The pattern will be tested against the filenames that are handed to libjte_decide_file_jigdo() or libjte_begin_data_file() and do not find a matching entry in the .md5 file. If it matches, then said two functions will return error resp. perform exit() if this is enabled by libjte_set_error_behavior(). Still supported in 2.0.0, but is now just an alias for libjte_add_checksum_demand(handle, path) below

Deprecated:
since 2.0.0
Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
Stringfor regcomp(3)
Returns
>0 means success, <=0 indicates failure

Definition at line 354 of file libjte.c.

References jte_add_include().

◆ libjte_begin_data_file()

int libjte_begin_data_file ( struct libjte_env jte_handle,
char *  filename,
int  sector_size,
off_t  size 
)

Tell libjte that the content of a data file is to be processed next. libjte will decide whether to extract the file and list it in the jigdo file, or whether to direct subsequent calls of libjte_show_data_chunk() into the template file.

Parameters
jte_handleThe environment to be used.
filenameThe address to be used with fopen(filename, "r").
sector_sizeAn eventual byte address alignment which is achieved in the payload image by padding file ends with zeros. Submit 1 if no alignment is done. For ISO images: 2048.
sizeThe number of bytes in the data file.
Returns
>0 = ok 0 = error -1 = would have called exit(1) if enabled E.g. because a libjte_add_md5_demand() pattern matched a file that shall not get extracted.

Definition at line 519 of file libjte.c.

References check_algos, libjte_env::checksum_algo, libjte_env::include_in_jigdo, list_file_in_jigdo(), _checksum_data::raw_bytes, and write_jt_match_record().

Referenced by iso_filesrc_write_data().

◆ libjte_clear_msg_list()

int libjte_clear_msg_list ( struct libjte_env o,
int  flag 
)

Dispose all pending messages after eventually printing them to stderr.

Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
flagbit0= print pending messages to stderr bit1= eventually complain before printing messages
Returns
>0 means success, <=0 indicates failure

Definition at line 595 of file libjte.c.

References libjte_get_next_message(), and libjte_env::msg_list.

Referenced by exit_if_enabled(), libjte_add_msg_entry(), and libjte_destroy().

◆ libjte_decide_file_jigdo()

int libjte_decide_file_jigdo ( struct libjte_env jte_handle,
char *  filename,
off_t  size,
char **  mirror_name,
unsigned char  md5[16] 
)

Decide whether a data file shall be extracted, i.e. referred in the template file and listed in the jigdo file, or whether its content shall be written compressed into the template file.

Deprecated:
since 2.0.0, use libjte_decide_file_jigdo2() in preference.
Since
0.1.0
Parameters
jte_handleThe environment to be used.
filenameThe address to be used with fopen(filename, "r")
sizeNumber of bytes in the data file
mirror_nameReturns the name which shall be listed in the jigdo file. This is NULL or allocated memory that has to be disposed by free(3).
md5May get filled by MD5 for libjte_write_match_record().
Returns
0= use libjte_write_unmatched(), 1= use libjte_write_match_record() -1= would have called exit(1) if enabled, e.g. if called after saying "sha256" in libjte_set_checksum_algorithm().

Definition at line 483 of file libjte.c.

References check_algos, CHECK_MD5, libjte_env::checksum_algo, libjte_add_msg_entry(), libjte_decide_file_jigdo2(), libjte_env::message_buffer, _checksum_data::name, and _checksum_data::type.

◆ libjte_decide_file_jigdo2()

int libjte_decide_file_jigdo2 ( struct libjte_env jte_handle,
char *  filename,
off_t  size,
char **  mirror_name,
unsigned char *  checksum 
)

Decide whether a data file shall be extracted, i.e. referred in the template file and listed in the jigdo file, or whether its content shall be written compressed into the template file.

Since
2.0.0
Parameters
jte_handleThe environment to be used.
filenameThe address to be used with fopen(filename, "r")
sizeNumber of bytes in the data file
mirror_nameReturns the name which shall be listed in the jigdo file. This is NULL or allocated memory that has to be disposed by free(3).
checksumMay get filled by a checksum for libjte_write_match_record2(). The size of the needed buffer here varies depending on the checksum chosen in libjte_set_checksum_algorithm() and is passed back by that function.
Returns
0= use libjte_write_unmatched(), 1= use libjte_write_match_record() -1= would have called exit(1) if enabled

Definition at line 498 of file libjte.c.

References libjte_report_no_mem(), and list_file_in_jigdo().

Referenced by libjte_decide_file_jigdo().

◆ libjte_decode_checksum_string()

static int libjte_decode_checksum_string ( struct libjte_env o,
char *  checksum_code,
int  default_algo,
int *  algo 
)
static

◆ libjte_destroy()

int libjte_destroy ( struct libjte_env **  jte_handle)

Dispose a libjte environment and free the system facilities which it uses.

Since
0.1.0
Parameters
jte_handleThe environment to be disposed. jte_handle will be set to NULL
Returns
>0 means success, <=0 indicates failure

Definition at line 132 of file libjte.c.

References checksum_free_context(), libjte_env::iso_context, libjte_env::jchecksum_list, libjte_env::jjigdo_out, libjte_env::jtemplate_out, libjte_env::jtjigdo, libjte_env::jttemplate, libjte_clear_msg_list(), libjte_destroy_checksum_list(), libjte_destroy_entry_list(), libjte_destroy_path_mapping(), libjte_destroy_path_match_list(), libjte_env::outfile, libjte_env::template_context, and libjte_env::uncomp_buf.

Referenced by Xorriso_destroy(), and Xorriso_jigdo_interpreter().

◆ libjte_end_data_file()

int libjte_end_data_file ( struct libjte_env jte_handle)

Tell libjte that all content of the previously announced data file has been submitted to libjte_show_data_chunk(). libjte will direct the following calls of libjte_show_data_chunk() into the template file.

Since
0.1.0
Parameters
jte_handleThe environment to be used.
Returns
>0 means success, <=0 indicates failure

Definition at line 559 of file libjte.c.

References libjte_env::include_in_jigdo.

Referenced by iso_filesrc_write_data().

◆ libjte_get_next_message()

char* libjte_get_next_message ( struct libjte_env o)

Get the oldest pending message from the message list.

Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
Returns
Pointer to alloceted memory. Apply free() when no longer needed. NULL means that no more message is available

Definition at line 579 of file libjte.c.

References _jigdo_msg_entry::message, libjte_env::msg_list, and _jigdo_msg_entry::next.

Referenced by iso_libjte_forward_msgs(), libjte_clear_msg_list(), Xorriso_jigdo_interpreter(), and Xorriso_process_msg_queues().

◆ libjte_new()

◆ libjte_set_checksum_algorithm()

int libjte_set_checksum_algorithm ( struct libjte_env jte_handle,
char *  algorithm,
int *  size 
)

Choose the checksum algorithm that libjte will use in its checksum calculations and expectations. Supported algorithms are "md5" and "sha256". If this function is not called explicitly, libjte will default to "md5" for backwards compatibility with older versions of the library that only supported md5. Choice of the checksum algorithm here is important elsewhere in terms of sizes of buffers, formats of input, etc.:

  • libjte_set_md5_path()
  • libjte_set_checksum_path()
  • libjte_decide_file_jigdo{,2}()
  • libjte_write_match_record{,2}() It also affects the compatibility of the jigdo and template files created. Choosing "md5" will modify the format of the template file, and declare the "Version" in the [Jigdo] field to be 1.2. Choosing "sha256" will declare the "Version" in the [Jigdo] field to be 2.0 and the output will NOT work with older jigdo client tools.
    Since
    2.0.0
    Parameters
    jte_handleThe environment to be manipulated.
    algorithmIf not 0 : cause verbosity
    sizePointer to storage; if no errors, will be filled with the size in bytes of the checksum output for future function calls to use
    Returns
    >0 means success, <=0 indicates failure

Definition at line 185 of file libjte.c.

References check_algos, libjte_env::checksum_algo, libjte_add_msg_entry(), libjte_env::message_buffer, and _checksum_data::raw_bytes.

Referenced by Xorriso_jigdo_interpreter().

◆ libjte_set_checksum_iso()

int libjte_set_checksum_iso ( struct libjte_env jte_handle,
char *  checksum_code 
)

Choose one or more checksum algorithms to be applied to the emerging payload image. The resulting sums will be written into the jigdo file as lines "# Image Hex ...". Supported algorithms are "md5", "sha1", "sha256", "sha512" which may be combined in a comma separated list like "md5,sha1,sha512". Checksum_code "all" chooses all available algorithms.

Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
checksum_codeComma separated list string or "all".
Returns
>0 means success, <=0 indicates failure

Definition at line 273 of file libjte.c.

References CHECK_MD5_USED, CHECK_SHA1_USED, CHECK_SHA256, CHECK_SHA256_USED, CHECK_SHA512_USED, libjte_env::checksum_algo, libjte_env::checksum_algo_iso, and libjte_decode_checksum_string().

Referenced by Xorriso_jigdo_interpreter().

◆ libjte_set_checksum_path()

int libjte_set_checksum_path ( struct libjte_env jte_handle,
char *  path 
)

Tell libjte the hard disk address of the .checksum file, which lists the data files which might get extracted and referred in the jigdo file.

Since
2.0.0
Parameters
jte_handleThe environment to be manipulated.
pathWill be used with fopen(path, "r")
Returns
>0 means success, <=0 indicates failure

Definition at line 223 of file libjte.c.

References libjte_env::jchecksum_list, and libjte__set_string().

Referenced by libjte_set_md5_path(), and Xorriso_jigdo_interpreter().

◆ libjte_set_checksum_template()

int libjte_set_checksum_template ( struct libjte_env jte_handle,
char *  checksum_code 
)

Choose one or more checksum algorithms to be applied to the emerging template file. The resulting sums will be written into the jigdo file as lines "# Template Hex ...". Supported algorithms are "md5", "sha1", "sha256", "sha512" which may be combined in a comma separated list like "md5,sha1,sha512". Checksum_code "all" chooses all available algorithms.

Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
checksum_codeComma separated list string or "all".
Returns
>0 means success, <=0 indicates failure

Definition at line 295 of file libjte.c.

References CHECK_MD5_USED, CHECK_SHA256, CHECK_SHA256_USED, libjte_env::checksum_algo, libjte_env::checksum_algo_tmpl, and libjte_decode_checksum_string().

Referenced by Xorriso_jigdo_interpreter().

◆ libjte_set_compression()

int libjte_set_compression ( struct libjte_env jte_handle,
char *  compression_code 
)

Choose a compression algorithm for the template file.

Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
compression_codeEither "gzip" or "bzip2".
Returns
>0 means success, <=0 indicates failure

Definition at line 314 of file libjte.c.

References JTE_TEMP_BZIP2, JTE_TEMP_GZIP, libjte_env::jte_template_compression, libjte_add_msg_entry(), and libjte_env::message_buffer.

Referenced by Xorriso_jigdo_interpreter().

◆ libjte_set_error_behavior()

int libjte_set_error_behavior ( struct libjte_env o,
int  to_stderr,
int  with_exit 
)

Define how libjte shall deliver its messages and whether it is allowed to call exit() in hopeless situations.

Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
to_stderrIf 0, append messages to the message list of the libjte environment. If 1 print messages directly to stderr. This is the default.
with_exitIf 1 perform exit(1); when encountering severe errors. If 0 return -1 in such situations. This is the default.
Returns
>0 means success, <=0 indicates failure

Definition at line 568 of file libjte.c.

References libjte_env::error_behavior.

Referenced by Xorriso_jigdo_interpreter().

◆ libjte_set_image_size()

int libjte_set_image_size ( struct libjte_env o,
off_t  image_size 
)

Before calling libjte_footer() submit the number of written payload bytes. The Traditional Data File API does not keep track of this count.

Since
0.1.0
Parameters
jte_handleThe environment to be used.
image_sizeNumber of bytes in the image.
Returns
>0 means success, <=0 indicates failure

Definition at line 378 of file libjte.c.

References libjte_env::image_size.

◆ libjte_set_jigdo_path()

int libjte_set_jigdo_path ( struct libjte_env jte_handle,
char *  path 
)

Define the file address on hard disk for the jigdo file.

Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
pathWill be used with fopen(path, "w")
Returns
>0 means success, <=0 indicates failure

Definition at line 213 of file libjte.c.

References libjte_env::jjigdo_out, and libjte__set_string().

Referenced by Xorriso_jigdo_interpreter().

◆ libjte_set_md5_path()

int libjte_set_md5_path ( struct libjte_env jte_handle,
char *  path 
)

Tell libjte the hard disk address of the .md5 file, which lists the data files which might get extracted and referred in the jigdo file. Still supported in 2.0.0, but is now just an alias for libjte_set_checksums_path(handle, path) below

Deprecated:
since 2.0.0
Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
pathWill be used with fopen(path, "r")
Returns
>0 means success, <=0 indicates failure

Definition at line 218 of file libjte.c.

References libjte_set_checksum_path().

◆ libjte_set_min_size()

int libjte_set_min_size ( struct libjte_env jte_handle,
int  min_size 
)

Define a minimum size for data files to get extracted and referred in the jigdo file.

Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
min_sizeLower size limit in bytes
Returns
>0 means success, <=0 indicates failure

Definition at line 228 of file libjte.c.

References libjte_env::jte_min_size.

Referenced by Xorriso_jigdo_interpreter().

◆ libjte_set_outfile()

int libjte_set_outfile ( struct libjte_env jte_handle,
char *  outfile 
)

Tell libjte the name that will become value of "Filename=" in the "[Image]" section of the jigdo file.

Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
outfileThe value
Returns
>0 means success, <=0 indicates failure

Definition at line 174 of file libjte.c.

References libjte__set_string(), and libjte_env::outfile.

Referenced by Xorriso_make_iso_write_opts().

◆ libjte_set_template_path()

int libjte_set_template_path ( struct libjte_env jte_handle,
char *  path 
)

Define the file address on hard disk for the template file.

Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
pathWill be used with fopen(path, "w")
Returns
>0 means success, <=0 indicates failure

Definition at line 208 of file libjte.c.

References libjte_env::jtemplate_out, and libjte__set_string().

Referenced by Xorriso_jigdo_interpreter().

◆ libjte_set_verbose()

int libjte_set_verbose ( struct libjte_env jte_handle,
int  verbose 
)

Enable or disable debugging verbosity.

Since
0.1.0
Parameters
jte_handleThe environment to be manipulated.
verboseIf not 0 : cause verbosity
Returns
>0 means success, <=0 indicates failure

Definition at line 179 of file libjte.c.

References libjte_env::verbose.

Referenced by Xorriso_jigdo_interpreter().

◆ libjte_show_data_chunk()

int libjte_show_data_chunk ( struct libjte_env jte_handle,
void *  buffer,
int  size,
int  count 
)

Show a chunk of payload data to libjte which will decide whether to write it into the template file or whether to ignore it, because it belongs to a Jigdo extracted file.

Since
0.1.0
Parameters
jte_handleThe environment to be used.
bufferThe memory buffer containing the payload bytes
sizeThe block size within buffer. (1 is well ok.)
countThe number of blocks of the given size within buffer.
Returns
>0 means success, <=0 indicates failure

Definition at line 548 of file libjte.c.

References libjte_env::image_size, libjte_env::include_in_jigdo, and jtwrite().

Referenced by show_chunk_to_jte().

◆ libjte_write_footer()

int libjte_write_footer ( struct libjte_env jte_handle)

Finish the production of jigdo and template file. This is to be done after all payload has been produced by the application and processed by libjte, and before the libjte environment gets disposed.

Since
0.1.0
Parameters
jte_handleThe environment to be finished.
Returns
>0 = ok 0 = error -1 = would have called exit(1) if enabled

Definition at line 422 of file libjte.c.

References libjte_env::jtjigdo, libjte_env::jttemplate, and write_jt_footer().

Referenced by finish_libjte().

◆ libjte_write_header()

int libjte_write_header ( struct libjte_env jte_handle)

Start the production of jigdo and template file. This is to be done after all parameters are set and before any payload data are produced by the application.

Since
0.1.0
Parameters
jte_handleThe environment to be started.
Returns
>0 = ok 0 = error -1 = would have called exit(1) if enabled

Definition at line 387 of file libjte.c.

References libjte_env::jchecksum_list, libjte_env::jjigdo_out, libjte_env::jtemplate_out, libjte_env::jtjigdo, libjte_env::jttemplate, libjte_add_msg_entry(), libjte_env::message_buffer, libjte_env::outfile, and write_jt_header().

Referenced by ecma119_image_new().

◆ libjte_write_match_record()

int libjte_write_match_record ( struct libjte_env jte_handle,
char *  filename,
char *  mirror_name,
int  sector_size,
off_t  size,
unsigned char  md5[16] 
)

Register a list entry in the jigdo file and write a reference tag into the template file. This is to be called if libjte_decide_file_jigdo() returned 1.

Deprecated:
since 2.0.0, use libjte_write_match_record2() in preference.
Since
0.1.0
Parameters
jte_handleThe environment to be used.
filenameThe address to be used with fopen(filename, "r").
mirror_nameThe mirror_name returned by libjte_decide_file_jigdo().
sector_sizeAn eventual byte address alignment which is achieved in the payload image by padding file ends with zeros. Submit 1 if no alignment is done. For ISO images: 2048.
sizeThe number of bytes in the data file.
md5The md5 buffer submitted to libjte_decide_file_jigdo().
Returns
>0 = ok 0 = error -1 = would have called exit(1) if enabled, e.g. if called after saying "sha256" in libjte_set_checksum_algorithm().

Definition at line 449 of file libjte.c.

References check_algos, CHECK_MD5, libjte_env::checksum_algo, libjte_add_msg_entry(), libjte_env::message_buffer, _checksum_data::name, _checksum_data::type, and write_jt_match_record().

◆ libjte_write_match_record2()

int libjte_write_match_record2 ( struct libjte_env jte_handle,
char *  filename,
char *  mirror_name,
int  sector_size,
off_t  size,
unsigned char *  checksum 
)

Register a list entry in the jigdo file and write a reference tag into the template file. This is to be called if libjte_decide_file_jigdo() returned 1.

Since
2.0.0
Parameters
jte_handleThe environment to be used.
filenameThe address to be used with fopen(filename, "r").
mirror_nameThe mirror_name returned by libjte_decide_file_jigdo().
sector_sizeAn eventual byte address alignment which is achieved in the payload image by padding file ends with zeros. Submit 1 if no alignment is done. For ISO images: 2048.
sizeThe number of bytes in the data file.
checksumThe checksum buffer submitted to libjte_decide_file_jigdo2().
Returns
>0 = ok 0 = error -1 = would have called exit(1) if enabled

Definition at line 470 of file libjte.c.

References write_jt_match_record().

◆ libjte_write_unmatched()

int libjte_write_unmatched ( struct libjte_env jte_handle,
void *  buffer,
int  size,
int  count 
)

Write a payload data chunk into the template file. This is to be called with any data file bytes if libjte_decide_file_jigdo{,2}() returned 0. It is also to be called with any payload image bytes which are not content of a data file.

Since
0.1.0
Parameters
jte_handleThe environment to be used.
bufferThe memory buffer containing the payload bytes
sizeThe block size within buffer. (1 is well ok.)
countThe number of blocks of the given size within buffer.
Returns
>0 means success, <=0 indicates failure

Definition at line 440 of file libjte.c.

References jtwrite().