summaryrefslogtreecommitdiff
path: root/src/libstrongswan/utils.h
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2009-03-01 10:48:08 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2009-03-01 10:48:08 +0000
commita6f902baed7abb17a1a9c014e01bb100077f8198 (patch)
tree82114e22e251e9260d9a712f1232e52e1ef494e3 /src/libstrongswan/utils.h
parent1450c9df799b0870477f6e63357f4bcb63537f4f (diff)
downloadvyos-strongswan-a6f902baed7abb17a1a9c014e01bb100077f8198.tar.gz
vyos-strongswan-a6f902baed7abb17a1a9c014e01bb100077f8198.zip
- Updated to new upstream revision.
Diffstat (limited to 'src/libstrongswan/utils.h')
-rw-r--r--src/libstrongswan/utils.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/libstrongswan/utils.h b/src/libstrongswan/utils.h
index a5900201a..b26a17b01 100644
--- a/src/libstrongswan/utils.h
+++ b/src/libstrongswan/utils.h
@@ -13,7 +13,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
- * $Id: utils.h 4632 2008-11-11 18:37:19Z martin $
+ * $Id: utils.h 4742 2008-12-03 09:45:58Z tobias $
*/
/**
@@ -225,6 +225,12 @@ void *clalloc(void *pointer, size_t size);
void memxor(u_int8_t dest[], u_int8_t src[], size_t n);
/**
+ * A variant of strstr with the characteristics of memchr, where haystack is not
+ * a null-terminated string but simply a memory area of length n.
+ */
+void *memstr(const void *haystack, const char *needle, size_t n);
+
+/**
* Creates a directory and all required parent directories.
*
* @param path path to the new directory
@@ -248,6 +254,14 @@ void nop();
*/
typedef volatile u_int refcount_t;
+
+#ifdef HAVE_GCC_ATOMIC_OPERATIONS
+
+#define ref_get(ref) {__sync_fetch_and_add(ref, 1); }
+#define ref_put(ref) (!__sync_sub_and_fetch(ref, 1))
+
+#else /* !HAVE_GCC_ATOMIC_OPERATIONS */
+
/**
* Get a new reference.
*
@@ -268,6 +282,8 @@ void ref_get(refcount_t *ref);
*/
bool ref_put(refcount_t *ref);
+#endif /* HAVE_GCC_ATOMIC_OPERATIONS */
+
/**
* Get printf hooks for time.
*