+VALUE rb_rrd_resize(
+ VALUE self,
+ VALUE args)
+{
+ return rrd_call(rrd_resize, args);
+}
+
+VALUE rb_rrd_restore(
+ VALUE self,
+ VALUE args)
+{
+ return rrd_call(rrd_restore, args);
+}
+
+VALUE rb_rrd_tune(
+ VALUE self,
+ VALUE args)
+{
+ return rrd_call(rrd_tune, args);
+}
+
+VALUE rb_rrd_update(
+ VALUE self,
+ VALUE args)
+{
+ return rrd_call(rrd_update, args);
+}
+
+VALUE rb_rrd_flush(
+ VALUE self,
+ VALUE args)
+{
+ return rrd_call(rrd_cmd_flush, args);
+}
+
+
+/* Calls Returning Data via the Info Interface */
+
+VALUE rb_rrd_infocall(
+ RRDINFOFUNC func,
+ VALUE args)
+{
+ string_arr a;
+ rrd_info_t *p, *data;
+ VALUE result;
+
+ a = string_arr_new(args);
+ data = func(a.len, a.strings);
+ string_arr_delete(a);
+
+ RRD_CHECK_ERROR result = rb_hash_new();
+
+ p = data;
+ while (data) {
+ VALUE key = rb_str_new2(data->key);
+
+ switch (data->type) {
+ case RD_I_VAL:
+ if (isnan(data->value.u_val)) {
+ rb_hash_aset(result, key, Qnil);
+ } else {
+ rb_hash_aset(result, key, rb_float_new(data->value.u_val));
+ }
+ break;
+ case RD_I_CNT:
+ rb_hash_aset(result, key, INT2FIX(data->value.u_cnt));
+ break;
+ case RD_I_STR:
+ rb_hash_aset(result, key, rb_str_new2(data->value.u_str));
+ break;
+ case RD_I_INT:
+ rb_hash_aset(result, key, INT2FIX(data->value.u_int));
+ break;
+ case RD_I_BLO:
+ rb_hash_aset(result, key,
+ rb_str_new((char *)data->value.u_blo.ptr,
+ data->value.u_blo.size));
+ break;
+ }
+ data = data->next;
+ }
+ rrd_info_free(p);
+ return result;
+}
+
+VALUE rb_rrd_info(
+ VALUE self,
+ VALUE args)
+{
+ return rb_rrd_infocall(rrd_info, args);
+}
+
+VALUE rb_rrd_updatev(
+ VALUE self,
+ VALUE args)
+{
+ return rb_rrd_infocall(rrd_update_v, args);
+}
+
+VALUE rb_rrd_graphv(
+ VALUE self,
+ VALUE args)
+{
+ return rb_rrd_infocall(rrd_graph_v, args);
+}
+
+
+/* Other Calls */
+