Add message queue facilities. Each IsoImage will have its own msg queue.
This commit is contained in:
@@ -409,4 +409,53 @@ int iso_dir_iter_take(IsoDirIter *iter);
|
||||
*/
|
||||
int iso_dir_iter_remove(IsoDirIter *iter);
|
||||
|
||||
#define ISO_MSGS_MESSAGE_LEN 4096
|
||||
|
||||
/**
|
||||
* Control queueing and stderr printing of messages from a given IsoImage.
|
||||
* Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT",
|
||||
* "NOTE", "UPDATE", "DEBUG", "ALL".
|
||||
*
|
||||
* @param image The image
|
||||
* @param queue_severity Gives the minimum limit for messages to be queued.
|
||||
* Default: "NEVER". If you queue messages then you
|
||||
* must consume them by iso_msgs_obtain().
|
||||
* @param print_severity Does the same for messages to be printed directly
|
||||
* to stderr.
|
||||
* @param print_id A text prefix to be printed before the message.
|
||||
* @return >0 for success, <=0 for error
|
||||
*/
|
||||
int iso_image_set_msgs_severities(IsoImage *img, char *queue_severity,
|
||||
char *print_severity, char *print_id);
|
||||
/**
|
||||
* Obtain the oldest pending message from a IsoImage message queue which has at
|
||||
* least the given minimum_severity. This message and any older message of
|
||||
* lower severity will get discarded from the queue and is then lost forever.
|
||||
*
|
||||
* Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT",
|
||||
* "NOTE", "UPDATE", "DEBUG", "ALL". To call with minimum_severity "NEVER"
|
||||
* will discard the whole queue.
|
||||
*
|
||||
* @param image The image whose messages we want to obtain
|
||||
* @param error_code Will become a unique error code as listed in messages.h
|
||||
* @param msg_text Must provide at least ISO_MSGS_MESSAGE_LEN bytes.
|
||||
* @param os_errno Will become the eventual errno related to the message
|
||||
* @param severity Will become the severity related to the message and
|
||||
* should provide at least 80 bytes.
|
||||
* @return 1 if a matching item was found, 0 if not, <0 for severe errors
|
||||
*/
|
||||
int iso_image_obtain_msgs(IsoImage *image, char *minimum_severity,
|
||||
int *error_code, char msg_text[], int *os_errno,
|
||||
char severity[]);
|
||||
|
||||
/**
|
||||
* Return the messenger object handle used by the given image. This handle
|
||||
* may be used by related libraries to replace their own compatible
|
||||
* messenger objects and thus to direct their messages to the libisofs
|
||||
* message queue. See also: libburn, API function burn_set_messenger().
|
||||
*
|
||||
* @return the handle. Do only use with compatible
|
||||
*/
|
||||
void *iso_image_get_messenger(IsoImage *image);
|
||||
|
||||
#endif /*LIBISO_LIBISOFS_H_*/
|
||||
|
Reference in New Issue
Block a user