Skip to content

Commit

Permalink
Initial import of code base into Github
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew P. Grosvenor committed Apr 13, 2018
0 parents commit 4e68922
Show file tree
Hide file tree
Showing 79 changed files with 10,227 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
bin/*

# Prerequisites
*.d

# Object files
*.o
*.ko
*.obj
*.elf

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

#Build outputs
bin/*

#Eclipse settings files
.settings/*
.project
.cproject
Binary file added Exact_Capture_Documentation.pdf
Binary file not shown.
341 changes: 341 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
PREFIX=/usr/local
CC=cc
INCLUDES=-Ilibs -Isrc -I.
LDFLAGS=libs/libchaste/libchaste.a
GLOBAL_CFLAGS=-g -std=c99 -D_GNU_SOURCE -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -fPIC -Wno-missing-field-initializers -Wno-missing-braces
RELEASE_CFLAGS=$(INCLUDES) $(GLOBAL_CFLAGS) -O3 -Wall -DNDEBUG -DNOIFASSERT
ASSERT_CFLAGS=$(INCLUDES) $(GLOBAL_CFLAGS) -O3 -Wall -DNDEBUG
DEBUG_CFLAGS=$(INCLUDES) $(GLOBAL_CFLAGS) -Werror -Wall -Wextra -pedantic
BIN=bin/exact-capture bin/exact-pcap-extract bin/exact-pcap-parse bin/exact-pcap-match

EXACTCAP_SRCS=$(wildcard src/*.c) $(wildcard src/**/*.c)
EXACTCAP_HDRS=$(wildcard src/*.h) $(wildcard src/**/*.h)
LIBCHASTE_HDRS=$(wildcard libs/chaste/*.h) $(wildcard libs/chaste/**/*.h)

all: CFLAGS = $(RELEASE_CFLAGS)
all: $(BIN)

assert: CFLAGS = $(ASSERT_CFLAGS)
assert: $(BIN)

debug: CFLAGS = $(DEBUG_CFLAGS)
debug: $(BIN)

bin/exact-capture: $(EXACTCAP_SRCS) $(EXACTCAP_HDRS) $(LIBCASHTE_HDRS)
mkdir -p bin
$(CC) $(CFLAGS) $(EXACTCAP_SRCS) $(LDFLAGS) -lm -lexanic -lpthread -lrt -o $@

bin/exact-pcap-parse: utils/exact-pcap-parse.c $(EXACTCAP_HDRS) $(LIBCAHSTE_HDRS)
mkdir -p bin
$(CC) $(CFLAGS) utils/exact-pcap-parse.c $(LDFLAGS) -o $@

bin/exact-pcap-match: utils/exact-pcap-match.c $(EXACTCAP_HDRS) $(LIBCAHSTE_HDRS)
mkdir -p bin
$(CC) $(CFLAGS) utils/exact-pcap-match.c $(LDFLAGS) -o $@

bin/exact-pcap-extract: utils/exact-pcap-extract.c $(EXACTCAP_HDRS) $(LIBCAHSTE_HDRS)
$(CC) $(CFLAGS) utils/exact-pcap-extract.c $(LDFLAGS) -o $@

install: all
install -d $(PREFIX)/bin
install -m 0755 -D $(BIN) $(PREFIX)/bin

uninstall:
rm -f $(foreach file,$(BIN),$(PREFIX)/bin/$(file))

clean:
rm -rf bin/*
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Exact Capture Ver 1.0RC
## Lossless Packet Capture for ExaNICs

Exact Capture is a high-rate, lossless packet capture solution for ExaNIC network adapters.
The system is fully open source and designed for performance as well as ease of configuration.
It can be used with any ExaNIC network card, and is optimised for use with ExaDisk high speed flash drives.
The system can be deployed on any suitably powerful server system.

For full documentation, please see Exact_Capture_Documentation.pdf


1 change: 1 addition & 0 deletions libs/chaste
Empty file.
24 changes: 24 additions & 0 deletions libs/libchaste/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Copyright (c) 2013, Matthew P. Grosvenor
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Matthew P. Grosvenor nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL MATTHEW P. GROSVENOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
66 changes: 66 additions & 0 deletions libs/libchaste/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
-------------------------------------------------------------------------------
Pure, virtuous, unadulterated programming bliss - hastily assembled C programs.
-------------------------------------------------------------------------------

The C-Haste Library (libchaste)
===============================

License:
--------
See LICENSE file included. TL;DR - BSD 3 Clause.


Main features:
--------------
Data structures: generic, type safe array, vector and linked list (hash map partially implemented)

Type safe command line options parser with super simple syntax, usage text etc.

Powerful logging with runtime and compile time log level tuning, coloured output.


Todo/In progress
-----------------
Architecture agnositc performance monitoring and measuring tools around RDTSC/PMC/PDU

Yet another string library to efficiently do useful string manipulations using nice macros to make


Currently builds on:
---------------------
- x86 Linux (Ubtuntu 12.10/13.04) (clang 3.2 and gcc 4.6-4.8)
- x86 Darwin (Mac OSX 10.10/10.11) (clang 7.0)

Targeted to build on:
- Linux/BSD/Darwin (OS X)
- 32bit/64bit (64bit optimized)
- ARM / x86


Obtaining the source:
----------------------

The C-Haste library is available at https://github.com/mgrosvenor/libchaste

- The master branch is a "stable" "release" candidate -- the bleeding edge - guaranteed compile and pass unit tests -- API may vary wildly.
- 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.


Building
---------

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.

It includes a set of unit tests and infrastructure for making them all running and passing valgrind tests.

- run build.sh to build a debug libcahste.a binary in the bin/ directory.
- run build_release.sh to build a release binary libcahste.tar.bz

Requirements
-------------
Cake build system - https://github.com/Zomojo/Cake
Clang 3.2+ / GCC 4.6+




10 changes: 10 additions & 0 deletions libs/libchaste/include/asm/asm.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// CamIO 2: asm.h
// Copyright (C) 2013: Matthew P. Grosvenor (matthew.grosvenor@cl.cam.ac.uk)
// Licensed under BSD 3 Clause, please see LICENSE for more details.

#ifndef ASM_H_
#define ASM_H_



#endif /* ASM_H_ */
26 changes: 26 additions & 0 deletions libs/libchaste/include/chaste.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* libm6.h
*
* Created on: Jun 29, 2013
* Author: mgrosvenor
*/

#ifndef LIBM6_H_
#define LIBM6_H_

#include "types/types.h"
#include "utils/util.h"
#include "string/string.h"

#include "options/options.h"
//#include "perf/perf.h"
#include "log/log.h"
//#include "perf/perf_mon.h"

#include "data_structs/array/array_std.h"
#include "data_structs/vector/vector_std.h"
#include "data_structs/linked_list/linked_list_std.h"
#include "data_structs/hash_map/hash_map.h"
#include "data_structs/function_hash_map/function_hash_map.h"

#endif /* LIBM6_H_ */
72 changes: 72 additions & 0 deletions libs/libchaste/include/data_structs/array/array.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// CamIO 2: array.h
// Copyright (C) 2013: Matthew P. Grosvenor (matthew.grosvenor@cl.cam.ac.uk)
// Licensed under BSD 3 Clause, please see LICENSE for more details.

#ifndef ARRAY_H_
#define ARRAY_H_

#include "../../types/types.h"

struct ch_array;
typedef struct ch_array ch_array_t;


struct ch_array{
ch_word size; //Return the max number number of elements in the array list

void* first; //Pointer to the fist valid entry list. Not valid if first == end
void* last; //Pointer to the last valid element in the array. Not valid if last == end
void* end; //Pointer to the one element beyond the end of the valid elements in array. Do not dereference!

// Members prefixed with "_" are nominally "private" Don't touch my privates!
int (*_cmp)(const void *, const void *); // Comparator function for find and sort operations
void* _array_backing; //Actual array storage
ch_word _array_backing_size; //Number of elements allocated in the given array
ch_word _element_size;

};


//Resize the array
void array_resize(ch_array_t* this, ch_word new_size);

//Check for equality
ch_word array_eq(ch_array_t* this, ch_array_t* that);

//Return the element at a given offset, with bounds checking
void* array_off(ch_array_t* this, ch_word idx);

//Step forwards by one entry
void* array_next(ch_array_t* this, void* ptr);

//Step backwards by one entry
void* array_prev(ch_array_t* this, void* ptr);

//Step forwards by amount
void* array_forward(ch_array_t* this, void* ptr, ch_word amount);

//Step backwards by amount
void* array_back(ch_array_t* this, void* ptr, ch_word amount);

//find the given value using the comparitor function
void* array_find(ch_array_t* this, void* begin, void* end, void* value);

//return the offset/index of the given item
int array_get_idx(ch_array_t* this, void* value);

//sort into order given the comparitor function
void array_sort(ch_array_t* this);

//sort into reverse order given the comparitor function
void array_sort_reverse(ch_array_t* this);

//Free the resources associated with this array, assumes that individual items have been freed
void array_delete(ch_array_t* this);

//Set at most count elements to the value in carray starting at offset in this array
void* array_from_carray(ch_array_t* this, void* carray, ch_word count);


ch_array_t* ch_array_new(ch_word size, ch_word element_size, int(*cmp)(const void* lhs, const void* rhs));

#endif //ARRAY_H_
Loading

0 comments on commit 4e68922

Please sign in to comment.