From f49528a3dfa034415527824cbbd0762f3829f0cd Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 19 May 2000 11:01:06 +0000 Subject: [PATCH] Added as_path_get_first(). --- nest/a-path.c | 28 ++++++++++++++++++++++++++++ nest/attrs.h | 1 + 2 files changed, 29 insertions(+) diff --git a/nest/a-path.c b/nest/a-path.c index 0ea3e7b2..0c467551 100644 --- a/nest/a-path.c +++ b/nest/a-path.c @@ -103,6 +103,34 @@ as_path_getlen(struct adata *path) return res; } +int +as_path_get_first(struct adata *path) +{ + int res = -1; + u8 *p = path->data; + u8 *q = p+path->length; + int len; + + while (pnext; if (!mask) return next == q; \ asterisk = (mask->val == PM_ANY); \ if (asterisk) { mask = mask->next; if (!mask) { return 1; } } \ diff --git a/nest/attrs.h b/nest/attrs.h index 2618fa35..abd6b9e9 100644 --- a/nest/attrs.h +++ b/nest/attrs.h @@ -17,6 +17,7 @@ struct adata *as_path_prepend(struct linpool *pool, struct adata *olda, int as); void as_path_format(struct adata *path, byte *buf, unsigned int size); int as_path_getlen(struct adata *path); +int as_path_get_first(struct adata *path); struct f_path_mask { struct f_path_mask *next;