New API function burn_msgs_submit()

This commit is contained in:
Thomas Schmitt 2007-09-22 15:17:41 +00:00
parent cae5faa6fc
commit 86b845a4e2
3 changed files with 56 additions and 3 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.09.22.140613" #define Cdrskin_timestamP "2007.09.22.151712"

View File

@ -16,6 +16,7 @@
#include "error.h" #include "error.h"
#include "libburn.h" #include "libburn.h"
#include "drive.h" #include "drive.h"
#include "transport.h"
/* ts A60825 : The storage location for back_hacks.h variables. */ /* ts A60825 : The storage location for back_hacks.h variables. */
#define BURN_BACK_HACKS_INIT 1 #define BURN_BACK_HACKS_INIT 1
@ -229,6 +230,37 @@ ex:
return ret; return ret;
} }
/* ts A70922 : API */
int burn_msgs_submit(int error_code, char msg_text[], int os_errno,
char severity[], struct burn_drive *d)
{
int ret, sevno, global_index = -1;
ret = libdax_msgs__text_to_sev(severity, &sevno, 0);
if (ret <= 0)
sevno = LIBDAX_MSGS_SEV_FATAL;
if (error_code <= 0) {
switch(sevno) {
case LIBDAX_MSGS_SEV_ABORT: error_code = 0x00040000;
break; case LIBDAX_MSGS_SEV_FATAL: error_code = 0x00040001;
break; case LIBDAX_MSGS_SEV_SORRY: error_code = 0x00040002;
break; case LIBDAX_MSGS_SEV_WARNING: error_code = 0x00040003;
break; case LIBDAX_MSGS_SEV_HINT: error_code = 0x00040004;
break; case LIBDAX_MSGS_SEV_NOTE: error_code = 0x00040005;
break; case LIBDAX_MSGS_SEV_UPDATE: error_code = 0x00040006;
break; case LIBDAX_MSGS_SEV_DEBUG: error_code = 0x00040007;
break; default: error_code = 0x00040001;
}
}
if (d != NULL)
global_index = d->global_index;
ret = libdax_msgs_submit(libdax_messenger, global_index, error_code,
sevno, LIBDAX_MSGS_PRIO_HIGH, msg_text, os_errno, 0);
return ret;
}
int burn_builtin_abort_handler(void *handle, int signum, int flag) int burn_builtin_abort_handler(void *handle, int signum, int flag)
{ {
if(getpid() != abort_control_pid) { if(getpid() != abort_control_pid) {

View File

@ -1850,7 +1850,7 @@ void burn_version(int *major, int *minor, int *micro);
/* ts A60924 : ticket 74 */ /* ts A60924 : ticket 74 */
/** Control queueing and stderr printing of messages from libburn. /** Control queueing and stderr printing of messages from libburn.
Severity may be one of "NEVER", "FATAL", "SORRY", "WARNING", "HINT", Severity may be one of "NEVER", "ABORT", "FATAL", "SORRY", "WARNING", "HINT",
"NOTE", "UPDATE", "DEBUG", "ALL". "NOTE", "UPDATE", "DEBUG", "ALL".
@param queue_severity Gives the minimum limit for messages to be queued. @param queue_severity Gives the minimum limit for messages to be queued.
Default: "NEVER". If you queue messages then you Default: "NEVER". If you queue messages then you
@ -1870,7 +1870,7 @@ int burn_msgs_set_severities(char *queue_severity,
/** Obtain the oldest pending libburn message from the queue which has at /** Obtain the oldest pending libburn message from the queue which has at
least the given minimum_severity. This message and any older message of 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. lower severity will get discarded from the queue and is then lost forever.
@param minimum_severity may be one of "NEVER", "FATAL", "SORRY", @param minimum_severity may be one of "NEVER", "ABORT", "FATAL", "SORRY",
"WARNING", "HINT", "NOTE", "UPDATE", "DEBUG", "ALL". "WARNING", "HINT", "NOTE", "UPDATE", "DEBUG", "ALL".
To call with minimum_severity "NEVER" will discard the To call with minimum_severity "NEVER" will discard the
whole queue. whole queue.
@ -1887,6 +1887,27 @@ int burn_msgs_obtain(char *minimum_severity,
char severity[]); char severity[]);
/* ts A70922 */
/** Submit a message to the libburn queueing system. It will be queued or
printed as if it was generated by libburn itself.
@param error_code The unique error code of your message.
Submit 0 if you do not have reserved error codes within
the libburnia project.
@param msg_text Not more than BURN_MSGS_MESSAGE_LEN characters of
message text.
@param os_errno Eventual errno related to the message. Submit 0 if
the message is not related to a operating system error.
@param severity One of "ABORT", "FATAL", "SORRY", "WARNING", "HINT",
"NOTE", "UPDATE", "DEBUG". Defaults to "FATAL".
@param d An eventual drive to which the message shall be related.
Submit NULL if the message is not specific to a
particular drive object.
@return 1 if message was delivered, <=0 if failure
*/
int burn_msgs_submit(int error_code, char msg_text[], int os_errno,
char severity[], struct burn_drive *d);
/* ts A70915 */ /* ts A70915 */
/** Replace the messenger object handle of libburn by a compatible handle /** Replace the messenger object handle of libburn by a compatible handle
obtained from a related library. obtained from a related library.