isisd: annotate some function arguments with const
Signed-off-by: Christian Franke <chris@opensourcerouting.org>
Acked-by: Donald Sharp <sharpd@cumulusnetworks.com>
diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c
index b8d28b3..c7ab83b 100644
--- a/isisd/isis_adjacency.c
+++ b/isisd/isis_adjacency.c
@@ -52,7 +52,7 @@
extern struct isis *isis;
static struct isis_adjacency *
-adj_alloc (u_char * id)
+adj_alloc (const u_char *id)
{
struct isis_adjacency *adj;
@@ -63,7 +63,7 @@
}
struct isis_adjacency *
-isis_new_adj (u_char * id, u_char * snpa, int level,
+isis_new_adj (const u_char * id, const u_char * snpa, int level,
struct isis_circuit *circuit)
{
struct isis_adjacency *adj;
@@ -104,7 +104,7 @@
}
struct isis_adjacency *
-isis_adj_lookup (u_char * sysid, struct list *adjdb)
+isis_adj_lookup (const u_char * sysid, struct list *adjdb)
{
struct isis_adjacency *adj;
struct listnode *node;
@@ -117,7 +117,7 @@
}
struct isis_adjacency *
-isis_adj_lookup_snpa (u_char * ssnpa, struct list *adjdb)
+isis_adj_lookup_snpa (const u_char * ssnpa, struct list *adjdb)
{
struct listnode *node;
struct isis_adjacency *adj;
diff --git a/isisd/isis_adjacency.h b/isisd/isis_adjacency.h
index caa3107..99d0c49 100644
--- a/isisd/isis_adjacency.h
+++ b/isisd/isis_adjacency.h
@@ -101,10 +101,10 @@
struct isis_circuit *circuit; /* back pointer */
};
-struct isis_adjacency *isis_adj_lookup (u_char * sysid, struct list *adjdb);
-struct isis_adjacency *isis_adj_lookup_snpa (u_char * ssnpa,
+struct isis_adjacency *isis_adj_lookup (const u_char * sysid, struct list *adjdb);
+struct isis_adjacency *isis_adj_lookup_snpa (const u_char * ssnpa,
struct list *adjdb);
-struct isis_adjacency *isis_new_adj (u_char * id, u_char * snpa, int level,
+struct isis_adjacency *isis_new_adj (const u_char * id, const u_char * snpa, int level,
struct isis_circuit *circuit);
void isis_delete_adj (void *adj);
void isis_adj_state_change (struct isis_adjacency *adj,
diff --git a/isisd/isis_dynhn.c b/isisd/isis_dynhn.c
index ffb0d50..412f098 100644
--- a/isisd/isis_dynhn.c
+++ b/isisd/isis_dynhn.c
@@ -78,7 +78,7 @@
}
struct isis_dynhn *
-dynhn_find_by_id (u_char * id)
+dynhn_find_by_id (const u_char * id)
{
struct listnode *node = NULL;
struct isis_dynhn *dyn = NULL;
@@ -104,7 +104,7 @@
}
void
-isis_dynhn_insert (u_char * id, struct hostname *hostname, int level)
+isis_dynhn_insert (const u_char * id, struct hostname *hostname, int level)
{
struct isis_dynhn *dyn;
@@ -135,7 +135,7 @@
}
void
-isis_dynhn_remove (u_char * id)
+isis_dynhn_remove (const u_char * id)
{
struct isis_dynhn *dyn;
diff --git a/isisd/isis_dynhn.h b/isisd/isis_dynhn.h
index 379c454..f06a067 100644
--- a/isisd/isis_dynhn.h
+++ b/isisd/isis_dynhn.h
@@ -32,9 +32,9 @@
};
void dyn_cache_init (void);
-void isis_dynhn_insert (u_char * id, struct hostname *hostname, int level);
-void isis_dynhn_remove (u_char * id);
-struct isis_dynhn *dynhn_find_by_id (u_char * id);
+void isis_dynhn_insert (const u_char * id, struct hostname *hostname, int level);
+void isis_dynhn_remove (const u_char * id);
+struct isis_dynhn *dynhn_find_by_id (const u_char * id);
struct isis_dynhn *dynhn_find_by_name (const char *hostname);
void dynhn_print_all (struct vty *vty);
diff --git a/isisd/isis_misc.c b/isisd/isis_misc.c
index 2dfd7cc..f19b441 100644
--- a/isisd/isis_misc.c
+++ b/isisd/isis_misc.c
@@ -63,7 +63,7 @@
* This converts the isonet to its printable format
*/
const char *
-isonet_print (u_char * from, int len)
+isonet_print (const u_char * from, int len)
{
int i = 0;
char *pos = isonet;
@@ -370,7 +370,7 @@
* Print functions - we print to static vars
*/
const char *
-snpa_print (u_char * from)
+snpa_print (const u_char * from)
{
int i = 0;
u_char *pos = (u_char *)snpa;
@@ -402,7 +402,7 @@
}
const char *
-sysid_print (u_char * from)
+sysid_print (const u_char * from)
{
int i = 0;
char *pos = sysid;
@@ -434,7 +434,7 @@
}
const char *
-rawlspid_print (u_char * from)
+rawlspid_print (const u_char * from)
{
char *pos = lspid;
if (!from)
@@ -553,7 +553,7 @@
* If no dynamic hostname found then returns formatted system ID.
*/
const char *
-print_sys_hostname (u_char *sysid)
+print_sys_hostname (const u_char *sysid)
{
struct isis_dynhn *dyn;
diff --git a/isisd/isis_misc.h b/isisd/isis_misc.h
index 0cd65a6..37eaea1 100644
--- a/isisd/isis_misc.h
+++ b/isisd/isis_misc.h
@@ -41,14 +41,14 @@
/*
* Printing functions
*/
-const char *isonet_print (u_char *, int len);
-const char *sysid_print (u_char *);
-const char *snpa_print (u_char *);
-const char *rawlspid_print (u_char *);
+const char *isonet_print (const u_char *, int len);
+const char *sysid_print (const u_char *);
+const char *snpa_print (const u_char *);
+const char *rawlspid_print (const u_char *);
const char *time2string (u_int32_t);
/* typedef struct nlpids nlpids; */
char *nlpid2string (struct nlpids *);
-const char *print_sys_hostname (u_char *sysid);
+const char *print_sys_hostname (const u_char *sysid);
void zlog_dump_data (void *data, int len);
/*
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index c50b53f..7408555 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -912,7 +912,7 @@
* Process IS-IS LAN Level 1/2 Hello PDU
*/
static int
-process_lan_hello (int level, struct isis_circuit *circuit, u_char * ssnpa)
+process_lan_hello (int level, struct isis_circuit *circuit, const u_char *ssnpa)
{
int retval = ISIS_OK;
struct isis_lan_hello_hdr hdr;
@@ -1300,7 +1300,7 @@
* Section 7.3.15.1 - Action on receipt of a link state PDU
*/
static int
-process_lsp (int level, struct isis_circuit *circuit, u_char * ssnpa)
+process_lsp (int level, struct isis_circuit *circuit, const u_char *ssnpa)
{
struct isis_link_state_hdr *hdr;
struct isis_adjacency *adj = NULL;
@@ -1649,7 +1649,7 @@
static int
process_snp (int snp_type, int level, struct isis_circuit *circuit,
- u_char * ssnpa)
+ const u_char *ssnpa)
{
int retval = ISIS_OK;
int cmp, own_lsp;
@@ -1945,7 +1945,7 @@
}
static int
-process_csnp (int level, struct isis_circuit *circuit, u_char * ssnpa)
+process_csnp (int level, struct isis_circuit *circuit, const u_char *ssnpa)
{
if (isis->debugs & DEBUG_SNP_PACKETS)
{
@@ -1969,7 +1969,7 @@
}
static int
-process_psnp (int level, struct isis_circuit *circuit, u_char * ssnpa)
+process_psnp (int level, struct isis_circuit *circuit, const u_char *ssnpa)
{
if (isis->debugs & DEBUG_SNP_PACKETS)
{