summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flowtop.c3
-rw-r--r--lookup.c10
-rw-r--r--lookup.h8
-rw-r--r--proto_arp.c2
-rw-r--r--proto_ethernet.c2
-rw-r--r--proto_tcp.c4
-rw-r--r--proto_udp.c4
7 files changed, 17 insertions, 16 deletions
diff --git a/flowtop.c b/flowtop.c
index cf0e478..cab708e 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -914,7 +914,8 @@ static void presenter_print_flow_entry_time(const struct flow_entry *n)
static void draw_flow_entry(WINDOW *screen, const struct flow_entry *n,
unsigned int *line)
{
- char tmp[128], *pname = NULL;
+ char tmp[128];
+ const char *pname = NULL;
uint16_t port;
mvwprintw(screen, *line, 2, "");
diff --git a/lookup.c b/lookup.c
index 516ca7c..eb5a45f 100644
--- a/lookup.c
+++ b/lookup.c
@@ -127,7 +127,7 @@ void lookup_cleanup(enum lookup_type which)
lookup_initialized[which] = false;
}
-static inline char *__lookup_inline(unsigned int id, struct hash_table *tbl)
+static inline const char *__lookup_inline(unsigned int id, struct hash_table *tbl)
{
struct lookup_entry *entry = lookup_hash(id, tbl);
@@ -137,22 +137,22 @@ static inline char *__lookup_inline(unsigned int id, struct hash_table *tbl)
return (entry && id == entry->id ? entry->str : NULL);
}
-char *lookup_ether_type(unsigned int id)
+const char *lookup_ether_type(unsigned int id)
{
return __lookup_inline(id, &lookup_tables[LT_ETHERTYPES]);
}
-char *lookup_port_udp(unsigned int id)
+const char *lookup_port_udp(unsigned int id)
{
return __lookup_inline(id, &lookup_tables[LT_PORTS_UDP]);
}
-char *lookup_port_tcp(unsigned int id)
+const char *lookup_port_tcp(unsigned int id)
{
return __lookup_inline(id, &lookup_tables[LT_PORTS_TCP]);
}
-char *lookup_vendor(unsigned int id)
+const char *lookup_vendor(unsigned int id)
{
return __lookup_inline(id, &lookup_tables[LT_OUI]);
}
diff --git a/lookup.h b/lookup.h
index 57c43d6..38161b6 100644
--- a/lookup.h
+++ b/lookup.h
@@ -19,10 +19,10 @@ enum lookup_type {
extern void lookup_init(enum lookup_type which);
extern void lookup_cleanup(enum lookup_type which);
-extern char *lookup_port_udp(unsigned int id);
-extern char *lookup_port_tcp(unsigned int id);
-extern char *lookup_ether_type(unsigned int id);
-extern char *lookup_vendor(unsigned int id);
+extern const char *lookup_port_udp(unsigned int id);
+extern const char *lookup_port_tcp(unsigned int id);
+extern const char *lookup_ether_type(unsigned int id);
+extern const char *lookup_vendor(unsigned int id);
static inline const char *lookup_vendor_str(unsigned int id)
{
diff --git a/proto_arp.c b/proto_arp.c
index ba52a0b..9121223 100644
--- a/proto_arp.c
+++ b/proto_arp.c
@@ -45,7 +45,7 @@ struct arphdr {
static void arp(struct pkt_buff *pkt)
{
char *hrd;
- char *pro;
+ const char *pro;
char *opcode;
struct arphdr *arp = (struct arphdr *) pkt_pull(pkt, sizeof(*arp));
diff --git a/proto_ethernet.c b/proto_ethernet.c
index 47730fc..9bb0042 100644
--- a/proto_ethernet.c
+++ b/proto_ethernet.c
@@ -40,7 +40,7 @@ static const char *ether_lookup_addr(const uint8_t *mac)
static void ethernet(struct pkt_buff *pkt)
{
- char *type;
+ const char *type;
uint8_t *src_mac, *dst_mac;
struct ethhdr *eth = (struct ethhdr *) pkt_pull(pkt, sizeof(*eth));
diff --git a/proto_tcp.c b/proto_tcp.c
index 6f2ab14..4b37e07 100644
--- a/proto_tcp.c
+++ b/proto_tcp.c
@@ -64,7 +64,7 @@ static void tcp(struct pkt_buff *pkt)
{
struct tcphdr *tcp = (struct tcphdr *) pkt_pull(pkt, sizeof(*tcp));
uint16_t src, dest;
- char *src_name, *dest_name;
+ const char *src_name, *dest_name;
bool v = false;
if (tcp == NULL)
@@ -110,7 +110,7 @@ static void tcp_less(struct pkt_buff *pkt)
{
struct tcphdr *tcp = (struct tcphdr *) pkt_pull(pkt, sizeof(*tcp));
uint16_t src, dest;
- char *src_name, *dest_name;
+ const char *src_name, *dest_name;
if (tcp == NULL)
return;
diff --git a/proto_udp.c b/proto_udp.c
index b55dd2e..f607b14 100644
--- a/proto_udp.c
+++ b/proto_udp.c
@@ -25,7 +25,7 @@ static void udp(struct pkt_buff *pkt)
struct udphdr *udp = (struct udphdr *) pkt_pull(pkt, sizeof(*udp));
ssize_t len;
uint16_t src, dest;
- char *src_name, *dest_name;
+ const char *src_name, *dest_name;
if (udp == NULL)
return;
@@ -61,7 +61,7 @@ static void udp_less(struct pkt_buff *pkt)
{
struct udphdr *udp = (struct udphdr *) pkt_pull(pkt, sizeof(*udp));
uint16_t src, dest;
- char *src_name, *dest_name;
+ const char *src_name, *dest_name;
if (udp == NULL)
return;