Permalink
Browse files

Add special C++ version of files (currently just a symlink to C version)

- Moved header files to include/ directory
- Makefile is slightly different (CXXFLAGS instead of CFLAGS)
- May change going forward
  • Loading branch information...
1 parent 15a52a8 commit bce8fea868f2d04e41f9e69ecc314e6dc7abbe99 @mjschultz mjschultz committed Jun 26, 2012
@@ -1,7 +1,7 @@
PROGRAM := pna_pcap
-
HASHMAP_DEPS := pna_hashmap.o murmur3.o monitor.o
+CFLAGS := -I../include
LDLIBS := -lpcap
all: ${PROGRAM}
@@ -29,7 +29,7 @@ struct hash_pair {
/* monitor global variables */
static struct pna_hashmap *map;
/* empty value for first insertion to hashmap */
-static struct monitor_entry value = { .bytes_in = 0, .bytes_out = 0 };
+static struct monitor_entry value = { 0, 0 };
uint64_t max_in, max_out;
@@ -5,6 +5,8 @@
#include "pna_hashmap.h"
+void MurmurHash3_x64_128(const void *, const int, const uint32_t, void *);
+
/* local prototypes */
static void hashmap_hashit(struct pna_hashmap *map, void *key, int func, uint32_t *b, uint32_t *fp);
#define pna_error printf
@@ -50,11 +52,11 @@ struct pna_hashmap *hashmap_create(uint32_t n_pairs, uint32_t key_size, uint32_t
map->kvx_mask = (8*map->n_buckets) - 1;
map->fp_mask = ~(map->kvx_mask);
- if (NULL == (map->buckets = malloc(BKTS_BYTES(map)))) {
+ if (NULL == (map->buckets = (bkt_t *)malloc(BKTS_BYTES(map)))) {
pna_error("Error could not allocate memory for buckets");
return NULL;
}
- if (NULL == (map->pairs = malloc(PAIRS_BYTES(map)))) {
+ if (NULL == (map->pairs = (char *)malloc(PAIRS_BYTES(map)))) {
pna_error("Error could not allocate memory for pairs");
return NULL;
}
@@ -13,11 +13,11 @@
#include <signal.h>
#include <pcap.h>
-#include <linux/in.h>
-#include <linux/if_ether.h>
-#include <linux/ip.h>
-#include <linux/udp.h>
-#include <linux/tcp.h>
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+#include <netinet/ip.h>
+#include <netinet/udp.h>
+#include <netinet/tcp.h>
#include "pna.h"
@@ -0,0 +1,15 @@
+PROGRAM := pna_pcap
+HASHMAP_DEPS := pna_hashmap.o murmur3.o monitor.o
+
+CXXFLAGS := -I../include
+LDLIBS := -lpcap
+
+all: ${PROGRAM}
+
+debug: CFLAGS += -ggdb
+debug: ${PROGRAM}
+
+${PROGRAM}: ${HASHMAP_DEPS}
+
+clean:
+ rm -f ${PROGRAM} *.o
File renamed without changes.

0 comments on commit bce8fea

Please sign in to comment.