From 988355d5bb62405f3bd3fbaade1f26ba4b2c274e Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Tue, 31 Jan 2017 19:55:59 +0100 Subject: lib: Add packing and unpacking RIB The rib_pack function allows packing a subtree of the RIB for dissemination. The options PACK_HASH_ROOT and PACK_HASH_ALL will add the hashes for the root object of the packed subtree or every object to the packed message respectively. Checking of the hashes is currently only performed at the top level object, verifying the complete operation. The rib_unpack function unpacks a packed message and inserts its contents in the RIB. The option UNPACK_CREATE flags that the unpack operation is allowed to create new objects, else it will only update existing objects. More advanced options could be added in the future. The packed message structure uses Google Protocol Buffers, as defined in ro.proto. It adds tests for these functions to the rib_test. --- src/lib/ro.proto | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/lib/ro.proto (limited to 'src/lib/ro.proto') diff --git a/src/lib/ro.proto b/src/lib/ro.proto new file mode 100644 index 00000000..379ccd27 --- /dev/null +++ b/src/lib/ro.proto @@ -0,0 +1,32 @@ +/* + * Ouroboros - Copyright (C) 2016 - 2017 + * + * RIB object message + * + * Dimitri Staessens + * Sander Vrijders + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +syntax = "proto2"; + +message ro_msg { + required string name = 1; + optional string parent = 2; + optional bytes data = 3; + optional bytes hash = 4; + repeated ro_msg children = 5; +} \ No newline at end of file -- cgit v1.2.3