Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
lparam committed Oct 1, 2015
2 parents 89aac04 + 98df136 commit 458fd0a
Show file tree
Hide file tree
Showing 113 changed files with 16,188 additions and 86 deletions.
2 changes: 2 additions & 0 deletions .ycm_extra_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
'-I3rd/c-ares',
'-I3rd/libuv/include',
'-I3rd/libsodium/src/libsodium/include',
'-I3rd/libcork/include',
'-I3rd/libipset/include',
]

compilation_database_folder = ''
Expand Down
2 changes: 1 addition & 1 deletion 3rd/c-ares
18 changes: 18 additions & 0 deletions 3rd/libcork/include/cli.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* -*- coding: utf-8 -*-
* ----------------------------------------------------------------------
* Copyright © 2012, RedJack, LLC.
* All rights reserved.
*
* Please see the COPYING file in this distribution for license
* details.
* ----------------------------------------------------------------------
*/

#ifndef LIBCORK_CLI_H
#define LIBCORK_CLI_H

/*** include all of the parts ***/

#include <libcork/cli/commands.h>

#endif /* LIBCORK_CLI_H */
61 changes: 61 additions & 0 deletions 3rd/libcork/include/cli/commands.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/* -*- coding: utf-8 -*-
* ----------------------------------------------------------------------
* Copyright © 2012, RedJack, LLC.
* All rights reserved.
*
* Please see the COPYING file in this distribution for license
* details.
* ----------------------------------------------------------------------
*/

#ifndef LIBCORK_COMMANDS_H
#define LIBCORK_COMMANDS_H

#include <libcork/core/api.h>


typedef void
(*cork_leaf_command_run)(int argc, char **argv);

typedef int
(*cork_option_parser)(int argc, char **argv);

enum cork_command_type {
CORK_COMMAND_SET,
CORK_LEAF_COMMAND
};

struct cork_command {
enum cork_command_type type;
const char *name;
const char *short_desc;
const char *usage_suffix;
const char *full_help;

int
(*parse_options)(int argc, char **argv);

struct cork_command **set;
cork_leaf_command_run run;
};

#define cork_command_set(name, sd, parse_options, set) \
{ \
CORK_COMMAND_SET, name, sd, NULL, NULL, \
parse_options, set, NULL \
}

#define cork_leaf_command(name, sd, us, fh, parse_options, run) \
{ \
CORK_LEAF_COMMAND, name, sd, us, fh, \
parse_options, NULL, run \
}

CORK_API void
cork_command_show_help(struct cork_command *command, const char *message);

CORK_API int
cork_command_main(struct cork_command *root, int argc, char **argv);


#endif /* LIBCORK_COMMANDS_H */
18 changes: 18 additions & 0 deletions 3rd/libcork/include/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* -*- coding: utf-8 -*-
* ----------------------------------------------------------------------
* Copyright © 2011, RedJack, LLC.
* All rights reserved.
*
* Please see the COPYING file in this distribution for license
* details.
* ----------------------------------------------------------------------
*/

#ifndef LIBCORK_CONFIG_H
#define LIBCORK_CONFIG_H

/*** include all of the parts ***/

#include <libcork/config/config.h>

#endif /* LIBCORK_CONFIG_H */
45 changes: 45 additions & 0 deletions 3rd/libcork/include/config/arch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/* -*- coding: utf-8 -*-
* ----------------------------------------------------------------------
* Copyright © 2012-2013, RedJack, LLC.
* All rights reserved.
*
* Please see the COPYING file in this distribution for license
* details.
* ----------------------------------------------------------------------
*/

#ifndef LIBCORK_CONFIG_ARCH_H
#define LIBCORK_CONFIG_ARCH_H


/*-----------------------------------------------------------------------
* Platform
*/

#if defined(__i386__) || defined(_M_IX86)
#define CORK_CONFIG_ARCH_X86 1
#else
#define CORK_CONFIG_ARCH_X86 0
#endif

#if defined(__x86_64__) || defined(_M_X64)
#define CORK_CONFIG_ARCH_X64 1
#else
#define CORK_CONFIG_ARCH_X64 0
#endif

#if defined(__powerpc__) || defined(__ppc__)
/* GCC-ish compiler */
#define CORK_CONFIG_ARCH_PPC 1
#elif defined(_M_PPC)
/* VS-ish compiler */
#define CORK_CONFIG_ARCH_PPC 1
#elif defined(_ARCH_PPC)
/* Something called XL C/C++? */
#define CORK_CONFIG_ARCH_PPC 1
#else
#define CORK_CONFIG_ARCH_PPC 0
#endif


#endif /* LIBCORK_CONFIG_ARCH_H */
34 changes: 34 additions & 0 deletions 3rd/libcork/include/config/bsd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* -*- coding: utf-8 -*-
* ----------------------------------------------------------------------
* Copyright © 2013, RedJack, LLC.
* All rights reserved.
*
* Please see the COPYING file in this distribution for license
* details.
* ----------------------------------------------------------------------
*/

#ifndef LIBCORK_CONFIG_BSD_H
#define LIBCORK_CONFIG_BSD_H

/*-----------------------------------------------------------------------
* Endianness
*/

#include <sys/endian.h>

#if BYTE_ORDER == BIG_ENDIAN
#define CORK_CONFIG_IS_BIG_ENDIAN 1
#define CORK_CONFIG_IS_LITTLE_ENDIAN 0
#elif BYTE_ORDER == LITTLE_ENDIAN
#define CORK_CONFIG_IS_BIG_ENDIAN 0
#define CORK_CONFIG_IS_LITTLE_ENDIAN 1
#else
#error "Cannot determine system endianness"
#endif

#define CORK_HAVE_REALLOCF 1
#define CORK_HAVE_PTHREADS 1


#endif /* LIBCORK_CONFIG_BSD_H */
74 changes: 74 additions & 0 deletions 3rd/libcork/include/config/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/* -*- coding: utf-8 -*-
* ----------------------------------------------------------------------
* Copyright © 2011-2015, RedJack, LLC.
* All rights reserved.
*
* Please see the COPYING file in this distribution for license details.
* ----------------------------------------------------------------------
*/

#ifndef LIBCORK_CONFIG_CONFIG_H
#define LIBCORK_CONFIG_CONFIG_H


/* If you want to skip autodetection, define this to 1, and provide a
* libcork/config/custom.h header file. */

#if !defined(CORK_CONFIG_SKIP_AUTODETECT)
#define CORK_CONFIG_SKIP_AUTODETECT 0
#endif


#if CORK_CONFIG_SKIP_AUTODETECT
/* The user has promised that they'll define everything themselves. */
#include <libcork/config/custom.h>

#else
/* Otherwise autodetect! */


/**** VERSION ****/

#include <libcork/config/version.h>


/**** ARCHITECTURES ****/

#include <libcork/config/arch.h>


/**** PLATFORMS ****/
#if (defined(__unix__) || defined(unix)) && !defined(USG)
/* We need this to test for BSD, but it's a good idea to have for
* any brand of Unix.*/
#include <sys/param.h>
#endif

#if defined(__linux)
/* Do some Linux-specific autodetection. */
#include <libcork/config/linux.h>

#elif defined(__APPLE__) && defined(__MACH__)
/* Do some Mac OS X-specific autodetection. */
#include <libcork/config/macosx.h>

#elif defined(BSD) && (BSD >= 199103)
/* Do some BSD (4.3 code base or newer)specific autodetection. */
#include <libcork/config/bsd.h>

#endif /* platforms */


/**** COMPILERS ****/

#if defined(__GNUC__)
/* Do some GCC-specific autodetection. */
#include <libcork/config/gcc.h>

#endif /* compilers */


#endif /* autodetect or not */


#endif /* LIBCORK_CONFIG_CONFIG_H */
91 changes: 91 additions & 0 deletions 3rd/libcork/include/config/gcc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/* -*- coding: utf-8 -*-
* ----------------------------------------------------------------------
* Copyright © 2011-2012, RedJack, LLC.
* All rights reserved.
*
* Please see the COPYING file in this distribution for license
* details.
* ----------------------------------------------------------------------
*/

#ifndef LIBCORK_CONFIG_GCC_H
#define LIBCORK_CONFIG_GCC_H

/* Figure out the GCC version */

#if defined(__GNUC_PATCHLEVEL__)
#define CORK_CONFIG_GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#else
#define CORK_CONFIG_GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100)
#endif


/*-----------------------------------------------------------------------
* Compiler attributes
*/

/* The GCC assembly syntax has been available basically forever. */

#if defined(CORK_CONFIG_GCC_VERSION)
#define CORK_CONFIG_HAVE_GCC_ASM 1
#else
#define CORK_CONFIG_HAVE_GCC_ASM 0
#endif

/* The GCC atomic instrinsics are available as of GCC 4.1.0. */

#if CORK_CONFIG_GCC_VERSION >= 40100
#define CORK_CONFIG_HAVE_GCC_ATOMICS 1
#else
#define CORK_CONFIG_HAVE_GCC_ATOMICS 0
#endif

/* The attributes we want to use are available as of GCC 2.96. */

#if CORK_CONFIG_GCC_VERSION >= 29600
#define CORK_CONFIG_HAVE_GCC_ATTRIBUTES 1
#else
#define CORK_CONFIG_HAVE_GCC_ATTRIBUTES 0
#endif

/* __int128 seems to be available on 64-bit platforms as of GCC 4.6. The
* attribute((mode(TI))) syntax seems to be available as of 4.1. */

#if CORK_CONFIG_ARCH_X64 && CORK_CONFIG_GCC_VERSION >= 40600
#define CORK_CONFIG_HAVE_GCC_INT128 1
#else
#define CORK_CONFIG_HAVE_GCC_INT128 0
#endif

#if CORK_CONFIG_ARCH_X64 && CORK_CONFIG_GCC_VERSION >= 40100
#define CORK_CONFIG_HAVE_GCC_MODE_ATTRIBUTE 1
#else
#define CORK_CONFIG_HAVE_GCC_MODE_ATTRIBUTE 0
#endif

/* Statement expressions have been available since GCC 3.1. */

#if CORK_CONFIG_GCC_VERSION >= 30100
#define CORK_CONFIG_HAVE_GCC_STATEMENT_EXPRS 1
#else
#define CORK_CONFIG_HAVE_GCC_STATEMENT_EXPRS 0
#endif

/* Thread-local storage has been available since GCC 3.3, but not on Mac
* OS X. */

#if !(defined(__APPLE__) && defined(__MACH__))
#if CORK_CONFIG_GCC_VERSION >= 30300
#define CORK_CONFIG_HAVE_THREAD_STORAGE_CLASS 1
#else
#define CORK_CONFIG_HAVE_THREAD_STORAGE_CLASS 0
#endif
#else
#define CORK_CONFIG_HAVE_THREAD_STORAGE_CLASS 0
#endif


#endif /* LIBCORK_CONFIG_GCC_H */
34 changes: 34 additions & 0 deletions 3rd/libcork/include/config/linux.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* -*- coding: utf-8 -*-
* ----------------------------------------------------------------------
* Copyright © 2011, RedJack, LLC.
* All rights reserved.
*
* Please see the COPYING file in this distribution for license
* details.
* ----------------------------------------------------------------------
*/

#ifndef LIBCORK_CONFIG_LINUX_H
#define LIBCORK_CONFIG_LINUX_H

/*-----------------------------------------------------------------------
* Endianness
*/

#include <endian.h>

#if __BYTE_ORDER == __BIG_ENDIAN
#define CORK_CONFIG_IS_BIG_ENDIAN 1
#define CORK_CONFIG_IS_LITTLE_ENDIAN 0
#elif __BYTE_ORDER == __LITTLE_ENDIAN
#define CORK_CONFIG_IS_BIG_ENDIAN 0
#define CORK_CONFIG_IS_LITTLE_ENDIAN 1
#else
#error "Cannot determine system endianness"
#endif

#define CORK_HAVE_REALLOCF 0
#define CORK_HAVE_PTHREADS 1


#endif /* LIBCORK_CONFIG_LINUX_H */
Loading

0 comments on commit 458fd0a

Please sign in to comment.