summaryrefslogtreecommitdiff
path: root/nest/a-path.c
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2000-04-17 11:06:39 +0000
committerPavel Machek <pavel@ucw.cz>2000-04-17 11:06:39 +0000
commit684c6f5a0e134426159be7dbd514271aea9f4d3d (patch)
tree0e5acd2b882f7e05365d6e50a3a6fcc2f41ed974 /nest/a-path.c
parentecd25633bdc3e491a0eca44c63c158eeff388f13 (diff)
Path_getlen moved to nest and length was made callable from filters.
Diffstat (limited to 'nest/a-path.c')
-rw-r--r--nest/a-path.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/nest/a-path.c b/nest/a-path.c
index ca39e296..d808bc9a 100644
--- a/nest/a-path.c
+++ b/nest/a-path.c
@@ -81,3 +81,21 @@ as_path_format(struct adata *path, byte *buf, unsigned int size)
}
*buf = 0;
}
+
+int
+as_path_getlen(struct adata *path)
+{
+ int res = 0;
+ u8 *p = path->data;
+ u8 *q = p+path->length;
+ int len;
+
+ while (p<q) {
+ switch (*p++) {
+ case 1: len = *p++; res++; p += 2*len; break;
+ case 2: len = *p++; res+=len; p += 2*len; break;
+ default: bug("This should not be in path");
+ }
+ }
+ return res;
+}