summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-05-22 13:41:01 +0300
committerDavid Lamparter <equinox@opensourcerouting.org>2015-05-29 07:31:02 +0200
commit3293bc280f15d8e3c04e0bf9b0a8d54d342a87a9 (patch)
treecbc3dc09016553de6bf9d97c641a4d9caaa40fda /lib
parentf85592e05ae6463727433893e61afd1081fcf7e0 (diff)
downloadquagga-3293bc280f15d8e3c04e0bf9b0a8d54d342a87a9.tar.bz2
quagga-3293bc280f15d8e3c04e0bf9b0a8d54d342a87a9.tar.xz
route table: constify some APIs
Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/table.c12
-rw-r--r--lib/table.h4
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/table.c b/lib/table.c
index bd7023c1..da213616 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -59,7 +59,7 @@ route_node_new (struct route_table *table)
/* Allocate new route node with prefix set. */
static struct route_node *
-route_node_set (struct route_table *table, struct prefix *prefix)
+route_node_set (struct route_table *table, const struct prefix *prefix)
{
struct route_node *node;
@@ -141,14 +141,14 @@ static const u_char maskbit[] =
/* Common prefix route genaration. */
static void
-route_common (struct prefix *n, struct prefix *p, struct prefix *new)
+route_common (const struct prefix *n, const struct prefix *p, struct prefix *new)
{
int i;
u_char diff;
u_char mask;
- u_char *np = (u_char *)&n->u.prefix;
- u_char *pp = (u_char *)&p->u.prefix;
+ const u_char *np = (const u_char *)&n->u.prefix;
+ const u_char *pp = (const u_char *)&p->u.prefix;
u_char *newp = (u_char *)&new->u.prefix;
for (i = 0; i < p->prefixlen / 8; i++)
@@ -265,7 +265,7 @@ route_node_match_ipv6 (const struct route_table *table,
/* Lookup same prefix node. Return NULL when we can't find route. */
struct route_node *
-route_node_lookup (const struct route_table *table, struct prefix *p)
+route_node_lookup (const struct route_table *table, const struct prefix *p)
{
struct route_node *node;
u_char prefixlen = p->prefixlen;
@@ -287,7 +287,7 @@ route_node_lookup (const struct route_table *table, struct prefix *p)
/* Add node to routing table. */
struct route_node *
-route_node_get (struct route_table *const table, struct prefix *p)
+route_node_get (struct route_table *const table, const struct prefix *p)
{
struct route_node *new;
struct route_node *node;
diff --git a/lib/table.h b/lib/table.h
index ab7eb68c..2ffd79b5 100644
--- a/lib/table.h
+++ b/lib/table.h
@@ -148,9 +148,9 @@ extern struct route_node *route_next (struct route_node *);
extern struct route_node *route_next_until (struct route_node *,
struct route_node *);
extern struct route_node *route_node_get (struct route_table *const,
- struct prefix *);
+ const struct prefix *);
extern struct route_node *route_node_lookup (const struct route_table *,
- struct prefix *);
+ const struct prefix *);
extern struct route_node *route_lock_node (struct route_node *node);
extern struct route_node *route_node_match (const struct route_table *,
const struct prefix *);