Skip to content

Commit 4e68922

Browse files
author
Matthew P. Grosvenor
committed
Initial import of code base into Github
0 parents  commit 4e68922

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+10227
-0
lines changed

.gitignore

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
bin/*
2+
3+
# Prerequisites
4+
*.d
5+
6+
# Object files
7+
*.o
8+
*.ko
9+
*.obj
10+
*.elf
11+
12+
# Linker output
13+
*.ilk
14+
*.map
15+
*.exp
16+
17+
# Precompiled Headers
18+
*.gch
19+
*.pch
20+
21+
# Libraries
22+
*.lib
23+
*.la
24+
*.lo
25+
26+
# Shared objects (inc. Windows DLLs)
27+
*.dll
28+
*.so
29+
*.so.*
30+
*.dylib
31+
32+
# Executables
33+
*.exe
34+
*.out
35+
*.app
36+
*.i*86
37+
*.x86_64
38+
*.hex
39+
40+
# Debug files
41+
*.dSYM/
42+
*.su
43+
*.idb
44+
*.pdb
45+
46+
# Kernel Module Compile Results
47+
*.mod*
48+
*.cmd
49+
.tmp_versions/
50+
modules.order
51+
Module.symvers
52+
Mkfile.old
53+
dkms.conf
54+
55+
#Build outputs
56+
bin/*
57+
58+
#Eclipse settings files
59+
.settings/*
60+
.project
61+
.cproject

Exact_Capture_Documentation.pdf

217 KB
Binary file not shown.

LICENSE

+341
Large diffs are not rendered by default.

Makefile

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
PREFIX=/usr/local
2+
CC=cc
3+
INCLUDES=-Ilibs -Isrc -I.
4+
LDFLAGS=libs/libchaste/libchaste.a
5+
GLOBAL_CFLAGS=-g -std=c99 -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -fPIC -Wno-missing-field-initializers -Wno-missing-braces
6+
RELEASE_CFLAGS=$(INCLUDES) $(GLOBAL_CFLAGS) -O3 -Wall -DNDEBUG -DNOIFASSERT
7+
ASSERT_CFLAGS=$(INCLUDES) $(GLOBAL_CFLAGS) -O3 -Wall -DNDEBUG
8+
DEBUG_CFLAGS=$(INCLUDES) $(GLOBAL_CFLAGS) -Werror -Wall -Wextra -pedantic
9+
BIN=bin/exact-capture bin/exact-pcap-extract bin/exact-pcap-parse bin/exact-pcap-match
10+
11+
EXACTCAP_SRCS=$(wildcard src/*.c) $(wildcard src/**/*.c)
12+
EXACTCAP_HDRS=$(wildcard src/*.h) $(wildcard src/**/*.h)
13+
LIBCHASTE_HDRS=$(wildcard libs/chaste/*.h) $(wildcard libs/chaste/**/*.h)
14+
15+
all: CFLAGS = $(RELEASE_CFLAGS)
16+
all: $(BIN)
17+
18+
assert: CFLAGS = $(ASSERT_CFLAGS)
19+
assert: $(BIN)
20+
21+
debug: CFLAGS = $(DEBUG_CFLAGS)
22+
debug: $(BIN)
23+
24+
bin/exact-capture: $(EXACTCAP_SRCS) $(EXACTCAP_HDRS) $(LIBCASHTE_HDRS)
25+
mkdir -p bin
26+
$(CC) $(CFLAGS) $(EXACTCAP_SRCS) $(LDFLAGS) -lm -lexanic -lpthread -lrt -o $@
27+
28+
bin/exact-pcap-parse: utils/exact-pcap-parse.c $(EXACTCAP_HDRS) $(LIBCAHSTE_HDRS)
29+
mkdir -p bin
30+
$(CC) $(CFLAGS) utils/exact-pcap-parse.c $(LDFLAGS) -o $@
31+
32+
bin/exact-pcap-match: utils/exact-pcap-match.c $(EXACTCAP_HDRS) $(LIBCAHSTE_HDRS)
33+
mkdir -p bin
34+
$(CC) $(CFLAGS) utils/exact-pcap-match.c $(LDFLAGS) -o $@
35+
36+
bin/exact-pcap-extract: utils/exact-pcap-extract.c $(EXACTCAP_HDRS) $(LIBCAHSTE_HDRS)
37+
$(CC) $(CFLAGS) utils/exact-pcap-extract.c $(LDFLAGS) -o $@
38+
39+
install: all
40+
install -d $(PREFIX)/bin
41+
install -m 0755 -D $(BIN) $(PREFIX)/bin
42+
43+
uninstall:
44+
rm -f $(foreach file,$(BIN),$(PREFIX)/bin/$(file))
45+
46+
clean:
47+
rm -rf bin/*

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Exact Capture Ver 1.0RC
2+
## Lossless Packet Capture for ExaNICs
3+
4+
Exact Capture is a high-rate, lossless packet capture solution for ExaNIC network adapters.
5+
The system is fully open source and designed for performance as well as ease of configuration.
6+
It can be used with any ExaNIC network card, and is optimised for use with ExaDisk high speed flash drives.
7+
The system can be deployed on any suitably powerful server system.
8+
9+
For full documentation, please see Exact_Capture_Documentation.pdf
10+
11+

libs/chaste

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
libchaste/include/

libs/libchaste/60740670f7763b10d1b022c6d1709434b39c2a5d

Whitespace-only changes.

libs/libchaste/LICENSE

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Copyright (c) 2013, Matthew P. Grosvenor
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above copyright
9+
notice, this list of conditions and the following disclaimer in the
10+
documentation and/or other materials provided with the distribution.
11+
* Neither the name of the Matthew P. Grosvenor nor the
12+
names of its contributors may be used to endorse or promote products
13+
derived from this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
DISCLAIMED. IN NO EVENT SHALL MATTHEW P. GROSVENOR BE LIABLE FOR ANY
19+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

libs/libchaste/README

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
-------------------------------------------------------------------------------
2+
Pure, virtuous, unadulterated programming bliss - hastily assembled C programs.
3+
-------------------------------------------------------------------------------
4+
5+
The C-Haste Library (libchaste)
6+
===============================
7+
8+
License:
9+
--------
10+
See LICENSE file included. TL;DR - BSD 3 Clause.
11+
12+
13+
Main features:
14+
--------------
15+
Data structures: generic, type safe array, vector and linked list (hash map partially implemented)
16+
17+
Type safe command line options parser with super simple syntax, usage text etc.
18+
19+
Powerful logging with runtime and compile time log level tuning, coloured output.
20+
21+
22+
Todo/In progress
23+
-----------------
24+
Architecture agnositc performance monitoring and measuring tools around RDTSC/PMC/PDU
25+
26+
Yet another string library to efficiently do useful string manipulations using nice macros to make
27+
28+
29+
Currently builds on:
30+
---------------------
31+
- x86 Linux (Ubtuntu 12.10/13.04) (clang 3.2 and gcc 4.6-4.8)
32+
- x86 Darwin (Mac OSX 10.10/10.11) (clang 7.0)
33+
34+
Targeted to build on:
35+
- Linux/BSD/Darwin (OS X)
36+
- 32bit/64bit (64bit optimized)
37+
- ARM / x86
38+
39+
40+
Obtaining the source:
41+
----------------------
42+
43+
The C-Haste library is available at https://github.com/mgrosvenor/libchaste
44+
45+
- The master branch is a "stable" "release" candidate -- the bleeding edge - guaranteed compile and pass unit tests -- API may vary wildly.
46+
- Release branches are stable, tagged with the release ID. Incremental fixes to a release will be tags added to the release branch. Bug fixes only. No new features. No new APIs.
47+
48+
49+
Building
50+
---------
51+
52+
Libchaste builds on both gcc 4.6 and clang 3.2 against the c11 standard with pedantic warnings and errors using the Posix 2008 system API.
53+
54+
It includes a set of unit tests and infrastructure for making them all running and passing valgrind tests.
55+
56+
- run build.sh to build a debug libcahste.a binary in the bin/ directory.
57+
- run build_release.sh to build a release binary libcahste.tar.bz
58+
59+
Requirements
60+
-------------
61+
Cake build system - https://github.com/Zomojo/Cake
62+
Clang 3.2+ / GCC 4.6+
63+
64+
65+
66+

libs/libchaste/include/asm/asm.h

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// CamIO 2: asm.h
2+
// Copyright (C) 2013: Matthew P. Grosvenor (matthew.grosvenor@cl.cam.ac.uk)
3+
// Licensed under BSD 3 Clause, please see LICENSE for more details.
4+
5+
#ifndef ASM_H_
6+
#define ASM_H_
7+
8+
9+
10+
#endif /* ASM_H_ */

libs/libchaste/include/chaste.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* libm6.h
3+
*
4+
* Created on: Jun 29, 2013
5+
* Author: mgrosvenor
6+
*/
7+
8+
#ifndef LIBM6_H_
9+
#define LIBM6_H_
10+
11+
#include "types/types.h"
12+
#include "utils/util.h"
13+
#include "string/string.h"
14+
15+
#include "options/options.h"
16+
//#include "perf/perf.h"
17+
#include "log/log.h"
18+
//#include "perf/perf_mon.h"
19+
20+
#include "data_structs/array/array_std.h"
21+
#include "data_structs/vector/vector_std.h"
22+
#include "data_structs/linked_list/linked_list_std.h"
23+
#include "data_structs/hash_map/hash_map.h"
24+
#include "data_structs/function_hash_map/function_hash_map.h"
25+
26+
#endif /* LIBM6_H_ */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// CamIO 2: array.h
2+
// Copyright (C) 2013: Matthew P. Grosvenor (matthew.grosvenor@cl.cam.ac.uk)
3+
// Licensed under BSD 3 Clause, please see LICENSE for more details.
4+
5+
#ifndef ARRAY_H_
6+
#define ARRAY_H_
7+
8+
#include "../../types/types.h"
9+
10+
struct ch_array;
11+
typedef struct ch_array ch_array_t;
12+
13+
14+
struct ch_array{
15+
ch_word size; //Return the max number number of elements in the array list
16+
17+
void* first; //Pointer to the fist valid entry list. Not valid if first == end
18+
void* last; //Pointer to the last valid element in the array. Not valid if last == end
19+
void* end; //Pointer to the one element beyond the end of the valid elements in array. Do not dereference!
20+
21+
// Members prefixed with "_" are nominally "private" Don't touch my privates!
22+
int (*_cmp)(const void *, const void *); // Comparator function for find and sort operations
23+
void* _array_backing; //Actual array storage
24+
ch_word _array_backing_size; //Number of elements allocated in the given array
25+
ch_word _element_size;
26+
27+
};
28+
29+
30+
//Resize the array
31+
void array_resize(ch_array_t* this, ch_word new_size);
32+
33+
//Check for equality
34+
ch_word array_eq(ch_array_t* this, ch_array_t* that);
35+
36+
//Return the element at a given offset, with bounds checking
37+
void* array_off(ch_array_t* this, ch_word idx);
38+
39+
//Step forwards by one entry
40+
void* array_next(ch_array_t* this, void* ptr);
41+
42+
//Step backwards by one entry
43+
void* array_prev(ch_array_t* this, void* ptr);
44+
45+
//Step forwards by amount
46+
void* array_forward(ch_array_t* this, void* ptr, ch_word amount);
47+
48+
//Step backwards by amount
49+
void* array_back(ch_array_t* this, void* ptr, ch_word amount);
50+
51+
//find the given value using the comparitor function
52+
void* array_find(ch_array_t* this, void* begin, void* end, void* value);
53+
54+
//return the offset/index of the given item
55+
int array_get_idx(ch_array_t* this, void* value);
56+
57+
//sort into order given the comparitor function
58+
void array_sort(ch_array_t* this);
59+
60+
//sort into reverse order given the comparitor function
61+
void array_sort_reverse(ch_array_t* this);
62+
63+
//Free the resources associated with this array, assumes that individual items have been freed
64+
void array_delete(ch_array_t* this);
65+
66+
//Set at most count elements to the value in carray starting at offset in this array
67+
void* array_from_carray(ch_array_t* this, void* carray, ch_word count);
68+
69+
70+
ch_array_t* ch_array_new(ch_word size, ch_word element_size, int(*cmp)(const void* lhs, const void* rhs));
71+
72+
#endif //ARRAY_H_

0 commit comments

Comments
 (0)