summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/charset/iconv.c2
-rw-r--r--source4/lib/db_wrap.c2
-rw-r--r--source4/lib/events/events_standard.c2
-rw-r--r--source4/lib/messaging/messaging.c2
-rw-r--r--source4/lib/registry/common/reg_interface.c2
-rw-r--r--source4/lib/socket/interface.c2
-rw-r--r--source4/lib/socket_wrapper/socket_wrapper.c2
-rw-r--r--source4/lib/stream/packet.c4
-rw-r--r--source4/lib/tdb/common/tdbutil.c2
-rw-r--r--source4/lib/tdr/config.mk1
-rw-r--r--source4/lib/util/dlinklist.h109
-rw-r--r--source4/lib/util/util.h1
-rw-r--r--source4/lib/util/util_str.c2
13 files changed, 121 insertions, 12 deletions
diff --git a/source4/lib/charset/iconv.c b/source4/lib/charset/iconv.c
index 28f102a4a0..d3aff7b24f 100644
--- a/source4/lib/charset/iconv.c
+++ b/source4/lib/charset/iconv.c
@@ -20,7 +20,7 @@
*/
#include "includes.h"
-#include "dlinklist.h"
+#include "lib/util/dlinklist.h"
#include "system/iconv.h"
#include "system/filesys.h"
diff --git a/source4/lib/db_wrap.c b/source4/lib/db_wrap.c
index 9fabd58caa..e64f4fa647 100644
--- a/source4/lib/db_wrap.c
+++ b/source4/lib/db_wrap.c
@@ -28,7 +28,7 @@
*/
#include "includes.h"
-#include "dlinklist.h"
+#include "lib/util/dlinklist.h"
#include "lib/events/events.h"
#include "lib/tdb/include/tdb.h"
#include "lib/ldb/include/ldb.h"
diff --git a/source4/lib/events/events_standard.c b/source4/lib/events/events_standard.c
index 5d59f1b885..12595d8518 100644
--- a/source4/lib/events/events_standard.c
+++ b/source4/lib/events/events_standard.c
@@ -31,7 +31,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "system/select.h" /* needed for WITH_EPOLL */
-#include "dlinklist.h"
+#include "lib/util/dlinklist.h"
#include "lib/events/events.h"
#include "lib/events/events_internal.h"
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c
index 6bd331c247..00b33017d8 100644
--- a/source4/lib/messaging/messaging.c
+++ b/source4/lib/messaging/messaging.c
@@ -24,7 +24,7 @@
#include "lib/events/events.h"
#include "system/filesys.h"
#include "messaging/messaging.h"
-#include "dlinklist.h"
+#include "lib/util/dlinklist.h"
#include "lib/socket/socket.h"
#include "librpc/gen_ndr/ndr_irpc.h"
#include "lib/messaging/irpc.h"
diff --git a/source4/lib/registry/common/reg_interface.c b/source4/lib/registry/common/reg_interface.c
index 7d65d31d0f..e0f06ef795 100644
--- a/source4/lib/registry/common/reg_interface.c
+++ b/source4/lib/registry/common/reg_interface.c
@@ -19,7 +19,7 @@
*/
#include "includes.h"
-#include "dlinklist.h"
+#include "lib/util/dlinklist.h"
#include "lib/registry/registry.h"
#include "build.h"
diff --git a/source4/lib/socket/interface.c b/source4/lib/socket/interface.c
index 5b2b4fd1ab..71b30ce757 100644
--- a/source4/lib/socket/interface.c
+++ b/source4/lib/socket/interface.c
@@ -23,7 +23,7 @@
#include "includes.h"
#include "system/network.h"
#include "lib/socket/netif.h"
-#include "dlinklist.h"
+#include "lib/util/dlinklist.h"
/** used for network interfaces */
struct interface {
diff --git a/source4/lib/socket_wrapper/socket_wrapper.c b/source4/lib/socket_wrapper/socket_wrapper.c
index 6bb7f6464f..702b192aff 100644
--- a/source4/lib/socket_wrapper/socket_wrapper.c
+++ b/source4/lib/socket_wrapper/socket_wrapper.c
@@ -37,7 +37,7 @@
#include <string.h>
#include <stdio.h>
#endif
-#include "dlinklist.h"
+#include "lib/util/dlinklist.h"
/* LD_PRELOAD doesn't work yet, so REWRITE_CALLS is all we support
* for now */
diff --git a/source4/lib/stream/packet.c b/source4/lib/stream/packet.c
index 0d14435486..2c472641cc 100644
--- a/source4/lib/stream/packet.c
+++ b/source4/lib/stream/packet.c
@@ -22,11 +22,11 @@
*/
#include "includes.h"
-#include "smb.h"
-#include "dlinklist.h"
+#include "lib/util/dlinklist.h"
#include "lib/events/events.h"
#include "lib/socket/socket.h"
#include "lib/stream/packet.h"
+#include "libcli/raw/smb.h"
struct packet_context {
packet_callback_fn_t callback;
diff --git a/source4/lib/tdb/common/tdbutil.c b/source4/lib/tdb/common/tdbutil.c
index 327555db10..1cf1eb8842 100644
--- a/source4/lib/tdb/common/tdbutil.c
+++ b/source4/lib/tdb/common/tdbutil.c
@@ -29,7 +29,7 @@
#include "system/glob.h"
#include "system/wait.h"
#include "system/filesys.h"
-#include "dlinklist.h"
+#include "lib/util/dlinklist.h"
#include "pstring.h"
/* these are little tdb utility functions that are meant to make
diff --git a/source4/lib/tdr/config.mk b/source4/lib/tdr/config.mk
index d4ad50ed1b..f0e24c54b4 100644
--- a/source4/lib/tdr/config.mk
+++ b/source4/lib/tdr/config.mk
@@ -1,4 +1,5 @@
[LIBRARY::TDR]
+CFLAGS = -Ilib/tdr
PUBLIC_HEADERS = tdr.h
VERSION = 0.0.1
SO_VERSION = 0
diff --git a/source4/lib/util/dlinklist.h b/source4/lib/util/dlinklist.h
new file mode 100644
index 0000000000..527b211cd3
--- /dev/null
+++ b/source4/lib/util/dlinklist.h
@@ -0,0 +1,109 @@
+/*
+ Unix SMB/CIFS implementation.
+ some simple double linked list macros
+ Copyright (C) Andrew Tridgell 1998
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/* To use these macros you must have a structure containing a next and
+ prev pointer */
+
+
+/* hook into the front of the list */
+#define DLIST_ADD(list, p) \
+do { \
+ if (!(list)) { \
+ (list) = (p); \
+ (p)->next = (p)->prev = NULL; \
+ } else { \
+ (list)->prev = (p); \
+ (p)->next = (list); \
+ (p)->prev = NULL; \
+ (list) = (p); \
+ }\
+} while (0)
+
+/* remove an element from a list - element doesn't have to be in list. */
+#define DLIST_REMOVE(list, p) \
+do { \
+ if ((p) == (list)) { \
+ (list) = (p)->next; \
+ if (list) (list)->prev = NULL; \
+ } else { \
+ if ((p)->prev) (p)->prev->next = (p)->next; \
+ if ((p)->next) (p)->next->prev = (p)->prev; \
+ } \
+ if ((p) != (list)) (p)->next = (p)->prev = NULL; \
+} while (0)
+
+/* promote an element to the top of the list */
+#define DLIST_PROMOTE(list, p) \
+do { \
+ DLIST_REMOVE(list, p); \
+ DLIST_ADD(list, p); \
+} while (0)
+
+/* hook into the end of the list - needs a tmp pointer */
+#define DLIST_ADD_END(list, p, type) \
+do { \
+ if (!(list)) { \
+ (list) = (p); \
+ (p)->next = (p)->prev = NULL; \
+ } else { \
+ type tmp; \
+ for (tmp = (list); tmp->next; tmp = tmp->next) ; \
+ tmp->next = (p); \
+ (p)->next = NULL; \
+ (p)->prev = tmp; \
+ } \
+} while (0)
+
+/* insert 'p' after the given element 'el' in a list. If el is NULL then
+ this is the same as a DLIST_ADD() */
+#define DLIST_ADD_AFTER(list, p, el) \
+do { \
+ if (!(list) || !(el)) { \
+ DLIST_ADD(list, p); \
+ } else { \
+ p->prev = el; \
+ p->next = el->next; \
+ el->next = p; \
+ if (p->next) p->next->prev = p; \
+ }\
+} while (0)
+
+/* demote an element to the end of the list, needs a tmp pointer */
+#define DLIST_DEMOTE(list, p, tmp) \
+do { \
+ DLIST_REMOVE(list, p); \
+ DLIST_ADD_END(list, p, tmp); \
+} while (0)
+
+/* concatenate two lists - putting all elements of the 2nd list at the
+ end of the first list */
+#define DLIST_CONCATENATE(list1, list2, type) \
+do { \
+ if (!(list1)) { \
+ (list1) = (list2); \
+ } else { \
+ type tmp; \
+ for (tmp = (list1); tmp->next; tmp = tmp->next) ; \
+ tmp->next = (list2); \
+ if (list2) { \
+ (list2)->prev = tmp; \
+ } \
+ } \
+} while (0)
diff --git a/source4/lib/util/util.h b/source4/lib/util/util.h
index 2517966d90..c7acc2ea33 100644
--- a/source4/lib/util/util.h
+++ b/source4/lib/util/util.h
@@ -22,7 +22,6 @@
#ifndef _SAMBA_UTIL_H_
#define _SAMBA_UTIL_H_
-#include "core.h"
#include "charset/charset.h"
/**
diff --git a/source4/lib/util/util_str.c b/source4/lib/util/util_str.c
index 62869198c3..163ef3828e 100644
--- a/source4/lib/util/util_str.c
+++ b/source4/lib/util/util_str.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-#include "smb.h"
+#include "libcli/raw/smb.h"
#include "pstring.h"
#include "lib/ldb/include/ldb.h"
#include "system/locale.h"