10 #ifndef PCMK__OUTPUT_INTERNAL__H 11 # define PCMK__OUTPUT_INTERNAL__H 16 # include <libxml/tree.h> 17 # include <libxml/HTMLtree.h> 31 #if defined(PCMK__WITH_ATTRIBUTE_OUTPUT_ARGS) 32 # define PCMK__OUTPUT_ARGS(ARGS...) __attribute__((output_args(ARGS))) 34 # define PCMK__OUTPUT_ARGS(ARGS...) 157 #define PCMK__SUPPORTED_FORMAT_HTML { "html", pcmk__mk_html_output, pcmk__html_output_entries } 158 #define PCMK__SUPPORTED_FORMAT_LOG { "log", pcmk__mk_log_output, pcmk__log_output_entries } 159 #define PCMK__SUPPORTED_FORMAT_NONE { PCMK__VALUE_NONE, pcmk__mk_none_output, \ 160 pcmk__none_output_entries } 161 #define PCMK__SUPPORTED_FORMAT_TEXT { "text", pcmk__mk_text_output, pcmk__text_output_entries } 162 #define PCMK__SUPPORTED_FORMAT_XML { "xml", pcmk__mk_xml_output, pcmk__xml_output_entries } 343 const char *proc_stdout,
const char *proc_stderr);
444 const char *plural_noun,
const char *format, ...)
583 const char *filename,
char **argv);
604 const GOptionEntry *options);
767 const
char *function, uint32_t line,
784 G_GNUC_NULL_TERMINATED;
808 G_GNUC_NULL_TERMINATED;
888 const
char *class_name, const
char *text);
907 G_GNUC_NULL_TERMINATED;
949 pcmk__output_select_rc(
int old_rc,
int new_rc)
966 #if defined(PCMK__UNIT_TESTING) 970 GHashTable *pcmk__output_formatters(
void);
973 #define PCMK__OUTPUT_SPACER_IF(out_obj, cond) \ 978 #define PCMK__OUTPUT_LIST_HEADER(out_obj, cond, retcode, title...) \ 979 if (retcode == pcmk_rc_no_output) { \ 980 PCMK__OUTPUT_SPACER_IF(out_obj, cond); \ 981 retcode = pcmk_rc_ok; \ 982 out_obj->begin_list(out_obj, NULL, NULL, title); \ 985 #define PCMK__OUTPUT_LIST_FOOTER(out_obj, retcode) \ 986 if (retcode == pcmk_rc_ok) { \ 987 out_obj->end_list(out_obj); \ int(* pcmk__message_fn_t)(pcmk__output_t *out, va_list args)
void(* end_list)(pcmk__output_t *out)
void void void void pcmk__formatted_vprintf(pcmk__output_t *out, const char *format, va_list args) G_GNUC_PRINTF(2
void pcmk__output_xml_push_parent(pcmk__output_t *out, xmlNodePtr parent)
pcmk__output_t * pcmk__mk_text_output(char **argv)
void void pcmk__indented_vprintf(pcmk__output_t *out, const char *format, va_list args) G_GNUC_PRINTF(2
pcmk__message_fn_t fn
The function to be called for message_id given a match on fmt_name. See comments on pcmk__message_fn_...
void pcmk__register_messages(pcmk__output_t *out, const pcmk__message_entry_t *table)
void void void void void pcmk__text_prompt(const char *prompt, bool echo, char **dest)
int(* message)(pcmk__output_t *out, const char *message_id,...)
void pcmk__html_add_header(const char *name,...) G_GNUC_NULL_TERMINATED
const char * fmt_name
The name of this output formatter.
bool(* is_quiet)(pcmk__output_t *out)
void(* spacer)(pcmk__output_t *out)
xmlNodePtr pcmk__output_xml_create_parent(pcmk__output_t *out, const char *name,...) G_GNUC_NULL_TERMINATED
void pcmk__register_message(pcmk__output_t *out, const char *message_id, pcmk__message_fn_t fn)
struct pcmk__message_entry_s pcmk__message_entry_t
pcmk__output_t * pcmk__mk_html_output(char **argv)
xmlNodePtr pcmk__output_xml_peek_parent(pcmk__output_t *out)
enum crm_exit_e crm_exit_t
int(* info)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
void pcmk__output_set_log_filter(pcmk__output_t *out, const char *file, const char *function, uint32_t line, uint32_t tags)
xmlNodePtr pcmk__output_create_html_node(pcmk__output_t *out, const char *element_name, const char *id, const char *class_name, const char *text)
void pcmk__output_set_log_level(pcmk__output_t *out, uint8_t log_level)
GOptionEntry pcmk__html_output_entries[]
pcmk__output_t * pcmk__mk_log_output(char **argv)
GOptionEntry pcmk__xml_output_entries[]
int pcmk__call_message(pcmk__output_t *out, const char *message_id,...)
void void void pcmk__formatted_printf(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
GHashTable * messages
Custom messages that are currently registered on this formatter.
void(* prompt)(const char *prompt, bool echo, char **dest)
void * priv
Implementation-specific private data.
void pcmk__register_formats(GOptionGroup *group, const pcmk__supported_format_t *table)
void(* register_message)(pcmk__output_t *out, const char *message_id, pcmk__message_fn_t fn)
pcmk__output_t * pcmk__mk_none_output(char **argv)
const char * fmt_name
The format type this handler is for.
int pcmk__xml_output_new(pcmk__output_t **out, xmlNodePtr *xml)
bool quiet
Should this formatter supress most output?
void(* free_priv)(pcmk__output_t *out)
bool(* init)(pcmk__output_t *out)
int(*) int(*) void(*) void(* output_xml)(pcmk__output_t *out, const char *name, const char *buf)
int(*) int(*) void(* err)(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
GOptionEntry pcmk__log_output_entries[]
void(* finish)(pcmk__output_t *out, crm_exit_t exit_status, bool print, void **copy_dest)
void pcmk__indented_printf(pcmk__output_t *out, const char *format,...) G_GNUC_PRINTF(2
xmlNodePtr pcmk__output_create_xml_node(pcmk__output_t *out, const char *name,...) G_GNUC_NULL_TERMINATED
int pcmk__register_format(GOptionGroup *group, const char *name, pcmk__output_factory_t create, const GOptionEntry *options)
void pcmk__output_xml_pop_parent(pcmk__output_t *out)
Function and executable result codes.
pcmk__output_t * pcmk__mk_xml_output(char **argv)
FILE * dest
Where output should be written.
void pcmk__output_free(pcmk__output_t *out)
void pcmk__unregister_formats(void)
GOptionEntry pcmk__text_output_entries[]
GOptionEntry pcmk__none_output_entries[]
pcmk__output_t *(* pcmk__output_factory_t)(char **argv)
void(*) void(* list_item)(pcmk__output_t *out, const char *name, const char *format,...) G_GNUC_PRINTF(3
gchar * request
A copy of the request that generated this output.
void pcmk__output_and_clear_error(GError **error, pcmk__output_t *out)
This structure contains everything that makes up a single output formatter.
void(* version)(pcmk__output_t *out, bool extended)
void(* begin_list)(pcmk__output_t *out, const char *singular_noun, const char *plural_noun, const char *format,...) G_GNUC_PRINTF(4
void pcmk__xml_output_finish(pcmk__output_t *out, xmlNodePtr *xml)
void(* reset)(pcmk__output_t *out)
int pcmk__output_new(pcmk__output_t **out, const char *fmt_name, const char *filename, char **argv)
void(* progress)(pcmk__output_t *out, bool end)
uint8_t pcmk__output_get_log_level(const pcmk__output_t *out)
int pcmk__text_output_new(pcmk__output_t **out, const char *filename)
xmlNodePtr pcmk__output_create_xml_text_node(pcmk__output_t *out, const char *name, const char *content)
const char * message_id
The message to be handled.
void(*) void(*) void(* increment_list)(pcmk__output_t *out)
void(* subprocess_output)(pcmk__output_t *out, int exit_status, const char *proc_stdout, const char *proc_stderr)
int pcmk__log_output_new(pcmk__output_t **out)
struct pcmk__supported_format_s pcmk__supported_format_t
void pcmk__output_xml_add_node_copy(pcmk__output_t *out, xmlNodePtr node)