r4140 - in trunk/varnish-tools/perl/Varnish-API: . t
sky at projects.linpro.no
sky at projects.linpro.no
Wed Jul 15 01:02:28 CEST 2009
Author: sky
Date: 2009-07-15 01:02:28 +0200 (Wed, 15 Jul 2009)
New Revision: 4140
Modified:
trunk/varnish-tools/perl/Varnish-API/API.xs
trunk/varnish-tools/perl/Varnish-API/t/api.t
Log:
allow a user to get all tags and their corresponding values
Modified: trunk/varnish-tools/perl/Varnish-API/API.xs
===================================================================
--- trunk/varnish-tools/perl/Varnish-API/API.xs 2009-07-14 22:55:55 UTC (rev 4139)
+++ trunk/varnish-tools/perl/Varnish-API/API.xs 2009-07-14 23:02:28 UTC (rev 4140)
@@ -62,6 +62,20 @@
return newRV_noinc((SV*) fields);
}
+SV*
+get_tags() {
+ dTHX;
+ HV* fields;
+ fields = newHV();
+ int i = 1;
+#define SLTM(foo) \
+ hv_store(fields, #foo, strlen(#foo), newSViv(i++),0); \
+
+#include <varnish/shmlog_tags.h>
+#undef SLTM
+ return newRV_noinc((SV*) fields);
+}
+
IV
get_stat(struct varnish_stats *VSL_stats, const char* stat) {
@@ -90,6 +104,14 @@
RETVAL
SV*
+VSL_GetTags()
+ CODE:
+ RETVAL = get_tags();
+ OUTPUT:
+ RETVAL
+
+
+SV*
VSL_GetStatFieldDescriptions()
CODE:
RETVAL = get_field_descriptions();
Modified: trunk/varnish-tools/perl/Varnish-API/t/api.t
===================================================================
--- trunk/varnish-tools/perl/Varnish-API/t/api.t 2009-07-14 22:55:55 UTC (rev 4139)
+++ trunk/varnish-tools/perl/Varnish-API/t/api.t 2009-07-14 23:02:28 UTC (rev 4140)
@@ -6,7 +6,7 @@
use warnings;
-use Test::More tests => 4;
+use Test::More tests => 5;
BEGIN { use_ok('Varnish::API') };
use Devel::Peek;
@@ -21,3 +21,5 @@
ok(1);
ok(1, Varnish::API::VSL_Name);
+my $tags = Varnish::API::VSL_GetTags();
+is(Varnish::API::VSL_tags($tags->{Length}), "Length");
More information about the varnish-commit
mailing list