Skip to content
Browse files

* Compile fixes

* Remove executable permissions from text and source files
* Add checks for PCL and glib in configure
  • Loading branch information...
1 parent cbb38c0 commit 62025113e3b00899bc7f22d10b067a6ad207818d Erik Nordström committed
Showing with 1,768 additions and 1,433 deletions.
  1. 0 AUTHORS
  2. 0 Android.mk
  3. 0 COPYING
  4. 0 ChangeLog
  5. 0 INSTALL
  6. 0 Makefile.am
  7. 0 NEWS
  8. 0 README
  9. 0 android/ServalChat/.classpath
  10. 0 android/ServalChat/.project
  11. 0 android/ServalChat/AndroidManifest.xml
  12. 0 android/ServalChat/default.properties
  13. 0 android/ServalChat/proguard.cfg
  14. 0 android/ServalChat/res/drawable-hdpi/icon.png
  15. 0 android/ServalChat/res/drawable-ldpi/icon.png
  16. 0 android/ServalChat/res/drawable-mdpi/icon.png
  17. 0 android/ServalChat/res/layout/main.xml
  18. 0 android/ServalChat/res/layout/message.xml
  19. 0 android/ServalChat/res/values/strings.xml
  20. 0 android/ServalChat/src/edu/princeton/cs/sns/ServalChat/ChatActivity.java
  21. +10 −0 configure.ac
  22. 0 include/libserval/serval.h
  23. 0 include/libstack/callback.h
  24. 0 include/libstack/ctrlmsg.h
  25. 0 include/libstack/resolver_protocol.h
  26. 0 include/libstack/stack.h
  27. 0 include/netinet/serval.h
  28. 0 include/serval/atomic.h
  29. 0 include/serval/bitops.h
  30. 0 include/serval/debug.h
  31. 0 include/serval/dst.h
  32. 0 include/serval/hash.h
  33. 0 include/serval/inet_sock.h
  34. 0 include/serval/list.h
  35. 0 include/serval/lock.h
  36. 0 include/serval/net.h
  37. 0 include/serval/netdevice.h
  38. +2 −0 include/serval/platform.h
  39. 0 include/serval/platform_tcpip.h
  40. 0 include/serval/skbuff.h
  41. 0 include/serval/sock.h
  42. 0 include/serval/timer.h
  43. +4 −2 include/serval/wait.h
  44. 0 src/Makefile.am
  45. 0 src/javasock/Makefile.am
  46. 0 src/javasock/Manifest.txt
  47. 0 src/javasock/README
  48. 0 src/javasock/java/Makefile.am
  49. 0 src/javasock/java/serval/net/ServalDatagramPacket.java
  50. 0 src/javasock/java/serval/net/ServalDatagramSocket.java
  51. 0 src/javasock/java/serval/net/ServalDatagramSocketImpl.java
  52. 0 src/javasock/java/serval/net/ServalDatagramSocketImplFactory.java
  53. 0 src/javasock/java/serval/net/ServalServerDatagramSocket.java
  54. 0 src/javasock/java/serval/net/ServalSocket.java
  55. 0 src/javasock/java/serval/net/ServalSocketAddress.java
  56. 0 src/javasock/java/serval/net/ServiceID.java
  57. 0 src/javasock/java/serval/platform/ServalNetworkStack.java
  58. 0 src/javasock/java/serval/test/UDPClient.java
  59. 0 src/javasock/java/serval/test/UDPServer.java
  60. 0 src/javasock/jni/Android.mk
  61. 0 src/javasock/jni/JNIHelp.c
  62. 0 src/javasock/jni/JNIHelp.h
  63. 0 src/javasock/jni/Makefile.am
  64. 0 src/javasock/jni/serval_platform_ServalNetworkStack.c
  65. 0 src/javasock/jni/serval_platform_ServalNetworkStack.h
  66. 0 src/libserval/Android.mk
  67. 0 src/libserval/Makefile.am
  68. 0 src/libserval/accept.cc
  69. 0 src/libserval/accept.hh
  70. 0 src/libserval/bind.cc
  71. 0 src/libserval/bind.hh
  72. 0 src/libserval/cli.cc
  73. 0 src/libserval/cli.hh
  74. 0 src/libserval/close.cc
  75. 0 src/libserval/close.hh
  76. 0 src/libserval/connect.cc
  77. 0 src/libserval/connect.hh
  78. 0 src/libserval/listen.cc
  79. 0 src/libserval/listen.hh
  80. 0 src/libserval/log.cc
  81. 0 src/libserval/log.hh
  82. 0 src/libserval/message.cc
  83. 0 src/libserval/message.hh
  84. 0 src/libserval/migrate.cc
  85. 0 src/libserval/migrate.hh
  86. 0 src/libserval/recv.cc
  87. 0 src/libserval/recv.hh
  88. 0 src/libserval/select.cc
  89. 0 src/libserval/select.hh
  90. 0 src/libserval/send.cc
  91. 0 src/libserval/send.hh
  92. 0 src/libserval/sf.cc
  93. 0 src/libserval/socket.cc
  94. 0 src/libserval/socket.hh
  95. 0 src/libserval/sockio.cc
  96. 0 src/libserval/sockio.hh
  97. 0 src/libserval/state.cc
  98. 0 src/libserval/state.hh
  99. 0 src/libserval/types.h
  100. 0 src/libstack/Android.mk
  101. 0 src/libstack/Makefile.am
  102. 0 src/libstack/ctrlmsg.c
  103. 0 src/libstack/debug.h
  104. 0 src/libstack/event.c
  105. 0 src/libstack/event.h
  106. 0 src/libstack/init.h
  107. 0 src/libstack/libstack.c
  108. 0 src/libstack/netlink.c
  109. 0 src/libstack/unix.c
  110. 0 src/servd/Android.mk
  111. +88 −33 src/servd/Makefile.am
  112. 0 src/servd/client_resolver.c
  113. 0 src/servd/cmwc.c
  114. 0 src/servd/cmwc.h
  115. 0 src/servd/debug.h
  116. 0 src/servd/ifa.c
  117. 0 src/servd/ifa.h
  118. +7 −4 src/servd/local_resolver.c
  119. 0 src/servd/message_channel.h
  120. +2 −2 src/servd/message_channel_base.c
  121. 0 src/servd/message_channel_base.h
  122. +2 −2 src/servd/messaging_test.c
  123. +4 −3 src/servd/netlink_message_channel.c
  124. 0 src/servd/poll_reactor.c
  125. 0 src/servd/poll_reactor.h
  126. +23 −19 src/servd/prefixtrie.c
  127. 0 src/servd/prefixtrie.h
  128. +2 −0 src/servd/prefixtrie_test.c
  129. +9 −7 src/servd/resolution_path.c
  130. 0 src/servd/resolution_path.h
  131. 0 src/servd/resolver.h
  132. +2 −0 src/servd/resolver_base.c
  133. 0 src/servd/resolver_base.h
  134. +3 −2 src/servd/resolver_messaging.c
  135. 0 src/servd/resolver_messaging.h
  136. 0 src/servd/rtnl.c
  137. 0 src/servd/rtnl.h
  138. 0 src/servd/servd.c
  139. 0 src/servd/server_resolver.c
  140. 0 src/servd/server_resolver.h
  141. +19 −16 src/servd/service_router.c
  142. 0 src/servd/service_table.c
  143. 0 src/servd/service_table.h
  144. +1 −1 src/servd/service_table_test.c
  145. 0 src/servd/service_types.c
  146. 0 src/servd/service_types.h
  147. 0 src/servd/service_util.c
  148. 0 src/servd/service_util.h
  149. +13 −10 src/servd/task.c
  150. +1 −0 src/servd/task.h
  151. +1 −1 src/servd/task_test.c
  152. 0 src/servd/time_util.c
  153. 0 src/servd/time_util.h
  154. 0 src/servd/timer.c
  155. 0 src/servd/timer.h
  156. +5 −5 src/servd/udp_message_channel.c
  157. +2 −2 src/servd/unix_message_channel.c
  158. +6 −6 src/servd/util_test.c
  159. 0 src/stack/Android.mk
  160. 0 src/stack/Kbuild.in
  161. 0 src/stack/Makefile.am
  162. 0 src/stack/af_serval.c
  163. 0 src/stack/af_serval.h
  164. 0 src/stack/bst.c
  165. 0 src/stack/bst.h
  166. 0 src/stack/ctrl.h
  167. +172 −141 src/stack/ctrl_handler.c
  168. 0 src/stack/debug.c
  169. 0 src/stack/input.c
  170. 0 src/stack/input.h
  171. 0 src/stack/linux/ctrl.c
  172. 0 src/stack/linux/log.c
  173. 0 src/stack/linux/log.h
  174. 0 src/stack/linux/module.c
  175. 0 src/stack/linux/packet.c
  176. 0 src/stack/linux/proc.c
  177. 0 src/stack/linux/splice.c
  178. 0 src/stack/neighbor.c
  179. 0 src/stack/neighbor.h
  180. 0 src/stack/output.c
  181. 0 src/stack/output.h
  182. 0 src/stack/platform.c
  183. 0 src/stack/serval_ipv4.c
  184. 0 src/stack/serval_ipv4.h
  185. 0 src/stack/serval_request_sock.h
  186. 0 src/stack/serval_sock.c
  187. 0 src/stack/serval_sock.h
  188. +346 −307 src/stack/serval_srv.c
  189. 0 src/stack/serval_srv.h
  190. 0 src/stack/serval_tcp.c
  191. 0 src/stack/serval_tcp_sock.h
  192. 0 src/stack/serval_udp.c
  193. 0 src/stack/serval_udp_sock.h
  194. +995 −821 src/stack/service.c
  195. 0 src/stack/service.h
  196. 0 src/stack/userlevel/client.c
  197. 0 src/stack/userlevel/client.h
  198. 0 src/stack/userlevel/client_msg.c
  199. 0 src/stack/userlevel/client_msg.h
  200. 0 src/stack/userlevel/ctrl.c
  201. 0 src/stack/userlevel/dev.c
  202. 0 src/stack/userlevel/dst.c
  203. 0 src/stack/userlevel/packet.h
  204. 0 src/stack/userlevel/packet_bpf.c
  205. 0 src/stack/userlevel/packet_linux.c
  206. 0 src/stack/userlevel/serval.c
  207. 0 src/stack/userlevel/skbuff.c
  208. +2 −1 src/stack/userlevel/sock.c
  209. 0 src/stack/userlevel/socket.c
  210. 0 src/stack/userlevel/telnet.c
  211. 0 src/stack/userlevel/timer.c
  212. +47 −48 src/stack/userlevel/wait.c
  213. 0 src/test/Android.mk
  214. 0 src/test/Makefile.am
  215. 0 src/test/addservice.c
  216. 0 src/test/bindtest.c
  217. 0 src/test/listentest.c
  218. 0 src/test/nltest.c
  219. 0 src/test/recv_udp_packet.c
  220. 0 src/test/send_udp_packet.c
  221. 0 src/test/tcp_inet_client.c
  222. 0 src/test/translator.c
  223. 0 src/test/udp_client.c
  224. 0 src/test/udp_server.c
View
0 AUTHORS 100755 → 100644
File mode changed.
View
0 Android.mk 100755 → 100644
File mode changed.
View
0 COPYING 100755 → 100644
File mode changed.
View
0 ChangeLog 100755 → 100644
File mode changed.
View
0 INSTALL 100755 → 100644
File mode changed.
View
0 Makefile.am 100755 → 100644
File mode changed.
View
0 NEWS 100755 → 100644
File mode changed.
View
0 README 100755 → 100644
File mode changed.
View
0 android/ServalChat/.classpath 100755 → 100644
File mode changed.
View
0 android/ServalChat/.project 100755 → 100644
File mode changed.
View
0 android/ServalChat/AndroidManifest.xml 100755 → 100644
File mode changed.
View
0 android/ServalChat/default.properties 100755 → 100644
File mode changed.
View
0 android/ServalChat/proguard.cfg 100755 → 100644
File mode changed.
View
0 android/ServalChat/res/drawable-hdpi/icon.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0 android/ServalChat/res/drawable-ldpi/icon.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0 android/ServalChat/res/drawable-mdpi/icon.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0 android/ServalChat/res/layout/main.xml 100755 → 100644
File mode changed.
View
0 android/ServalChat/res/layout/message.xml 100755 → 100644
File mode changed.
View
0 android/ServalChat/res/values/strings.xml 100755 → 100644
File mode changed.
View
0 android/ServalChat/src/edu/princeton/cs/sns/ServalChat/ChatActivity.java 100755 → 100644
File mode changed.
View
10 configure.ac 100755 → 100644
@@ -231,6 +231,16 @@ esac],[kernel=yes])
AM_CONDITIONAL([LINUX_KERNEL], [test x$kernel = xyes && test x$serval_os_linux = xyes])
+
+dnl Check for PCL library
+AC_CHECK_LIB(pcl,co_thread_init, [AC_CHECK_HEADERS([pcl.h],have_pcl=yes,AC_MSG_ERROR(You have libpcl but not the development headers))],AC_MSG_ERROR(PCL library not found...),)
+
+AC_MSG_CHECKING([for Portable Coroutine Library (PCL)])
+AC_MSG_RESULT([$have_pcl])
+
+dnl Check for glib
+PKG_CHECK_MODULES([GLIB], [glib-2.0])
+
dnl Check for OpenSSL and development headers
#AC_CHECK_LIB(crypto,DSA_sign,
# [AC_CHECK_HEADERS([openssl/rsa.h],,AC_MSG_ERROR(You have openssl but not the development headers))],AC_MSG_ERROR(openssl library is not found...),)
View
0 include/libserval/serval.h 100755 → 100644
File mode changed.
View
0 include/libstack/callback.h 100755 → 100644
File mode changed.
View
0 include/libstack/ctrlmsg.h 100755 → 100644
File mode changed.
View
0 include/libstack/resolver_protocol.h 100755 → 100644
File mode changed.
View
0 include/libstack/stack.h 100755 → 100644
File mode changed.
View
0 include/netinet/serval.h 100755 → 100644
File mode changed.
View
0 include/serval/atomic.h 100755 → 100644
File mode changed.
View
0 include/serval/bitops.h 100755 → 100644
File mode changed.
View
0 include/serval/debug.h 100755 → 100644
File mode changed.
View
0 include/serval/dst.h 100755 → 100644
File mode changed.
View
0 include/serval/hash.h 100755 → 100644
File mode changed.
View
0 include/serval/inet_sock.h 100755 → 100644
File mode changed.
View
0 include/serval/list.h 100755 → 100644
File mode changed.
View
0 include/serval/lock.h 100755 → 100644
File mode changed.
View
0 include/serval/net.h 100755 → 100644
File mode changed.
View
0 include/serval/netdevice.h 100755 → 100644
File mode changed.
View
2 include/serval/platform.h 100755 → 100644
@@ -35,6 +35,8 @@
#define HAVE_LIBIO 1
#define HAVE_PPOLL 1
#define HAVE_PSELECT 1
+#define HAVE_OFFSETOF 1
+#include <stddef.h>
#endif
#if defined(OS_ANDROID)
View
0 include/serval/platform_tcpip.h 100755 → 100644
File mode changed.
View
0 include/serval/skbuff.h 100755 → 100644
File mode changed.
View
0 include/serval/sock.h 100755 → 100644
File mode changed.
View
0 include/serval/timer.h 100755 → 100644
File mode changed.
View
6 include/serval/wait.h 100755 → 100644
@@ -16,8 +16,10 @@
#include <limits.h>
typedef struct __wait_queue wait_queue_t;
-typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, void *key);
-int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key);
+typedef int (*wait_queue_func_t)(wait_queue_t *wait,
+ unsigned mode, int flags, void *key);
+int default_wake_function(wait_queue_t *wait, unsigned mode,
+ int flags, void *key);
struct __wait_queue {
unsigned int flags;
View
0 src/Makefile.am 100755 → 100644
File mode changed.
View
0 src/javasock/Makefile.am 100755 → 100644
File mode changed.
View
0 src/javasock/Manifest.txt 100755 → 100644
File mode changed.
View
0 src/javasock/README 100755 → 100644
File mode changed.
View
0 src/javasock/java/Makefile.am 100755 → 100644
File mode changed.
View
0 src/javasock/java/serval/net/ServalDatagramPacket.java 100755 → 100644
File mode changed.
View
0 src/javasock/java/serval/net/ServalDatagramSocket.java 100755 → 100644
File mode changed.
View
0 src/javasock/java/serval/net/ServalDatagramSocketImpl.java 100755 → 100644
File mode changed.
View
0 src/javasock/java/serval/net/ServalDatagramSocketImplFactory.java 100755 → 100644
File mode changed.
View
0 src/javasock/java/serval/net/ServalServerDatagramSocket.java 100755 → 100644
File mode changed.
View
0 src/javasock/java/serval/net/ServalSocket.java 100755 → 100644
File mode changed.
View
0 src/javasock/java/serval/net/ServalSocketAddress.java 100755 → 100644
File mode changed.
View
0 src/javasock/java/serval/net/ServiceID.java 100755 → 100644
File mode changed.
View
0 src/javasock/java/serval/platform/ServalNetworkStack.java 100755 → 100644
File mode changed.
View
0 src/javasock/java/serval/test/UDPClient.java 100755 → 100644
File mode changed.
View
0 src/javasock/java/serval/test/UDPServer.java 100755 → 100644
File mode changed.
View
0 src/javasock/jni/Android.mk 100755 → 100644
File mode changed.
View
0 src/javasock/jni/JNIHelp.c 100755 → 100644
File mode changed.
View
0 src/javasock/jni/JNIHelp.h 100755 → 100644
File mode changed.
View
0 src/javasock/jni/Makefile.am 100755 → 100644
File mode changed.
View
0 src/javasock/jni/serval_platform_ServalNetworkStack.c 100755 → 100644
File mode changed.
View
0 src/javasock/jni/serval_platform_ServalNetworkStack.h 100755 → 100644
File mode changed.
View
0 src/libserval/Android.mk 100755 → 100644
File mode changed.
View
0 src/libserval/Makefile.am 100755 → 100644
File mode changed.
View
0 src/libserval/accept.cc 100755 → 100644
File mode changed.
View
0 src/libserval/accept.hh 100755 → 100644
File mode changed.
View
0 src/libserval/bind.cc 100755 → 100644
File mode changed.
View
0 src/libserval/bind.hh 100755 → 100644
File mode changed.
View
0 src/libserval/cli.cc 100755 → 100644
File mode changed.
View
0 src/libserval/cli.hh 100755 → 100644
File mode changed.
View
0 src/libserval/close.cc 100755 → 100644
File mode changed.
View
0 src/libserval/close.hh 100755 → 100644
File mode changed.
View
0 src/libserval/connect.cc 100755 → 100644
File mode changed.
View
0 src/libserval/connect.hh 100755 → 100644
File mode changed.
View
0 src/libserval/listen.cc 100755 → 100644
File mode changed.
View
0 src/libserval/listen.hh 100755 → 100644
File mode changed.
View
0 src/libserval/log.cc 100755 → 100644
File mode changed.
View
0 src/libserval/log.hh 100755 → 100644
File mode changed.
View
0 src/libserval/message.cc 100755 → 100644
File mode changed.
View
0 src/libserval/message.hh 100755 → 100644
File mode changed.
View
0 src/libserval/migrate.cc 100755 → 100644
File mode changed.
View
0 src/libserval/migrate.hh 100755 → 100644
File mode changed.
View
0 src/libserval/recv.cc 100755 → 100644
File mode changed.
View
0 src/libserval/recv.hh 100755 → 100644
File mode changed.
View
0 src/libserval/select.cc 100755 → 100644
File mode changed.
View
0 src/libserval/select.hh 100755 → 100644
File mode changed.
View
0 src/libserval/send.cc 100755 → 100644
File mode changed.
View
0 src/libserval/send.hh 100755 → 100644
File mode changed.
View
0 src/libserval/sf.cc 100755 → 100644
File mode changed.
View
0 src/libserval/socket.cc 100755 → 100644
File mode changed.
View
0 src/libserval/socket.hh 100755 → 100644
File mode changed.
View
0 src/libserval/sockio.cc 100755 → 100644
File mode changed.
View
0 src/libserval/sockio.hh 100755 → 100644
File mode changed.
View
0 src/libserval/state.cc 100755 → 100644
File mode changed.
View
0 src/libserval/state.hh 100755 → 100644
File mode changed.
View
0 src/libserval/types.h 100755 → 100644
File mode changed.
View
0 src/libstack/Android.mk 100755 → 100644
File mode changed.
View
0 src/libstack/Makefile.am 100755 → 100644
File mode changed.
View
0 src/libstack/ctrlmsg.c 100755 → 100644
File mode changed.
View
0 src/libstack/debug.h 100755 → 100644
File mode changed.
View
0 src/libstack/event.c 100755 → 100644
File mode changed.
View
0 src/libstack/event.h 100755 → 100644
File mode changed.
View
0 src/libstack/init.h 100755 → 100644
File mode changed.
View
0 src/libstack/libstack.c 100755 → 100644
File mode changed.
View
0 src/libstack/netlink.c 100755 → 100644
File mode changed.
View
0 src/libstack/unix.c 100755 → 100644
File mode changed.
View
0 src/servd/Android.mk 100755 → 100644
File mode changed.
View
121 src/servd/Makefile.am 100755 → 100644
@@ -18,12 +18,20 @@ utiltest_SOURCES = \
task.c \
poll_reactor.c
-utiltest_CPPFLAGS =-I$(top_srcdir)/include -I$(top_srcdir)/src/servd/ -I$(top_srcdir)/src/libstack -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/opt/local/include/glib-2.0
-
-utiltest_LDFLAGS =-L$(top_srcdir)/src/libstack \
+utiltest_CPPFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/servd/ \
+ -I$(top_srcdir)/src/libstack \
+ $(GLIB_CFLAGS)
+
+utiltest_LDFLAGS = \
+ -L$(top_srcdir)/src/libstack \
-L$(top_srcdir)/src/libserval \
-L$(top_srcdir)/src/servd \
- -lglib-2.0 -lpthread -lrt -lpcl
+ $(GLIB_LIBS) \
+ -lpthread \
+ -lrt \
+ -lpcl
messagetest_SOURCES = \
messaging_test.c \
@@ -40,16 +48,24 @@ messagetest_SOURCES = \
resolution_path.c \
resolver_base.c \
time_util.c
-
-
-messagetest_CPPFLAGS =-I$(top_srcdir)/include -I$(top_srcdir)/src/servd/ -I$(top_srcdir)/src/libstack -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/opt/local/include/glib-2.0
-messagetest_LDFLAGS =-L$(top_srcdir)/src/libstack \
- -L$(top_srcdir)/src/libserval -lserval \
+
+messagetest_CPPFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/servd \
+ -I$(top_srcdir)/src/libstack \
+ $(GLIB_CFLAGS)
+
+messagetest_LDFLAGS = \
+ -L$(top_srcdir)/src/libstack \
+ -L$(top_srcdir)/src/libserval \
-L$(top_srcdir)/src/servd \
- -lrt -lpcl \
- -lglib-2.0 -lpthread
-
+ -lserval \
+ -lrt \
+ -lpcl \
+ $(GLIB_LIBS) \
+ -lpthread
+
trietest_SOURCES = \
service_util.c \
time_util.c \
@@ -61,19 +77,35 @@ trietest_SOURCES = \
prefixtrie.c \
prefixtrie_test.c
-trietest_CPPFLAGS =-I$(top_srcdir)/include -I$(top_srcdir)/src/servd/ -I$(top_srcdir)/src/libstack -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/opt/local/include/glib-2.0
+trietest_CPPFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/servd \
+ -I$(top_srcdir)/src/libstack \
+ $(GLIB_CFLAGS)
-trietest_LDFLAGS =-L$(top_srcdir)/src/libstack \
+trietest_LDFLAGS = \
+ -L$(top_srcdir)/src/libstack \
-L$(top_srcdir)/src/libserval \
-L$(top_srcdir)/src/servd \
- -lglib-2.0 -lpthread -lrt -lpcl
-
-stabletest_CPPFLAGS =-I$(top_srcdir)/include -I$(top_srcdir)/src/servd/ -I$(top_srcdir)/src/libstack -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/opt/local/include/glib-2.0
-
-stabletest_LDFLAGS =-L$(top_srcdir)/src/libstack \
+ $(GLIB_LIBS) \
+ -lpthread \
+ -lrt \
+ -lpcl
+
+stabletest_CPPFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/servd \
+ -I$(top_srcdir)/src/libstack \
+ $(GLIB_CFLAGS)
+
+stabletest_LDFLAGS = \
+ -L$(top_srcdir)/src/libstack \
-L$(top_srcdir)/src/libserval \
-L$(top_srcdir)/src/servd \
- -lglib-2.0 -lpthread -lrt -lpcl
+ $(GLIB_LIBS) \
+ -lpthread \
+ -lrt \
+ -lpcl
stabletest_SOURCES = \
service_util.c \
@@ -96,13 +128,21 @@ tasktest_SOURCES = \
task.c \
poll_reactor.c \
task_test.c
-
-tasktest_CPPFLAGS =-I$(top_srcdir)/include -I$(top_srcdir)/src/servd/ -I$(top_srcdir)/src/libstack -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/opt/local/include/glib-2.0 -pthread
-tasktest_LDFLAGS =-L$(top_srcdir)/src/libstack \
+tasktest_CPPFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/servd \
+ -I$(top_srcdir)/src/libstack \
+ $(GLIB_CFLAGS)
+
+tasktest_LDFLAGS = \
+ -L$(top_srcdir)/src/libstack \
-L$(top_srcdir)/src/libserval \
-L$(top_srcdir)/src/servd \
- -lglib-2.0 -lpthread -lrt -lpcl
+ $(GLIB_LIBS) \
+ -lpthread \
+ -lrt \
+ -lpcl
servr_SOURCES = \
time_util.c \
@@ -125,11 +165,21 @@ servr_SOURCES = \
local_resolver.c \
service_router.c
-servr_CPPFLAGS =-I$(top_srcdir)/include -I$(top_srcdir)/src/libstack -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/opt/local/include/glib-2.0
-servr_LDFLAGS =-L$(top_srcdir)/src/libstack -lstack \
- -L$(top_srcdir)/src/libserval -lserval \
- -lpcl -lrt \
- -lglib-2.0 -pthread
+servr_CPPFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/libstack \
+ $(GLIB_CFLAGS)
+
+servr_LDFLAGS = \
+ -L$(top_srcdir)/src/libstack \
+ -L$(top_srcdir)/src/libserval \
+ -L/usr/local/lib \
+ -lstack \
+ -lserval \
+ -lpcl \
+ -lrt \
+ -lpthread \
+ $(GLIB_LIBS)
servd_SOURCES = \
timer.c \
@@ -151,11 +201,16 @@ noinst_HEADERS = \
ifa.h \
rtnl.h
+servd_CPPFLAGS = \
+ -I$(top_srcdir)/include \
+ -I$(top_srcdir)/src/libstack
-servd_CPPFLAGS =-I$(top_srcdir)/include -I$(top_srcdir)/src/libstack -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-servd_LDFLAGS =-L$(top_srcdir)/src/libstack -lstack \
- -L$(top_srcdir)/src/libserval -lserval \
- -pthread
+servd_LDFLAGS = \
+ -L$(top_srcdir)/src/libstack \
+ -L$(top_srcdir)/src/libserval \
+ -lstack \
+ -lserval \
+ -lpthread
clean-local:
rm -f *~
View
0 src/servd/client_resolver.c 100755 → 100644
File mode changed.
View
0 src/servd/cmwc.c 100755 → 100644
File mode changed.
View
0 src/servd/cmwc.h 100755 → 100644
File mode changed.
View
0 src/servd/debug.h 100755 → 100644
File mode changed.
View
0 src/servd/ifa.c 100755 → 100644
File mode changed.
View
0 src/servd/ifa.h 100755 → 100644
File mode changed.
View
11 src/servd/local_resolver.c 100755 → 100644
@@ -837,12 +837,14 @@ static int local_register_services(service_resolver* resolver, service_resolver*
if(address == NULL) {
/* it's a local registration*/
- printf("Resolver address count: %i\n", resolver_get_address_count(resolver));
+ printf("Resolver address count: %i\n",
+ resolver_get_address_count(resolver));
address = resolver_get_address(resolver, 0);
assert(address);
}
- LOG_DBG("Locally registering %i services @ %s with ttl %i\n", num_svc, inet_ntoa(address->net_un.un_ip), ttl);
+ LOG_DBG("Locally registering %zu services @ %s with ttl %u\n",
+ num_svc, inet_ntoa(address->net_un.un_ip), ttl);
int count = 0;
int rcount = 0;
@@ -979,7 +981,8 @@ static int local_unregister_services(service_resolver* resolver, service_resolve
assert(address);
}
- LOG_DBG("Locally unregistering %i services @ %s\n", num_svc, inet_ntoa(address->net_un.un_ip));
+ LOG_DBG("Locally unregistering %zu services @ %s\n",
+ num_svc, inet_ntoa(address->net_un.un_ip));
int count = 0;
int rcount = 0;
@@ -1067,7 +1070,7 @@ static int local_query_services(service_resolver* resolver, service_resolver* pe
assert(resolver);
struct sv_local_resolver* lres = (struct sv_local_resolver*) resolver;
- LOG_DBG("Locally querying %i services\n", num_svc);
+ LOG_DBG("Locally querying %zu services\n", num_svc);
size_t count = 0;
int rcount = 0;
View
0 src/servd/message_channel.h 100755 → 100644
File mode changed.
View
4 src/servd/message_channel_base.c 100755 → 100644
@@ -12,8 +12,8 @@
#include <unistd.h>
#include <pthread.h>
-#include "serval/platform.h"
-#include "serval/atomic.h"
+#include <serval/platform.h>
+#include <serval/atomic.h>
#include "debug.h"
#include "service_util.h"
#include "task.h"
View
0 src/servd/message_channel_base.h 100755 → 100644
File mode changed.
View
4 src/servd/messaging_test.c 100755 → 100644
@@ -89,7 +89,7 @@ static int test_recv_message(message_channel_callback* cb, const void* message,
if(cb->target == &test_cb1) {
LOG_DBG(
- "Receiving message for channel 1: %s of size %i\n",
+ "Receiving message for channel 1: %s of size %zu\n",
service_id_to_str(
&((const struct sockaddr_sv*) channel1->interface->
get_local_address(channel1, &addrlen))->sv_srvid),
@@ -97,7 +97,7 @@ static int test_recv_message(message_channel_callback* cb, const void* message,
channel1_recv++;
} else if(cb->target == &test_cb2) {
LOG_DBG(
- "Receiving message for channel 2: %s of size %i\n",
+ "Receiving message for channel 2: %s of size %zu\n",
service_id_to_str(
&((const struct sockaddr_sv*) channel2->interface->
get_local_address(channel2, &addrlen))->sv_srvid),
View
7 src/servd/netlink_message_channel.c 100755 → 100644
@@ -351,7 +351,7 @@ static int netlink_send_iov(message_channel* channel, struct iovec* iov, size_t
}
struct sv_netlink_message_channel* nchannel = (struct sv_netlink_message_channel *) channel;
- LOG_DBG("Sending NETLINK %i byte message to the local stack\n", datalen);
+ LOG_DBG("Sending NETLINK %zu byte message to the local stack\n", datalen);
struct iovec* vec = (struct iovec*) malloc((veclen + 1) * sizeof(*vec));
struct nlmsghdr nh;
@@ -425,7 +425,7 @@ static int netlink_send(message_channel* channel, void *message, size_t datalen)
assert(channel);
struct sv_netlink_message_channel* nchannel = (struct sv_netlink_message_channel *) channel;
- LOG_DBG("Sending NETLINK %i byte message to the local stack\n", datalen);
+ LOG_DBG("Sending NETLINK %zu byte message to the local stack\n", datalen);
struct nlmsghdr nh;
struct iovec iov[2] = { { (void *) &nh, sizeof(nh) }, { (void *) message, datalen } };
@@ -450,7 +450,8 @@ static int netlink_recv(message_channel* channel, const void *message, size_t da
struct sv_netlink_message_channel* nchannel = (struct sv_netlink_message_channel *) channel;
struct nlmsghdr* nlm;
int num_msgs = 0;
- LOG_DBG("Received NETLINK %i byte message from the local stack\n", datalen);
+ LOG_DBG("Received NETLINK %zu byte message from the local stack\n",
+ datalen);
for (nlm = (struct nlmsghdr *) message; NLMSG_OK(nlm, (unsigned int) datalen); nlm
= NLMSG_NEXT(nlm, datalen)) {
struct nlmsgerr *nlmerr = NULL;
View
0 src/servd/poll_reactor.c 100755 → 100644
File mode changed.
View
0 src/servd/poll_reactor.h 100755 → 100644
File mode changed.
View
42 src/servd/prefixtrie.c 100755 → 100644
@@ -2035,11 +2035,14 @@ int prefix_trie_has_key(struct prefix_trie_struct* trie, uint8_t* key, uint16_t
void print_trie(struct prefix_trie_struct* trie) {
assert(trie);
- printf(
- "Trie: key_len=%u count=%u node_count=%u def_value=%u fill_factor=%f branch_fill=%u shortest=%u max_depth=%u\n",
- (uint32_t) trie->key_len, (uint32_t) trie->count, (uint32_t) trie->node_count,
- (uintptr_t) trie->def_value, trie->fill_factor, trie->branch_fill, trie->shortest,
- (uint32_t) trie->max_depth);
+ printf("Trie: key_len=%zu count=%zu node_count=%zu def_value=%p fill_factor=%f branch_fill=%u shortest=%u max_depth=%zu\n",
+ trie->key_len, trie->count,
+ trie->node_count,
+ trie->def_value,
+ trie->fill_factor,
+ trie->branch_fill,
+ trie->shortest,
+ trie->max_depth);
struct prefix_trie_iter iter;
_prefix_trie_iter_init(&iter, trie, TRUE);
@@ -2066,8 +2069,9 @@ char* print_trie_data(struct prefix_trie_data* dnode) {
int bytes = dnode->len / 8 + (dnode->len % 8 > 0 ? 1 : 0);
__hexdump(dnode->key, bytes, keybuf, 128);
- snprintf(outbuf, 128, "%s:%u:%u:%i:%u:%u", keybuf, dnode->len, dnode->shortest,
- dnode->ref_count, (uintptr_t) dnode->data, (uintptr_t) dnode->prefix);
+ snprintf(outbuf, 128, "%s:%d:%d:%i:%p:%p",
+ keybuf, dnode->len, dnode->shortest,
+ dnode->ref_count, dnode->data, dnode->prefix);
return outbuf;
}
@@ -2081,9 +2085,10 @@ char* print_trie_node(struct prefix_trie_node* node, uint8_t offset) {
int bytes = (offset + node->skip) / 8 + ((offset + node->skip) % 8 > 0 ? 1 : 0);
__hexdump(node->key, bytes, keybuf, 128);
- snprintf(outbuf, 128, "%s:%u(%u):%u:%u:%u:%u:%u", keybuf, offset + node->skip, node->skip,
- node->shortest, get_branch_bits(node), get_branch_fill(node), get_branch_full(node),
- (uintptr_t) node->prefix);
+ snprintf(outbuf, 128, "%s:%u(%u):%u:%u:%u:%d:%p",
+ keybuf, offset + node->skip, node->skip,
+ node->shortest, get_branch_bits(node),
+ get_branch_fill(node), get_branch_full(node), node->prefix);
return outbuf;
}
@@ -2113,13 +2118,13 @@ static void _prefix_trie_iter_init(struct prefix_trie_iter* iter, struct prefix_
char buffer[128];
while(fnode == NULL) {
int i = 0;
- for(; i < inode->limit; i++) {
+ for (; i < inode->limit; i++) {
if(inode->branches[i]) {
inode->branch = i;
dnode = inode->branches[i];
- if(trie_get_type(dnode) == PREFIX_TRIE_TYPE_DATA) {
+ if (trie_get_type(dnode) == PREFIX_TRIE_TYPE_DATA) {
fnode = dnode;
} else {
node = (struct prefix_trie_node*) dnode;
@@ -2128,18 +2133,17 @@ static void _prefix_trie_iter_init(struct prefix_trie_iter* iter, struct prefix_
}
}
- if(fnode == NULL && node == NULL) {
+ if (fnode == NULL && node == NULL)
break;
- }
- if(node) {
+ if (node) {
total_len += level_bits + node->skip;
level_bits = get_branch_bits(node);
+
+ nnode = create_iter_node(total_len,
+ (struct prefix_trie_data**) (((uint8_t*) node) + sizeof(*node)), 0, inode->level + 1, node, inode);
- nnode = create_iter_node(total_len, (struct prefix_trie_data**) (((uint8_t*) node)
- + sizeof(*node)), 0, inode->level + 1, node, inode);
-
- if(print_out) {
+ if (print_out) {
memset(buffer, ' ', inode->level);
buffer[inode->level] = 0;
printf("%snode(%u): %s\n", buffer, inode->branch, print_trie_node(node, nnode->len
View
0 src/servd/prefixtrie.h 100755 → 100644
File mode changed.
View
2 src/servd/prefixtrie_test.c 100755 → 100644
@@ -133,6 +133,7 @@ static int spec_service_ids() {
return limit;
}
+#if defined(ENABLE_NOT_USED)
static void randomize_service_ids() {
bzero(services, sizeof(struct service_id) * MAX_SERVICE_ID);
int i = 0;
@@ -165,6 +166,7 @@ static void randomize_service_ids() {
}
}
+#endif /* ENABLE_NOT_USED */
static void initialize_service_ids() {
bzero(services, sizeof(struct service_id) * MAX_SERVICE_ID);
View
16 src/servd/resolution_path.c 100755 → 100644
@@ -389,7 +389,7 @@ static int add_resolutions(resolution_path* spath, struct service_resolution* re
/* no copying, no resend */
int size = sizeof(cm) + res_count * sizeof(*resolutions);
//struct ctrlmsg_resolution* cm = (struct ctrlmsg_resolution*) malloc(size);
- LOG_DBG("Adding %i stack resolution rules, size %i, %i\n", res_count, size, sizeof(cm));
+ LOG_DBG("Adding %zu stack resolution rules, size %i, %zu\n", res_count, size, sizeof(cm));
//cm.xid = atomic_add_return(1, &spath->request_xid);
bzero(&cm, sizeof(cm));
@@ -425,6 +425,7 @@ static int add_resolutions(resolution_path* spath, struct service_resolution* re
return sent;
}
+#if defined(ENABLE_DISABLED)
static int _add_resolutions(resolution_path* spath, struct service_resolution* resolutions,
size_t res_count) {
assert(spath);
@@ -480,6 +481,7 @@ static int _remove_resolutions(resolution_path* spath, struct service_resolution
return 0;
}
+#endif /* ENABLE_DISABLED */
static int add_resolutions_async(resolution_path* path, struct service_resolution* resolutions,
size_t res_count, resolution_path_callback callback) {
@@ -509,7 +511,7 @@ static int remove_resolutions(resolution_path* spath, struct service_resolution_
/* no copying, no resend */
int size = sizeof(cm) + res_count * sizeof(*resolutions);
//struct ctrlmsg_resolution* cm = (struct ctrlmsg_resolution*) malloc(size);
- LOG_DBG("Removing %i stack resolution rules, size %i, %i\n", res_count, size, sizeof(cm));
+ LOG_DBG("Removing %zu stack resolution rules, size %i, %zu\n", res_count, size, sizeof(cm));
//cm.xid = atomic_add_return(1, &spath->request_xid);
bzero(&cm, sizeof(cm));
@@ -587,7 +589,7 @@ static int modify_resolutions(resolution_path* spath, struct service_resolution*
return 0;
}
- LOG_DBG("Modifying %i stack resolution rules\n", res_count);
+ LOG_DBG("Modifying %zu stack resolution rules\n", res_count);
/* no copying, no resend */
struct ctrlmsg_resolution cm;
@@ -602,7 +604,7 @@ static int modify_resolutions(resolution_path* spath, struct service_resolution*
/* no copying, no resend */
int size = sizeof(cm) + res_count * sizeof(*resolutions);
//struct ctrlmsg_resolution* cm = (struct ctrlmsg_resolution*) malloc(size);
- LOG_DBG("Modifying %i stack resolution rules, size %i, %i\n", res_count, size, sizeof(cm));
+ LOG_DBG("Modifying %zu stack resolution rules, size %i, %zu\n", res_count, size, sizeof(cm));
//cm.xid = atomic_add_return(1, &spath->request_xid);
bzero(&cm, sizeof(cm));
@@ -685,7 +687,7 @@ static void handle_resolution_removed(resolution_path* spath, struct ctrlmsg_res
LOG_DBG("Handling resolution removed: %i\n", rcount);
if(rcount <= 0) {
- LOG_ERR("Invalid resolution stats in remove message! len: %u / %u\n", length, sizeof(struct service_resolution_stat));
+ LOG_ERR("Invalid resolution stats in remove message! len: %zu / %zu\n", length, sizeof(struct service_resolution_stat));
}
if(spath->path.path_callback.target) {
@@ -706,14 +708,14 @@ static void handle_resolution_added(resolution_path* spath, struct ctrlmsg_resol
size_t length) {
assert(spath);
/*DO NOTHING for now - may need to verify actual resolutions added TODO*/
- LOG_DBG("Handling resolution added: %i\n", CTRL_NUM_SERVICES(message,length));
+ LOG_DBG("Handling resolution added: %zu\n", CTRL_NUM_SERVICES(message,length));
}
static void handle_resolution_modified(resolution_path* spath, struct ctrlmsg_resolution* message,
size_t length) {
/*DO NOTHING for now TODO*/
assert(spath);
- LOG_DBG("Handling resolution modified: %i\n", length);
+ LOG_DBG("Handling resolution modified: %zu\n", length);
}
static int resolution_path_message_channel_cb(message_channel_callback* cb, const void* message,
View
0 src/servd/resolution_path.h 100755 → 100644
File mode changed.
View
0 src/servd/resolver.h 100755 → 100644
File mode changed.
View
2 src/servd/resolver_base.c 100755 → 100644
@@ -21,6 +21,7 @@ static void destroy_service_desc(void* value) {
free(sdesc);
}
+/*
static void destroy_net_addr(void* value) {
if(value == NULL) {
return;
@@ -29,6 +30,7 @@ static void destroy_net_addr(void* value) {
struct net_addr* addr = (struct net_addr*) value;
free(addr);
}
+*/
void init_base_resolver(struct sv_base_service_resolver *base) {
assert(base);
View
0 src/servd/resolver_base.h 100755 → 100644
File mode changed.
View
5 src/servd/resolver_messaging.c 100755 → 100644
@@ -9,6 +9,7 @@
#include <assert.h>
#include <limits.h>
#include <glib.h>
+#include <inttypes.h>
#include "resolver_messaging.h"
@@ -627,7 +628,7 @@ static void expire_client_requests(resolver_rpc* bm, uint64_t curtime, struct rp
LOG_ERR("Error on message send! %s", strerror(errno));
}
}
- LOG_DBG("Re-issued %i rpc requests at: %llu mintime: %llu", count, curtime, mintime);
+ LOG_DBG("Re-issued %i rpc requests at: %" PRIu64 " mintime: %" PRIu64 " ", count, curtime, mintime);
g_ptr_array_free(resend, TRUE);
}
@@ -674,7 +675,7 @@ static int check_resolver_message(resolver_rpc* bm, struct sv_control_header* me
//sanity check the length
if(len != mlen) {
- LOG_ERR("Invalid serval message length: %i != %u", len, mlen);
+ LOG_ERR("Invalid serval message length: %zu != %u", len, mlen);
//drop the packet
return 0;
}
View
0 src/servd/resolver_messaging.h 100755 → 100644
File mode changed.
View
0 src/servd/rtnl.c 100755 → 100644
File mode changed.
View
0 src/servd/rtnl.h 100755 → 100644
File mode changed.
View
0 src/servd/servd.c 100755 → 100644
File mode changed.
View
0 src/servd/server_resolver.c 100755 → 100644
File mode changed.
View
0 src/servd/server_resolver.h 100755 → 100644
File mode changed.
View
35 src/servd/service_router.c 100755 → 100644
@@ -261,7 +261,21 @@ static int parse_service_desc(char* sid_str, struct sockaddr_sv* service) {
return 0;
}
-static int load_config(const char* config_path) {
+static int load_config(const char* config_path)
+{
+ char line_buffer[1024];
+ char* temp;
+ service_resolver* peer = NULL;
+ GPtrArray* peer_list;
+ FILE* config_file;
+ struct sv_instance_addr peer_addr;
+ char sid_str[96];
+ char addr_str[96];
+ uint32_t capabilities = 0;
+ uint32_t capacity = 0;
+ uint32_t relation = 0;
+ int tok_read = 0;
+
//#peerSID peerAddress peerCapabilities peerCapacity peerRelation
//first entry is always the local resolver - peerRelation = SELF
if(!config_path) {
@@ -269,32 +283,20 @@ static int load_config(const char* config_path) {
}
LOG_DBG("Loading config file: %s\n", config_path);
- FILE* config_file = fopen(config_path, "r");
+ config_file = fopen(config_path, "r");
if(!config_file) {
return -1;
}
- char line_buffer[1024];
- char* temp;
- service_resolver* peer = NULL;
- GPtrArray* peer_list = g_ptr_array_new();
-
- char sid_str[96];
- char addr_str[96];
+ peer_list = g_ptr_array_new();
- struct sv_instance_addr peer_addr;
bzero(&peer_addr, sizeof(peer_addr));
peer_addr.service.sv_family = AF_SERVAL;
peer_addr.service.sv_prefix_bits = 255;
peer_addr.address.sin.sin_family = AF_INET;
- uint32_t capabilities = 0;
- uint32_t capacity = 0;
- uint32_t relation = 0;
-
- int tok_read = 0;
while(fgets(line_buffer, 1024, config_file)) {
temp = strchr(line_buffer, '#');
@@ -348,7 +350,8 @@ static int load_config(const char* config_path) {
}
if(ferror(config_file)) {
- LOG_ERR("Error reading peer config file %s: %s\n", config_file, strerror(errno));
+ LOG_ERR("Error reading peer config file %s: %s\n",
+ config_path, strerror(errno));
goto error;
}
View
0 src/servd/service_table.c 100755 → 100644
File mode changed.
View
0 src/servd/service_table.h 100755 → 100644
File mode changed.
View
2 src/servd/service_table_test.c 100755 → 100644
@@ -274,7 +274,7 @@ static void test_service_table() {
print_trie(&table.service_trie);
}
- printf("total iterations: %i table size: %i unique refs: %i\n", i, service_table_size(&table),
+ printf("total iterations: %i table size: %zu unique refs: %i\n", i, service_table_size(&table),
UNIQUE_SERVICE_REFERENCES);
assert(i == service_table_size(&table));
View
0 src/servd/service_types.c 100755 → 100644
File mode changed.
View
0 src/servd/service_types.h 100755 → 100644
File mode changed.
View
0 src/servd/service_util.c 100755 → 100644
File mode changed.
View
0 src/servd/service_util.h 100755 → 100644
File mode changed.
View
23 src/servd/task.c 100755 → 100644
@@ -124,9 +124,11 @@ static inline void* create_coroutine_stack(int size) {
return stack;
}
+
static inline char* print_task(struct co_task* task, char* buffer, int len) {
- snprintf(buffer, len, "task: handle(%li):runner(%li):state(%i):stacksize(%i)\n", task->handle,
- task->runner, atomic_read(&task->state), task->stack.ss_size);
+ snprintf(buffer, len, "task: handle(%li):runner(%li):"
+ "state(%i):stacksize(%zu)\n", task->handle,
+ task->runner, atomic_read(&task->state), task->stack.ss_size);
return buffer;
}
@@ -134,7 +136,8 @@ static inline char* print_task(struct co_task* task, char* buffer, int len) {
static inline void _task_block(int fd, int flags, struct co_task* task) {
if(flags & FD_ALL) {
- pr_set_interest(&reactor, fd, reactor_execute, task, reactor_execute, task,
+ pr_set_interest(&reactor, fd, reactor_execute, task,
+ reactor_execute, task,
reactor_execute, task);
} else {
@@ -152,7 +155,7 @@ static inline void _task_block(int fd, int flags, struct co_task* task) {
static void destroy_task(struct co_task* task, int del_coro) {
assert(task);
- char buffer[128];
+ //char buffer[128];
//LOG_DBG("destroying task: %s\n", print_task(task, buffer, 128));
if(del_coro) {
co_delete(task->task);
@@ -467,7 +470,7 @@ static void add_task_to_work_queue(struct co_task* task) {
goto out;
}
- char buffer[128];
+ //char buffer[128];
//LOG_DBG("WORKER THREAD %i adding task to work queue(%i): %s\n", (int) pthread_self(),
// task_queue.task_count, print_task(task, buffer, 128));
atomic_set(&task->state, TASK_QUEUED);
@@ -740,7 +743,7 @@ static struct co_task* create_task(void* data, task_func tfunc) {
/*add to task table */
g_hash_table_insert(task_set.task_table, &task->handle, task);
- char buffer[128];
+ //char buffer[128];
//LOG_DBG("created task(%i): %s\n", g_hash_table_size(task_set.task_table), print_task(task,
// buffer, 128));
@@ -811,7 +814,7 @@ int task_free_count() {
void task_yield() {
struct co_task* task = (struct co_task*) co_get_data(co_current());
- char buffer[128];
+ //char buffer[128];
//LOG_DBG("yielding task: %s\n", print_task(task, buffer, 128));
add_task_to_work_queue(task);
@@ -912,7 +915,7 @@ task_handle_t add_task_block(int fd, int flags, void* data, task_func tfunc) {
assert(tfunc);
struct co_task* task = create_task(data, tfunc);
- char buffer[128];
+ //char buffer[128];
//LOG_DBG("adding task block on fd: %i, flags: %i, task: %s\n", flags, fd, print_task(task,
// buffer, 128));
@@ -955,7 +958,7 @@ void task_sleep(int ms) {
assert(ms >= 0);
struct co_task* task = (struct co_task*) co_get_data(co_current());
- char buffer[128];
+ //char buffer[128];
//LOG_DBG("task sleep for %ims task: %s\n", ms, print_task(task, buffer, 128));
if(atomic_read(&task->finalize) == TRUE) {
@@ -985,7 +988,7 @@ int task_kill(task_handle_t handle, int signal) {
retval = ESRCH;
goto out;
}
- char buffer[128];
+ //char buffer[128];
//LOG_DBG("killing task: %s\n", print_task(task, buffer, 128));
/*this may be strange, but for now, only deliver signals to running tasks*/
View
1 src/servd/task.h 100755 → 100644
@@ -112,6 +112,7 @@ enum task_block {
FD_READ = 1 << 0, FD_WRITE = 1 << 1, FD_ERROR = 1 << 2, FD_ALL = 1 << 3
};
+int task_free_count();
void task_yield();
void task_block(int fd, int flags);
task_handle_t add_task_block(int fd, int flags, void* data, task_func tfunc);
View
2 src/servd/task_test.c 100755 → 100644
@@ -44,7 +44,7 @@ static task_mutex test_mutex;
static task_rwlock test_rwlock;
static int cond_count = 0;
static int yield_count = 0;
-static int join_count = 0;
+/* static int join_count = 0; */
struct test_task {
int id;
View
0 src/servd/time_util.c 100755 → 100644
File mode changed.
View
0 src/servd/time_util.h 100755 → 100644
File mode changed.
View
0 src/servd/timer.c 100755 → 100644
File mode changed.
View
0 src/servd/timer.h 100755 → 100644
File mode changed.
View
10 src/servd/udp_message_channel.c 100755 → 100644
@@ -432,7 +432,7 @@ static int message_dispatch_initialize(struct sv_udp_message_dispatch* dispatch)
dispatch->buffer = (char*) malloc(dispatch->buffer_len);
if(dispatch->buffer == NULL) {
- LOG_ERR("Could not allocate udp dispatch buffer: %u", dispatch->buffer_len);
+ LOG_ERR("Could not allocate udp dispatch buffer: %zu", dispatch->buffer_len);
return -1;
}
bzero(dispatch->buffer, dispatch->buffer_len);
@@ -694,13 +694,13 @@ static int udp_send_iov(message_channel* channel, struct iovec* iov, size_t vecl
//sanity check the length
if(len > MAX_UDP_PACKET) {
//should have been packetized at upper layers into multiple messages
- LOG_ERR("UDP message length exceeds max udp packet: %i", len);
+ LOG_ERR("UDP message length exceeds max udp packet: %zu", len);
return -1;
}
struct sv_udp_message_channel* uchannel = (struct sv_udp_message_channel*) channel;
- LOG_DBG("Sending UDP %i byte message to %s\n", len, service_id_to_str(&uchannel->remote.service.sv_srvid));
+ LOG_DBG("Sending UDP %zu byte message to %s\n", len, service_id_to_str(&uchannel->remote.service.sv_srvid));
struct msghdr mh = { &uchannel->remote, uchannel->remote_len, iov, veclen, NULL, 0, 0 };
//return ;
int retval = -1;
@@ -739,7 +739,7 @@ static int udp_send(message_channel* channel, void* message, size_t len) {
//sanity check the length
if(len > MAX_UDP_PACKET) {
//should have been packetized at upper layers into multiple messages
- LOG_ERR("UDP message length exceeds max udp packet: %i", len);
+ LOG_ERR("UDP message length exceeds max udp packet: %zu", len);
return -1;
}
@@ -749,7 +749,7 @@ static int udp_send(message_channel* channel, void* message, size_t len) {
}
struct sv_udp_message_channel* uchannel = (struct sv_udp_message_channel*) channel;
- LOG_DBG("Sending UDP %i byte message to %s @ %s, sockaddr len %i\n", len,
+ LOG_DBG("Sending UDP %zu byte message to %s @ %s, sockaddr len %zu\n", len,
service_id_to_str(&uchannel->remote.service.sv_srvid), inet_ntoa(uchannel->remote.address.sin.sin_addr),
uchannel->remote_len);
View
4 src/servd/unix_message_channel.c 100755 → 100644
@@ -239,7 +239,7 @@ static int unix_send(message_channel* channel, void *message, size_t datalen) {
return 0;
}
- LOG_DBG("Sending UNIX %i byte message to the local stack\n", datalen);
+ LOG_DBG("Sending UNIX %zu byte message to the local stack\n", datalen);
struct sv_unix_message_channel* uchannel = (struct sv_unix_message_channel*) channel;
@@ -274,7 +274,7 @@ static int unix_send_iov(message_channel* channel, struct iovec* iov, size_t vec
return 0;
}
- LOG_DBG("Sending UNIX %i byte message to the local stack\n", datalen);
+ LOG_DBG("Sending UNIX %zu byte message to the local stack\n", datalen);
struct sv_unix_message_channel* uchannel = (struct sv_unix_message_channel*) channel;
struct msghdr mh = { &uchannel->peer, sizeof(uchannel->peer), iov, veclen, NULL, 0, 0 };
View
12 src/servd/util_test.c 100755 → 100644
@@ -63,7 +63,7 @@ static void* test_time(void* data) {
/*schedule every second*/
long long int ctime = get_current_time_ms();
int elapsed = 0;
- printf("Initial time: %llu\n", (uint64_t) ctime);
+ printf("Initial time: %llu\n", ctime);
/*first check: 50 ms should be the same*/
@@ -72,7 +72,7 @@ static void* test_time(void* data) {
long long int ntime = get_current_time_ms();
assert(ntime == ctime);
- printf("Time after %i (50 ms): %llu\n", elapsed, (uint64_t) ctime);
+ printf("Time after %i (50 ms): %llu\n", elapsed, ctime);
/*give it 1.05 s*/
elapsed += thread_sleep(1050);
@@ -80,7 +80,7 @@ static void* test_time(void* data) {
assert(ntime - ctime > 0);
ctime = ntime;
- printf("Time after %i (1100 ms): %llu\n", elapsed, (uint64_t) ctime);
+ printf("Time after %i (1100 ms): %llu\n", elapsed, ctime);
/* rev up the avg resolutions/tick */
int i = 0;
@@ -90,11 +90,11 @@ static void* test_time(void* data) {
assert(ntime == ctime);
}
- printf("Time after %i (1400ms): %llu\n", elapsed, (uint64_t) ctime);
+ printf("Time after %i (1400ms): %llu\n", elapsed, ctime);
elapsed += thread_sleep(1000);
- printf("Time after %i (2400ms): %llu\n", elapsed, (uint64_t) ctime);
+ printf("Time after %i (2400ms): %llu\n", elapsed, ctime);
ntime = get_current_time_ms();
assert(ntime - ctime > 0);
@@ -103,7 +103,7 @@ static void* test_time(void* data) {
ntime = get_current_time_ms();
assert(ntime - ctime > 0);
- printf("Time after %i (7400ms): %llu\n", elapsed, (uint64_t) ctime);
+ printf("Time after %i (7400ms): %llu\n", elapsed, ctime);
return NULL;
}
View
0 src/stack/Android.mk 100755 → 100644
File mode changed.
View
0 src/stack/Kbuild.in 100755 → 100644
File mode changed.
View
0 src/stack/Makefile.am 100755 → 100644
File mode changed.
View
0 src/stack/af_serval.c 100755 → 100644
File mode changed.
View
0 src/stack/af_serval.h 100755 → 100644
File mode changed.
View
0 src/stack/bst.c 100755 → 100644
File mode changed.
View
0 src/stack/bst.h 100755 → 100644
File mode changed.
View
0 src/stack/ctrl.h 100755 → 100644
File mode changed.
View
313 src/stack/ctrl_handler.c 100755 → 100644
@@ -58,42 +58,52 @@ static int ctrl_handle_add_service_msg(struct ctrlmsg *cm)
struct net_device* dev = NULL;
int err = 0;
-#if defined(ENABLE_DEBUG)
- //char ipstr[20];
- LOG_DBG("adding %i services, msg size %i,res size %i\n", num_res, sizeof(*cmr), cmr->cmh.len - sizeof(*cmr));
-#endif
-
- for(i = 0; i < num_res;i++) {
- res = &cmr->resolution[i];
- if (res->sv_prefix_bits > (sizeof(res->srvid)*8)) {
- res->sv_prefix_bits = (uint8_t) (sizeof(res->srvid) * 8);
- }
-
- dev = dev_get_by_index(NULL, res->if_index);
+ LOG_DBG("adding %i services, msg size %i,res size %i\n",
+ num_res, sizeof(*cmr), cmr->cmh.len - sizeof(*cmr));
- LOG_DBG("Adding service id: %s(%i) @ address %i, priority %i, weight %i\n", service_id_to_str(&res->srvid), res->sv_prefix_bits, res->address.net_un.un_ip.s_addr, res->priority, res->weight);
- err = service_add(&res->srvid, res->sv_prefix_bits, res->sv_flags, res->priority, res->weight,
- &res->address, sizeof(res->address),
- dev, GFP_KERNEL);
+ for (i = 0; i < num_res;i++) {
+ res = &cmr->resolution[i];
+ if (res->sv_prefix_bits > (sizeof(res->srvid)*8)) {
+ res->sv_prefix_bits = (uint8_t)(sizeof(res->srvid) * 8);
+ }
- if(err > 0) {
- if(index < i) {
- /*copy it over */
- memcpy(&cmr->resolution[index], res, sizeof(*res));
+ dev = dev_get_by_index(NULL, res->if_index);
+
+ LOG_DBG("Adding service id: %s(%i) "
+ "@ address %i, priority %i, weight %i\n",
+ service_id_to_str(&res->srvid),
+ res->sv_prefix_bits,
+ res->address.net_un.un_ip.s_addr,
+ res->priority, res->weight);
+
+ err = service_add(&res->srvid,
+ res->sv_prefix_bits,
+ res->sv_flags,
+ res->priority,
+ res->weight,
+ &res->address,
+ sizeof(res->address),
+ dev, GFP_KERNEL);
+
+ if (err > 0) {
+ if (index < i) {
+ /*copy it over */
+ memcpy(&cmr->resolution[index],
+ res, sizeof(*res));
+ }
+ index++;
+ } else {
+ LOG_ERR("Error adding service: %i\n", err);
}
- index++;
- }
- else {
- LOG_ERR("Error adding service: %i\n", err);
- }
}
cm->len = sizeof(*cmr) + index * sizeof(struct service_resolution);
ctrl_sendmsg(cm, GFP_KERNEL);
+
return 0;
}
-
+#if defined(ENABLE_DISABLED)
static int _ctrl_handle_add_service_msg(struct ctrlmsg *cm)
{
struct ctrlmsg_service *cms = (struct ctrlmsg_service *)cm;
@@ -109,11 +119,13 @@ static int _ctrl_handle_add_service_msg(struct ctrlmsg *cm)
cms->prefix_bits = sizeof(cms->srvid) * 8;
}
- return service_add(&cms->srvid, cms->prefix_bits, 0, LOCAL_SERVICE_DEFAULT_PRIORITY, LOCAL_SERVICE_DEFAULT_WEIGHT,
+ return service_add(&cms->srvid, cms->prefix_bits, 0,
+ LOCAL_SERVICE_DEFAULT_PRIORITY,
+ LOCAL_SERVICE_DEFAULT_WEIGHT,
&cms->ipaddr, sizeof(cms->ipaddr),
NULL, GFP_KERNEL);
}
-
+#endif
static int ctrl_handle_del_service_msg(struct ctrlmsg *cm)
{
@@ -143,47 +155,50 @@ static int ctrl_handle_del_service_msg(struct ctrlmsg *cm)
LOG_DBG("deleting %i services\n", num_res);
#endif
- for(i = 0; i < num_res;i++) {
- sres = &stats[i];
+ for (i = 0; i < num_res;i++) {
+ sres = &stats[i];
- if (sres->res.sv_prefix_bits > (sizeof(sres->res.srvid)*8)) {
- sres->res.sv_prefix_bits = (uint8_t) (sizeof(sres->res.srvid) * 8);
- }
-
- if (memcmp(&sres->res.address, &null_ip, sizeof(sres->res.address)) != 0) {
- ip = &sres->res.address.net_un.un_ip;
- }
-
- se = service_find(&sres->res.srvid, sres->res.sv_prefix_bits);
-
- if(!se)
- continue;
-
-
- memset(&dstat, 0, sizeof(dstat));
- err = service_entry_remove_dest(se, ip, ip ? sizeof(sres->res.address) : 0, &dstat);
+ if (sres->res.sv_prefix_bits > (sizeof(sres->res.srvid)*8)) {
+ sres->res.sv_prefix_bits = (uint8_t) (sizeof(sres->res.srvid) * 8);
+ }
- if(err > 0) {
- //sres = &stats[j++];
- //memcpy(&sres->res, res, sizeof(*res));
- sres->duration_sec = dstat.duration_sec;
- sres->duration_nsec = dstat.duration_nsec;
- //tokens too?
- sres->packets_resolved = dstat.packets_resolved;
- sres->bytes_resolved = dstat.bytes_resolved;
- sres->packets_dropped = dstat.packets_dropped;
- sres->bytes_dropped = dstat.packets_dropped;
+ if (memcmp(&sres->res.address, &null_ip,
+ sizeof(sres->res.address)) != 0) {
+ ip = &sres->res.address.net_un.un_ip;
+ }
- if(index < i) {
- memcpy(&stats[index], sres, sizeof(*sres));
+ se = service_find(&sres->res.srvid, sres->res.sv_prefix_bits);
+
+ if (!se)
+ continue;
+
+
+ memset(&dstat, 0, sizeof(dstat));
+ err = service_entry_remove_dest(se, ip, ip ?
+ sizeof(sres->res.address) : 0,
+ &dstat);
+
+ if (err > 0) {
+ //sres = &stats[j++];
+ //memcpy(&sres->res, res, sizeof(*res));
+ sres->duration_sec = dstat.duration_sec;
+ sres->duration_nsec = dstat.duration_nsec;
+ //tokens too?
+ sres->packets_resolved = dstat.packets_resolved;
+ sres->bytes_resolved = dstat.bytes_resolved;
+ sres->packets_dropped = dstat.packets_dropped;
+ sres->bytes_dropped = dstat.packets_dropped;
+
+ if (index < i) {
+ memcpy(&stats[index], sres, sizeof(*sres));
+ }
+ index++;
+ } else {
+ LOG_ERR("Could not remove service %s: %i\n",
+ service_id_to_str(&sres->res.srvid), err);
}
- index++;
- }
- else {
- LOG_ERR("Could not remove service %s: %i\n", service_id_to_str(&sres->res.srvid), err);
- }
- service_entry_put(se);
+ service_entry_put(se);
}
cm->len = sizeof(*cmr) + index * sizeof(struct service_resolution_stat);
@@ -194,9 +209,9 @@ static int ctrl_handle_del_service_msg(struct ctrlmsg *cm)
static int ctrl_handle_capabilities_msg(struct ctrlmsg *cm)
{
- struct ctrlmsg_capabilities *cmt = (struct ctrlmsg_capabilities*)cm;
- atomic_set(&serval_transit, cmt->capabilities & SVSTK_TRANSIT);
- return 0;
+ struct ctrlmsg_capabilities *cmt = (struct ctrlmsg_capabilities*)cm;
+ atomic_set(&serval_transit, cmt->capabilities & SVSTK_TRANSIT);
+ return 0;
}
static int ctrl_handle_mod_service_msg(struct ctrlmsg *cm)
@@ -216,39 +231,52 @@ static int ctrl_handle_mod_service_msg(struct ctrlmsg *cm)
LOG_DBG("modifying %i services\n", num_res);
#endif
- for(i = 0; i < num_res;i++) {
- res = &cmr->resolution[i];
- if (res->sv_prefix_bits > (sizeof(res->srvid)*8)) {
- res->sv_prefix_bits = (uint8_t) (sizeof(res->srvid) * 8);
- }
-