Changeset 182 for trunk/include


Ignore:
Timestamp:
03/17/10 02:41:17 (15 years ago)
Author:
tim
Message:

redesigned regfi logging API to utilize thread-local storage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/regfi.h

    r180 r182  
    8181
    8282/* regfi library error message types */
    83 #define REGFI_MSG_INFO  0x0001
    84 #define REGFI_MSG_WARN  0x0004
    85 #define REGFI_MSG_ERROR 0x0010
     83#define REGFI_LOG_INFO  0x0001
     84#define REGFI_LOG_WARN  0x0004
     85#define REGFI_LOG_ERROR 0x0010
     86
     87/* For internal use */
     88pthread_key_t REGFI_LOG_KEY;
    8689
    8790typedef uint8_t REGFI_ENCODING;
     
    240243
    241244
     245typedef struct _regfi_log
     246{
     247  /* Error/warning/info messages returned by lower layer functions */
     248  char* messages;
     249
     250  /* Mask for error message types that will be stored. */
     251  uint16_t msg_mask;
     252
     253} REGFI_LOG;
     254
     255
    242256/** HBIN block information
    243257 * @ingroup regfiMiddleLayer
     
    695709  pthread_mutex_t* sk_lock;
    696710
    697   /* Error/warning/info messages returned by lower layer functions */
    698   char* last_message;
    699 
    700   /* Mask for error message types that will be stored. */
    701   uint16_t msg_mask;
    702 
    703 
    704711  /* Data parsed from file header */
    705712  /********************************/
     
    849856
    850857
     858/** Enables regfi library logging for the current thread.
     859 *
     860 * XXX: finish documenting
     861 *
     862 * @ingroup regfiBase
     863 */
     864void regfi_log_start(uint16_t mask);
     865
     866
    851867/** Get errors, warnings, and/or verbose information relating to processing of
    852868 *  the given registry file.
    853869 *
    854  * @param file the structure for the registry file
    855  *
    856870 * @return A newly allocated char* which must be free()d by the caller.
    857871 *
    858872 * @ingroup regfiBase
    859873 */
    860 char*                 regfi_get_messages(REGFI_FILE* file);
     874char* regfi_log_get_str();
    861875
    862876
     
    865879 *
    866880 * This may be called at any time and will take effect immediately.
    867  *
    868  * @param file   the structure for the registry file
    869881 *
    870882 * @param mask   an integer representing the types of messages desired.
     
    883895 * @ingroup regfiBase
    884896 */
    885 void                  regfi_set_message_mask(REGFI_FILE* file, uint16_t mask);
     897void regfi_log_set_mask(uint16_t mask);
     898
     899
     900/** Disables regfi library logging for the current thread.
     901 *
     902 * XXX: finish documenting
     903 *
     904 * @ingroup regfiBase
     905 */
     906void regfi_log_stop();
    886907
    887908
Note: See TracChangeset for help on using the changeset viewer.