Permalink
Browse files

Initial import

  • Loading branch information...
1 parent fc5e3f1 commit 529d90cbc837f40bbf3081359989295042b94a14 @jedisct1 committed May 7, 2010
Showing with 73,289 additions and 0 deletions.
  1. +32 −0 .gitignore
  2. +1 −0 AUTHORS
  3. +23 −0 COPYING
  4. 0 ChangeLog
  5. +8 −0 Makefile.am
  6. 0 NEWS
  7. +17 −0 autogen.sh
  8. +90 −0 configure.ac
  9. +79 −0 pincaster.conf
  10. +58 −0 src/Makefile.am
  11. +30 −0 src/app.c
  12. +209 −0 src/app_config.c
  13. +42 −0 src/app_config.h
  14. +65 −0 src/common.h
  15. +79 −0 src/cqueue.c
  16. +21 −0 src/cqueue.h
  17. +279 −0 src/db_log.c
  18. +30 −0 src/db_log.h
  19. +420 −0 src/domain_layers.c
  20. +24 −0 src/domain_layers.h
  21. +596 −0 src/domain_records.c
  22. +19 −0 src/domain_records.h
  23. +396 −0 src/domain_search.c
  24. +16 −0 src/domain_search.h
  25. +145 −0 src/domain_system.c
  26. +13 −0 src/domain_system.h
  27. 0 src/ext/Makefile.am
  28. +527 −0 src/ext/queue.h
  29. +738 −0 src/ext/tree.h
  30. +179 −0 src/handle_consumer_ops.c
  31. +7 −0 src/handle_consumer_ops.h
  32. +484 −0 src/http_server.c
  33. +301 −0 src/http_server.h
  34. +75 −0 src/key_nodes.c
  35. +13 −0 src/key_nodes.h
  36. +78 −0 src/keys.c
  37. +18 −0 src/keys.h
  38. +77 −0 src/levent2/.gitignore
  39. +478 −0 src/levent2/ChangeLog
  40. +244 −0 src/levent2/Doxyfile
  41. +74 −0 src/levent2/LICENSE
  42. +182 −0 src/levent2/Makefile.am
  43. +47 −0 src/levent2/Makefile.nmake
  44. +121 −0 src/levent2/README
  45. +353 −0 src/levent2/WIN32-Code/event-config.h
  46. +1,354 −0 src/levent2/WIN32-Code/tree.h
  47. +530 −0 src/levent2/arc4random.c
  48. +11 −0 src/levent2/autogen.sh
  49. +2,807 −0 src/levent2/buffer.c
  50. +313 −0 src/levent2/buffer_iocp.c
  51. +381 −0 src/levent2/bufferevent-internal.h
  52. +827 −0 src/levent2/bufferevent.c
  53. +531 −0 src/levent2/bufferevent_async.c
  54. +487 −0 src/levent2/bufferevent_filter.c
  55. +1,280 −0 src/levent2/bufferevent_openssl.c
  56. +318 −0 src/levent2/bufferevent_pair.c
  57. +928 −0 src/levent2/bufferevent_ratelim.c
  58. +666 −0 src/levent2/bufferevent_sock.c
  59. +101 −0 src/levent2/changelist-internal.h
  60. +527 −0 src/levent2/compat/sys/queue.h
  61. +579 −0 src/levent2/configure.in
  62. +112 −0 src/levent2/defer-internal.h
  63. +309 −0 src/levent2/devpoll.c
  64. +359 −0 src/levent2/epoll.c
  65. +52 −0 src/levent2/epoll_sub.c
  66. +274 −0 src/levent2/evbuffer-internal.h
  67. +322 −0 src/levent2/evdns.3
  68. +4,444 −0 src/levent2/evdns.c
  69. +35 −0 src/levent2/evdns.h
  70. +320 −0 src/levent2/event-internal.h
  71. +624 −0 src/levent2/event.3
  72. +2,656 −0 src/levent2/event.c
  73. +204 −0 src/levent2/event.h
  74. +274 −0 src/levent2/event_iocp.c
  75. +1,711 −0 src/levent2/event_rpcgen.py
  76. +586 −0 src/levent2/event_tagging.c
  77. +35 −0 src/levent2/evhttp.h
  78. +90 −0 src/levent2/evmap-internal.h
  79. +714 −0 src/levent2/evmap.c
  80. +462 −0 src/levent2/evport.c
  81. +204 −0 src/levent2/evrpc-internal.h
  82. +1,151 −0 src/levent2/evrpc.c
  83. +35 −0 src/levent2/evrpc.h
  84. +54 −0 src/levent2/evsignal-internal.h
  85. +185 −0 src/levent2/evthread-internal.h
  86. +279 −0 src/levent2/evthread.c
  87. +112 −0 src/levent2/evthread_pthread.c
  88. +106 −0 src/levent2/evthread_win32.c
  89. +1,972 −0 src/levent2/evutil.c
  90. +31 −0 src/levent2/evutil.h
  91. +123 −0 src/levent2/evutil_rand.c
  92. +486 −0 src/levent2/ht-internal.h
  93. +173 −0 src/levent2/http-internal.h
  94. +3,218 −0 src/levent2/http.c
  95. +31 −0 src/levent2/include/Makefile.am
  96. +736 −0 src/levent2/include/event2/buffer.h
  97. +110 −0 src/levent2/include/event2/buffer_compat.h
  98. +710 −0 src/levent2/include/event2/bufferevent.h
  99. +96 −0 src/levent2/include/event2/bufferevent_compat.h
  100. +78 −0 src/levent2/include/event2/bufferevent_ssl.h
  101. +113 −0 src/levent2/include/event2/bufferevent_struct.h
  102. +631 −0 src/levent2/include/event2/dns.h
  103. +335 −0 src/levent2/include/event2/dns_compat.h
  104. +80 −0 src/levent2/include/event2/dns_struct.h
  105. +733 −0 src/levent2/include/event2/event.h
  106. +324 −0 src/levent2/include/event2/event_compat.h
  107. +138 −0 src/levent2/include/event2/event_struct.h
  108. +580 −0 src/levent2/include/event2/http.h
  109. +90 −0 src/levent2/include/event2/http_compat.h
  110. +126 −0 src/levent2/include/event2/http_struct.h
  111. +119 −0 src/levent2/include/event2/listener.h
  112. +596 −0 src/levent2/include/event2/rpc.h
  113. +61 −0 src/levent2/include/event2/rpc_compat.h
  114. +100 −0 src/levent2/include/event2/rpc_struct.h
  115. +124 −0 src/levent2/include/event2/tag.h
  116. +39 −0 src/levent2/include/event2/tag_compat.h
  117. +194 −0 src/levent2/include/event2/thread.h
  118. +573 −0 src/levent2/include/event2/util.h
  119. +199 −0 src/levent2/iocp-internal.h
  120. +72 −0 src/levent2/ipv6-internal.h
  121. +414 −0 src/levent2/kqueue.c
  122. +16 −0 src/levent2/libevent.pc.in
  123. +630 −0 src/levent2/listener.c
  124. +57 −0 src/levent2/log-internal.h
  125. +222 −0 src/levent2/log.c
  126. +279 −0 src/levent2/m4/acx_pthread.m4
  127. +160 −0 src/levent2/minheap-internal.h
  128. +40 −0 src/levent2/mkinstalldirs
  129. +61 −0 src/levent2/mm-internal.h
  130. +336 −0 src/levent2/poll.c
  131. +102 −0 src/levent2/ratelim-internal.h
  132. +22 −0 src/levent2/sample/Makefile.am
  133. +221 −0 src/levent2/sample/dns-example.c
  134. +143 −0 src/levent2/sample/event-test.c
  135. +135 −0 src/levent2/sample/hello-world.c
  136. +270 −0 src/levent2/sample/le-proxy.c
  137. +77 −0 src/levent2/sample/signal-test.c
  138. +108 −0 src/levent2/sample/time-test.c
  139. +316 −0 src/levent2/select.c
  140. +346 −0 src/levent2/signal.c
  141. +21 −0 src/levent2/strlcpy-internal.h
  142. +74 −0 src/levent2/strlcpy.c
  143. +68 −0 src/levent2/test/Makefile.am
  144. +51 −0 src/levent2/test/Makefile.nmake
  145. +190 −0 src/levent2/test/bench.c
  146. +169 −0 src/levent2/test/bench_cascade.c
  147. +175 −0 src/levent2/test/bench_http.c
  148. +208 −0 src/levent2/test/bench_httpclient.c
  149. +2,169 −0 src/levent2/test/regress.c
  150. +121 −0 src/levent2/test/regress.h
  151. +25 −0 src/levent2/test/regress.rpc
  152. +1,552 −0 src/levent2/test/regress_buffer.c
  153. +815 −0 src/levent2/test/regress_bufferevent.c
  154. +1,528 −0 src/levent2/test/regress_dns.c
  155. +155 −0 src/levent2/test/regress_et.c
  156. +2,685 −0 src/levent2/test/regress_http.c
  157. +273 −0 src/levent2/test/regress_iocp.c
  158. +151 −0 src/levent2/test/regress_listener.c
  159. +372 −0 src/levent2/test/regress_main.c
  160. +98 −0 src/levent2/test/regress_minheap.c
  161. +148 −0 src/levent2/test/regress_pthread.c
  162. +875 −0 src/levent2/test/regress_rpc.c
  163. +400 −0 src/levent2/test/regress_ssl.c
  164. +185 −0 src/levent2/test/regress_testutils.c
  165. +59 −0 src/levent2/test/regress_testutils.h
  166. +1,004 −0 src/levent2/test/regress_util.c
  167. +319 −0 src/levent2/test/regress_zlib.c
  168. +86 −0 src/levent2/test/test-eof.c
  169. +34 −0 src/levent2/test/test-init.c
  170. +349 −0 src/levent2/test/test-ratelim.c
  171. +83 −0 src/levent2/test/test-time.c
  172. +86 −0 src/levent2/test/test-weof.c
  173. +122 −0 src/levent2/test/test.sh
  174. +365 −0 src/levent2/test/tinytest.c
  175. +87 −0 src/levent2/test/tinytest.h
  176. +215 −0 src/levent2/test/tinytest_demo.c
  177. +145 −0 src/levent2/test/tinytest_macros.h
  178. +232 −0 src/levent2/util-internal.h
  179. +481 −0 src/levent2/whatsnew-2.0.txt
  180. +380 −0 src/levent2/win32select.c
  181. +929 −0 src/pandb.c
  182. +138 −0 src/pandb.h
  183. +65 −0 src/parser.c
  184. +13 −0 src/parser.h
  185. +11 −0 src/parser_p.h
  186. +144 −0 src/query_parser.c
  187. +11 −0 src/query_parser.h
  188. +311 −0 src/slab.c
  189. +31 −0 src/slab.h
  190. +29 −0 src/slab_p.h
  191. +514 −0 src/slipmap.c
  192. +41 −0 src/slipmap.h
  193. +111 −0 src/stack.c
  194. +35 −0 src/stack.h
  195. +307 −0 src/utils.c
  196. +48 −0 src/utils.h
  197. +2 −0 src/yajl/.gitignore
  198. +29 −0 src/yajl/COPYING
  199. +24 −0 src/yajl/Makefile.am
  200. +1 −0 src/yajl/api/.gitignore
  201. +6 −0 src/yajl/api/Makefile.am
  202. +85 −0 src/yajl/api/yajl_common.h
  203. +159 −0 src/yajl/api/yajl_gen.h
  204. +193 −0 src/yajl/api/yajl_parse.h
  205. +159 −0 src/yajl/yajl.c
  206. +68 −0 src/yajl/yajl_alloc.c
  207. +50 −0 src/yajl/yajl_alloc.h
  208. +119 −0 src/yajl/yajl_buf.c
  209. +73 −0 src/yajl/yajl_buf.h
  210. +85 −0 src/yajl/yajl_bytestack.h
  211. +188 −0 src/yajl/yajl_encode.c
  212. +50 −0 src/yajl/yajl_encode.h
  213. +322 −0 src/yajl/yajl_gen.c
  214. +737 −0 src/yajl/yajl_lex.c
  215. +133 −0 src/yajl/yajl_lex.h
  216. +448 −0 src/yajl/yajl_parser.c
  217. +82 −0 src/yajl/yajl_parser.h
View
@@ -0,0 +1,32 @@
+*~
+Makefile
+src/pincaster
+src/*.dSYM
+*.cmake
+INSTALL
+aclocal.m4
+autom4te.cache
+*.log
+configure
+*.scan
+depcomp
+install-sh
+missing
+Makefile.in
+src/Makefile.in
+src/ext/Makefile.in
+*.status
+*.tar.*
+src/.deps
+src/*.o
+stamp-*
+config.*
+ltmain.sh
+src/yajl/.deps
+src/yajl/*.o
+testing/a.out
+testing/*.dSYM
+src/levent2/m4/lt*.m4
+src/levent2/m4/libtool.m4
+testing
+src/levent2/doxygen
View
@@ -0,0 +1 @@
+Frank DENIS <j at pureftpd dot org>
View
23 COPYING
@@ -0,0 +1,23 @@
+
+Pincaster is covered by the following license :
+
+/*
+ * Copyright (c) 2010
+ * Frank Denis <j at pureftpd dot org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+For conveniency, this package also includes possibly modified versions
+of libevent and yajl, whose original licenses are included in their
+respective directories.
View
No changes.
View
@@ -0,0 +1,8 @@
+AUTOMAKE_OPTIONS = gnu
+
+SUBDIRS = \
+ src
+
+EXTRA_DIST = \
+ pincaster.conf
+
View
0 NEWS
No changes.
View
@@ -0,0 +1,17 @@
+#! /bin/sh
+
+export LIBTOOL=glibtool
+export LIBTOOLIZE=glibtoolize
+
+$LIBTOOLIZE -f -i --recursive && \
+aclocal && \
+autoheader && \
+automake --gnu --add-missing --include-deps && \
+autoconf
+
+(cd src/levent2 && \
+$LIBTOOLIZE -f -i --subproject && \
+aclocal -I m4 && \
+autoheader && \
+automake --gnu --add-missing --include-deps && \
+autoconf)
View
@@ -0,0 +1,90 @@
+AC_PREREQ([2.65])
+AC_INIT([pincaster], [0.1], [bugs at puretpd dot org])
+AC_CONFIG_SRCDIR([src/app.c])
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([1.9 dist-bzip2])
+AM_MAINTAINER_MODE
+
+AC_SUBST(VERSION)
+ISODATE=`date +%Y-%m-%d`
+AC_SUBST(ISODATE)
+
+# Checks for programs.
+AC_PROG_CC_C99
+AC_USE_SYSTEM_EXTENSIONS
+CPPFLAGS="$CPPFLAGS -D_XPG4_2=1"
+AC_PROG_RANLIB
+
+if test -d /usr/local/include; then
+ CPPFLAGS="$CPPFLAGS -I/usr/local/include"
+fi
+
+if test -d /usr/local/lib; then
+ LDFLAGS="$LDFLAGS -L/usr/local/lib"
+fi
+
+CFLAGS="$CFLAGS -pthread"
+LDFLAGS="$LDFLAGS -pthread"
+
+# Checks for libraries.
+AC_CHECK_LIB([m], [cosf],, AC_ERROR([libm not found]))
+AC_CHECK_LIB([rt], [clock_gettime])
+
+# Checks for header files.
+AC_SYS_LARGEFILE
+AC_HEADER_STDBOOL
+AC_CHECK_HEADERS([inttypes.h limits.h stddef.h stdlib.h string.h pthreads.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_RESTRICT
+AC_C_FLEXIBLE_ARRAY_MEMBER
+AC_C_VARARRAYS
+
+AC_CHECK_ALIGNOF(void *)
+
+AC_TYPE_SIGNAL
+AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
+AC_TYPE_OFF_T
+AC_TYPE_MODE_T
+AC_TYPE_INTPTR_T
+AC_TYPE_UINTPTR_T
+AC_CHECK_TYPES([ptrdiff_t])
+
+# Switches
+AC_HEADER_ASSERT
+
+AC_ARG_WITH(debug,
+[AS_HELP_STRING(--with-debug,For maintainers only - please do not use)],
+[ if test "x$withval" = "xyes" ; then
+ CFLAGS="$CFLAGS -DQUEUE_MACRO_DEBUG=1 -DDEBUG=1 -g -Wall -W -Wcast-align -Wbad-function-cast -Wstrict-prototypes -Wwrite-strings -Wreturn-type "
+ fi ])
+
+# Checks for library functions.
+AC_FUNC_ALLOCA
+AC_FUNC_FORK
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_FUNC_STRTOD
+AC_CHECK_FUNCS([memmove strcasecmp strchr strdup])
+AC_CHECK_FUNCS([pthread_spin_lock OSSpinLockLock fdatasync])
+AC_CHECK_FUNCS([ffs ffsl ffsll])
+AC_CHECK_FUNCS([strncasecmp strtol])
+AC_CHECK_HEADERS([fcntl.h])
+
+AC_SUBST([MAINT])
+
+LEVENTDIR="levent2"
+AC_CONFIG_SUBDIRS([src/levent2])
+CPPFLAGS="-I$LEVENTDIR -I$LEVENTDIR/include $CPPFLAGS"
+
+AC_CONFIG_FILES([Makefile
+ src/Makefile
+ src/ext/Makefile
+ src/yajl/Makefile
+ src/yajl/api/Makefile
+ ])
+
+AC_OUTPUT
+
+(cd src/levent2 && $am_make)
View
@@ -0,0 +1,79 @@
+
+#########################################
+# #
+# Sample Pincaster configuration file #
+# #
+#########################################
+
+
+# Number of workers threads. One per CPU core might not be a bad idea.
+
+Workers 2
+
+
+# The file name to save the database journal
+# You can comment this out if you want a memory-only database.
+
+DBFileName /tmp/pincaster.db
+
+
+# Listen to this IP address. Comment out in order to listen to *
+
+# ServerIP 127.0.0.1
+
+
+# Listen to this port number
+
+ServerPort 8080
+
+
+# Client connection timeout
+
+Timeout 60
+
+
+# The default type of layer.
+# Should be one of: flat, flatwrap, spherical and geoidal.
+
+DefaultLayerType geoidal
+
+
+# The formula used for distance calculation.
+# Should be one of: haversine, greatcircle, fast and romboid.
+
+Accuracy fast
+
+
+#############################################################
+# You should probably not change anything below this line. #
+#############################################################
+
+
+# fsync() every x seconds.
+# 0 means fsync() after every write. Safe, but slow.
+# -1 means no fsync() at all.
+
+FsyncPeriod 5
+
+
+# The journal write buffer size.
+
+JournalBufferSize 4096
+
+
+# The highest number of queued queries waiting for being processed.
+
+MaxQueuedReplies 10000
+
+
+# The bucket size, i.e. the max number of items in each node of the quadtree.
+# Ignored, for now.
+
+BucketSize 50
+
+
+# Nodes within this range will all be in the same bucket.
+
+DimensionAccuracy 0.0001
+
+
View
@@ -0,0 +1,58 @@
+
+pincaster_LDADD = \
+ levent2/.libs/libevent.a \
+ levent2/.libs/libevent_pthreads.a \
+ yajl/libyajl.a
+
+bin_PROGRAMS = \
+ pincaster
+
+pincaster_SOURCES = \
+ common.h \
+ ext/queue.h \
+ ext/tree.h \
+ app.c \
+ parser.c \
+ parser_p.h \
+ parser.h \
+ app_config.c \
+ app_config.h \
+ utils.c \
+ utils.h \
+ cqueue.c \
+ cqueue.h \
+ keys.c \
+ keys.h \
+ pandb.c \
+ pandb.h \
+ slab.c \
+ slab.h \
+ slab_p.h \
+ slipmap.c \
+ slipmap.h \
+ stack.c \
+ stack.h \
+ db_log.c \
+ db_log.h \
+ query_parser.c \
+ query_parser.h \
+ http_server.c \
+ http_server.h \
+ key_nodes.c \
+ key_nodes.h \
+ domain_system.c \
+ domain_system.h \
+ domain_layers.c \
+ domain_layers.h \
+ domain_records.c \
+ domain_records.h \
+ domain_search.c \
+ domain_search.h \
+ handle_consumer_ops.c \
+ handle_consumer_ops.h
+
+pincaster_DEPENDS = \
+ yajl/libyajl.a
+
+SUBDIRS = \
+ ext levent2 yajl
View
@@ -0,0 +1,30 @@
+
+#define DEFINE_GLOBALS 1
+
+#include "common.h"
+#include "http_server.h"
+#include "app_config.h"
+
+static void usage(void)
+{
+ puts("\nUsage: pincaster <configuration file>\n");
+}
+
+int main(int argc, char *argv[])
+{
+ if (argc < 2) {
+ usage();
+ return 1;
+ }
+ check_sys_config();
+ init_db_log();
+ if (parse_config(argv[1]) != 0) {
+ return 2;
+ }
+ open_db_log();
+ http_server();
+ free_db_log();
+ free_config();
+
+ return 0;
+}
Oops, something went wrong.

0 comments on commit 529d90c

Please sign in to comment.