summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-08-14 17:59:25 +0100
committerPaul Jakma <paul@quagga.net>2008-08-22 19:52:58 +0100
commit1423c809cc4ddc2e013ba6264c49a11e5719c6f2 (patch)
treedb0389e7de020bbcb9fd78d45417b0842a6adb0b /lib
parent89d9fa301e146193093ff876f96b3612dc390bbb (diff)
[lib] mes_lookup string lookup table argument should be marked const
2008-08-14 Stephen Hemminger <stephen.hemminger@vyatta.com> * lib/log.{c,h}: struct message argument should point to const * */*.c: adjust to suit, Signed-off-by: Paul Jakma <paul@quagga.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/log.c4
-rw-r--r--lib/log.h2
-rw-r--r--lib/memory.c2
-rw-r--r--lib/sockopt.c13
-rw-r--r--lib/sockopt.h1
5 files changed, 18 insertions, 4 deletions
diff --git a/lib/log.c b/lib/log.c
index ce00bfbb..677cf9ad 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -740,9 +740,9 @@ zlog_rotate (struct zlog *zl)
/* Message lookup function. */
const char *
-lookup (struct message *mes, int key)
+lookup (const struct message *mes, int key)
{
- struct message *pnt;
+ const struct message *pnt;
for (pnt = mes; pnt->key != 0; pnt++)
if (pnt->key == key)
diff --git a/lib/log.h b/lib/log.h
index 7432b25e..777fd77d 100644
--- a/lib/log.h
+++ b/lib/log.h
@@ -144,7 +144,7 @@ extern int zlog_rotate (struct zlog *);
/* For hackey massage lookup and check */
#define LOOKUP(x, y) mes_lookup(x, x ## _max, y, "(no item found)")
-extern const char *lookup (struct message *, int);
+extern const char *lookup (const struct message *, int);
extern const char *mes_lookup (struct message *meslist,
int max, int index,
const char *no_item);
diff --git a/lib/memory.c b/lib/memory.c
index 9ed5e100..28b3d896 100644
--- a/lib/memory.c
+++ b/lib/memory.c
@@ -33,7 +33,7 @@ static void alloc_inc (int);
static void alloc_dec (int);
static void log_memstats(int log_priority);
-static struct message mstr [] =
+static const struct message mstr [] =
{
{ MTYPE_THREAD, "thread" },
{ MTYPE_THREAD_MASTER, "thread_master" },
diff --git a/lib/sockopt.c b/lib/sockopt.c
index a2038a5c..2f01199a 100644
--- a/lib/sockopt.c
+++ b/lib/sockopt.c
@@ -343,6 +343,19 @@ setsockopt_ipv4_ifindex (int sock, int val)
}
int
+setsockopt_ipv4_tos(int sock, int tos)
+{
+ int ret;
+
+ ret = setsockopt (sock, IPPROTO_IP, IP_TOS, &tos, sizeof (tos));
+ if (ret < 0)
+ zlog_warn ("Can't set IP_TOS option for fd %d to %#x: %s",
+ sock, tos, safe_strerror(errno));
+ return ret;
+}
+
+
+int
setsockopt_ifindex (int af, int sock, int val)
{
int ret = -1;
diff --git a/lib/sockopt.h b/lib/sockopt.h
index 95382792..cb05c6fb 100644
--- a/lib/sockopt.h
+++ b/lib/sockopt.h
@@ -89,6 +89,7 @@ extern int setsockopt_multicast_ipv4(int sock, int optname,
unsigned int ifindex
/* optional: if non-zero, may be used
instead of if_addr */);
+extern int setsockopt_ipv4_tos(int sock, int tos);
/* Ask for, and get, ifindex, by whatever method is supported. */
extern int setsockopt_ifindex (int, int, int);