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 int nvpair_parse_stream_limited(struct nvpair *n, FILE * stream, char ** attr_list, int attr_len);
00048
00055 int nvpair_print(struct nvpair *n, char *text, int length);
00056
00062 int nvpair_print_alloc(struct nvpair *n, char **text);
00063
00068 void nvpair_remove( struct nvpair *n, const char *name );
00069
00075 void nvpair_insert_string(struct nvpair *n, const char *name, const char *value);
00076 void nvpair_insert_integer(struct nvpair *n, const char *name, INT64_T value);
00082
00088 void nvpair_insert_float(struct nvpair *n, const char *name, double value);
00089
00095 const char *nvpair_lookup_string(struct nvpair *n, const char *name);
00096
00102 INT64_T nvpair_lookup_integer(struct nvpair *n, const char *name);
00103
00109 double nvpair_lookup_float(struct nvpair *n, const char *name);
00110
00115 void nvpair_export( struct nvpair *nv );
00116
00117
00125 void nvpair_first_item(struct nvpair *nv);
00126
00135 int nvpair_next_item(struct nvpair *nv, char **name, char **value);
00136
00137
00138 typedef enum {
00139 NVPAIR_MODE_STRING,
00140 NVPAIR_MODE_INTEGER,
00141 NVPAIR_MODE_URL,
00142 NVPAIR_MODE_METRIC,
00143 NVPAIR_MODE_TIME,
00144 NVPAIR_MODE_TIMESTAMP
00145 } nvpair_mode_t;
00146
00147 typedef enum {
00148 NVPAIR_ALIGN_LEFT,
00149 NVPAIR_ALIGN_RIGHT
00150 } nvpair_align_t;
00151
00152 struct nvpair_header {
00153 const char *name;
00154 const char *title;
00155 nvpair_mode_t mode;
00156 nvpair_align_t align;
00157 int width;
00158 };
00159
00164 void nvpair_print_text(struct nvpair *n, FILE * stream);
00165
00170 void nvpair_print_xml(struct nvpair *n, FILE * stream);
00171
00176 void nvpair_print_json(struct nvpair *n, FILE * stream);
00177
00182 void nvpair_print_new_classads(struct nvpair *n, FILE * stream);
00183
00188 void nvpair_print_old_classads(struct nvpair *n, FILE * stream);
00189
00194 void nvpair_print_html_solo(struct nvpair *n, FILE * stream);
00195
00196 void nvpair_print_html_header(FILE * stream, struct nvpair_header *h);
00197 void nvpair_print_html(struct nvpair *n, FILE * stream, struct nvpair_header *h);
00198 void nvpair_print_html_with_link(struct nvpair *n, FILE * stream, struct nvpair_header *h, const char *linkname, const char *linktext);
00199
00200 void nvpair_print_html_footer(FILE * stream, struct nvpair_header *h);
00201
00202 void nvpair_print_table_header(FILE * stream, struct nvpair_header *h);
00203 void nvpair_print_table(struct nvpair *n, FILE * stream, struct nvpair_header *h);
00204 void nvpair_print_table_footer(FILE * stream, struct nvpair_header *h);
00205
00206 #endif