00001
00002
00003
00004
00005
00006
00007
00008 #ifndef NVPAIR_H
00009 #define NVPAIR_H
00010
00011 #include <stdio.h>
00012
00013 #include "int_sizes.h"
00014 #include "hash_table.h"
00015
00029 struct nvpair *nvpair_create();
00030
00034 void nvpair_delete(struct nvpair *n);
00035
00040 void nvpair_parse(struct nvpair *n, const char *text);
00041
00046 int nvpair_parse_stream(struct nvpair *n, FILE * stream);
00047
00054 int nvpair_print(struct nvpair *n, char *text, int length);
00055
00061 int nvpair_print_alloc(struct nvpair *n, char **text);
00062
00067 void nvpair_remove( struct nvpair *n, const char *name );
00068
00074 void nvpair_insert_string(struct nvpair *n, const char *name, const char *value);
00075 void nvpair_insert_integer(struct nvpair *n, const char *name, INT64_T value);
00081
00087 void nvpair_insert_float(struct nvpair *n, const char *name, double value);
00088
00094 const char *nvpair_lookup_string(struct nvpair *n, const char *name);
00095
00101 INT64_T nvpair_lookup_integer(struct nvpair *n, const char *name);
00102
00108 double nvpair_lookup_float(struct nvpair *n, const char *name);
00109
00110
00111 typedef enum {
00112 NVPAIR_MODE_STRING,
00113 NVPAIR_MODE_INTEGER,
00114 NVPAIR_MODE_URL,
00115 NVPAIR_MODE_METRIC,
00116 NVPAIR_MODE_TIME,
00117 NVPAIR_MODE_TIMESTAMP
00118 } nvpair_mode_t;
00119
00120 typedef enum {
00121 NVPAIR_ALIGN_LEFT,
00122 NVPAIR_ALIGN_RIGHT
00123 } nvpair_align_t;
00124
00125 struct nvpair_header {
00126 const char *name;
00127 const char *title;
00128 nvpair_mode_t mode;
00129 nvpair_align_t align;
00130 int width;
00131 };
00132
00137 void nvpair_print_text(struct nvpair *n, FILE * stream);
00138
00143 void nvpair_print_xml(struct nvpair *n, FILE * stream);
00144
00149 void nvpair_print_json(struct nvpair *n, FILE * stream);
00150
00155 void nvpair_print_new_classads(struct nvpair *n, FILE * stream);
00156
00161 void nvpair_print_old_classads(struct nvpair *n, FILE * stream);
00162
00167 void nvpair_print_html_solo(struct nvpair *n, FILE * stream);
00168
00169 void nvpair_print_html_header(FILE * stream, struct nvpair_header *h);
00170 void nvpair_print_html(struct nvpair *n, FILE * stream, struct nvpair_header *h);
00171 void nvpair_print_html_with_link(struct nvpair *n, FILE * stream, struct nvpair_header *h, const char *linkname, const char *linktext);
00172
00173 void nvpair_print_html_footer(FILE * stream, struct nvpair_header *h);
00174
00175 void nvpair_print_table_header(FILE * stream, struct nvpair_header *h);
00176 void nvpair_print_table(struct nvpair *n, FILE * stream, struct nvpair_header *h);
00177 void nvpair_print_table_footer(FILE * stream, struct nvpair_header *h);
00178
00179 #endif