summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2016-02-01 16:32:12 +0100
committerTobias Klauser <tklauser@distanz.ch>2016-02-01 16:32:12 +0100
commit23492a017a2df510d054157ba314d1e6b1a43c3c (patch)
tree7f46ec09f1331a42d06142657dbac06740689463
parentf26175af848bfb3faaedd98b402949e8bd7ab8bc (diff)
trafgen: proto: Mark fields parameter to proto_header_fields_add as const
It's not changed inside the function, so mark it as const. Also adjust the header guards. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--trafgen_proto.c4
-rw-r--r--trafgen_proto.h9
2 files changed, 7 insertions, 6 deletions
diff --git a/trafgen_proto.c b/trafgen_proto.c
index 5fcb5cc..3cbf34e 100644
--- a/trafgen_proto.c
+++ b/trafgen_proto.c
@@ -86,8 +86,8 @@ static void proto_fields_realloc(struct proto_hdr *hdr, size_t count)
hdr->fields_count = count;
}
-void proto_header_fields_add(struct proto_hdr *hdr, struct proto_field *fields,
- size_t count)
+void proto_header_fields_add(struct proto_hdr *hdr,
+ const struct proto_field *fields, size_t count)
{
struct packet *pkt = current_packet();
struct proto_field *f;
diff --git a/trafgen_proto.h b/trafgen_proto.h
index 0267cf6..02a8cc5 100644
--- a/trafgen_proto.h
+++ b/trafgen_proto.h
@@ -1,5 +1,5 @@
-#ifndef TRAFGEN_PROTO_I_H
-#define TRAFGEN_PROTO_I_H
+#ifndef TRAFGEN_PROTO_H
+#define TRAFGEN_PROTO_H
#include <stddef.h>
#include <stdint.h>
@@ -65,7 +65,8 @@ extern struct proto_hdr *proto_lower_header(struct proto_hdr *hdr);
extern uint8_t *proto_header_ptr(struct proto_hdr *hdr);
extern void proto_header_fields_add(struct proto_hdr *hdr,
- struct proto_field *fields, size_t count);
+ const struct proto_field *fields,
+ size_t count);
extern bool proto_field_is_set(struct proto_hdr *hdr, uint32_t fid);
extern void proto_field_set_bytes(struct proto_hdr *hdr, uint32_t fid,
@@ -100,4 +101,4 @@ extern void proto_field_set_default_dev_mac(struct proto_hdr *hdr, uint32_t fid)
extern void proto_field_set_dev_ipv4(struct proto_hdr *hdr, uint32_t fid);
extern void proto_field_set_default_dev_ipv4(struct proto_hdr *hdr, uint32_t fid);
-#endif /* TRAFGEN_PROTO_I_H */
+#endif /* TRAFGEN_PROTO_H */