Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ambrop72/badvpn.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/bproto
diff options
context:
space:
mode:
authorambrop7 <ambrop7@1a93d707-3861-5ebc-ad3b-9740d49b5140>2010-10-25 13:17:17 +0400
committerambrop7 <ambrop7@1a93d707-3861-5ebc-ad3b-9740d49b5140>2010-10-25 13:17:17 +0400
commit198d6cd4b88ff46f486d2777caf591d59d474fd4 (patch)
treeb3c896166be4bbdd41fe625e22a8371854efd5f8 /bproto
parent2af3ceb222cfda3c381fa1e0595085a851ef648c (diff)
Initial import
Diffstat (limited to 'bproto')
-rw-r--r--bproto/BProto.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/bproto/BProto.h b/bproto/BProto.h
new file mode 100644
index 0000000..347df37
--- /dev/null
+++ b/bproto/BProto.h
@@ -0,0 +1,64 @@
+/**
+ * @file BProto.h
+ * @author Ambroz Bizjak <ambrop7@gmail.com>
+ *
+ * @section LICENSE
+ *
+ * This file is part of BadVPN.
+ *
+ * BadVPN is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * BadVPN 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * @section DESCRIPTION
+ *
+ * Definitions for BProto serialization.
+ */
+
+#ifndef BADVPN_BPROTO_BPROTO_H
+#define BADVPN_BPROTO_BPROTO_H
+
+#include <stdint.h>
+
+#define BPROTO_TYPE_UINT8 1
+#define BPROTO_TYPE_UINT16 2
+#define BPROTO_TYPE_UINT32 3
+#define BPROTO_TYPE_UINT64 4
+#define BPROTO_TYPE_DATA 5
+#define BPROTO_TYPE_CONSTDATA 6
+
+struct BProto_header_s {
+ uint16_t id;
+ uint16_t type;
+} __attribute__((packed));
+
+struct BProto_uint8_s {
+ uint8_t v;
+} __attribute__((packed));
+
+struct BProto_uint16_s {
+ uint16_t v;
+} __attribute__((packed));
+
+struct BProto_uint32_s {
+ uint32_t v;
+} __attribute__((packed));
+
+struct BProto_uint64_s {
+ uint64_t v;
+} __attribute__((packed));
+
+struct BProto_data_header_s {
+ uint32_t len;
+} __attribute__((packed));
+
+#endif