aboutsummaryrefslogtreecommitdiff
path: root/include/olm/pickle.h
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2016-05-24 13:33:33 +0100
committerRichard van der Hoff <richard@matrix.org>2016-05-24 13:33:33 +0100
commit2e7800cf650197f4b8998ef8ac24d08daa316a2f (patch)
tree1f9e5e06b755f929c7bad363b77eaafdd21d706c /include/olm/pickle.h
parentb1c5732fc8c89ee9217d0f54408f860565fa01f4 (diff)
parent2fd28a66824bda7b86c08b065736009c39761987 (diff)
Merge branch 'rav/c_bindings'
Diffstat (limited to 'include/olm/pickle.h')
-rw-r--r--include/olm/pickle.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/include/olm/pickle.h b/include/olm/pickle.h
new file mode 100644
index 0000000..c1e8192
--- /dev/null
+++ b/include/olm/pickle.h
@@ -0,0 +1,50 @@
+/* Copyright 2015-2016 OpenMarket Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef OLM_PICKLE_H_
+#define OLM_PICKLE_H_
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define _olm_pickle_uint32_length(value) 4
+uint8_t * _olm_pickle_uint32(uint8_t * pos, uint32_t value);
+uint8_t const * _olm_unpickle_uint32(
+ uint8_t const * pos, uint8_t const * end,
+ uint32_t *value
+);
+
+
+#define _olm_pickle_bool_length(value) 1
+uint8_t * _olm_pickle_bool(uint8_t * pos, int value);
+uint8_t const * _olm_unpickle_bool(
+ uint8_t const * pos, uint8_t const * end,
+ int *value
+);
+
+#define _olm_pickle_bytes_length(bytes, bytes_length) (bytes_length)
+uint8_t * _olm_pickle_bytes(uint8_t * pos, uint8_t const * bytes,
+ size_t bytes_length);
+uint8_t const * _olm_unpickle_bytes(uint8_t const * pos, uint8_t const * end,
+ uint8_t * bytes, size_t bytes_length);
+
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* OLM_PICKLE_H */