diff options
author | Avneesh Sachdev <avneesh@sproute.com> | 2016-04-04 19:54:55 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-09-23 18:12:16 +0200 |
commit | dad253b46d62d71b61d11cab94a7fe68acfed677 (patch) | |
tree | 1d56dee4697b11ba7c158b322fadcbeff336d38e /qpb/qpb.proto | |
parent | isisd: fix assert warning (diff) | |
download | frr-dad253b46d62d71b61d11cab94a7fe68acfed677.tar.xz frr-dad253b46d62d71b61d11cab94a7fe68acfed677.zip |
qpb: Add support for protobuf.
Infrastructure that allows protocol buffers to be used in Quagga. The
changes below comprise of:
- Build hooks
- Protobuf definitions for common types.
- Library routines for working with protobuf, including functions
that help translate between common quagga types and their protobuf
equivalents.
Changes:
* qpb/{Makefile.am,README.txt,qpb.h,.gitignore}
Add the qpb library, which provides shared code and definitions
for using protocol buffers in quagga code.
* qpb/qpb.proto
Protobuf definitions that can be shared by all of quagga.
* qpb/linear_allocator.h
An allocator that allocates memory by walking down towards the end
of a buffer. This is used to cheaply allocate/deallocate memory on
the stack for protobuf operations.
* qpb/qpb_allocator.[ch]
Thin layer that allows a linear allocator to be used with the
protobuf-c library.
* common.am
This is an automake fragment that is intended to be shared by
Makefile.am files in the tree. It currently includes definitions
related to protobuf.
* configure.ac
- Add logic to optionally build protobuf code.
By default, protobuf support is enabled if the protobuf C
compiler (protoc-c) is available, and the associated header
files/library can be found.
The user can choose to override this behavior via the new
--disable-protobuf/--enable-protobuf flags.
- Include the quagga protobuf library (qpb) in the build.
* .gitignore
Ignore source code generated by protobuf compiler.
* Makefile.am
Add 'qpb' to the list of subdirectories.
Signed-off-by: Avneesh Sachdev <avneesh@sproute.com>
Edited: Paul Jakma <paul.jakma@hpe.com>: Change the sense of the
configure enable option to require explicit specifying, as
an experimental feature.
Diffstat (limited to 'qpb/qpb.proto')
-rw-r--r-- | qpb/qpb.proto | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/qpb/qpb.proto b/qpb/qpb.proto new file mode 100644 index 000000000..7ee409df8 --- /dev/null +++ b/qpb/qpb.proto @@ -0,0 +1,121 @@ +/* + * qpb.proto + * + * @copyright Copyright (C) 2016 Sproute Networks, Inc. + * + * @author Avneesh Sachdev <avneesh@sproute.com> + * + * Permission is granted to use, copy, modify and/or distribute this + * software under either one of the licenses below. + * + * Note that if you use other files from the Quagga tree directly or + * indirectly, then the licenses in those files still apply. + * + * Please retain both licenses below when modifying this code in the + * Quagga tree. + */ + +/* + * License Option 1: GPL + * + * 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., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * License Option 2: ISC License + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted, provided + * that the above copyright notice and this permission notice appear + * in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Protobuf definitions pertaining to the Quagga Protobuf component. + */ +package qpb; + +enum AddressFamily { + UNKNOWN_AF = 0; + IPV4 = 1; // IP version 4 + IPV6 = 2; // IP version 6 +}; + +enum SubAddressFamily { + UNKNOWN_SAF = 0; + UNICAST = 1; + MULTICAST = 2; +}; + +// +// An IP version 4 address, such as 10.1.1.1. +// +message Ipv4Address { + required fixed32 value = 1 ; +}; + +message Ipv6Address { + + // 16 bytes. + required bytes bytes = 1; +}; + +// +// An IP version 4 or IP version 6 address. +// +message L3Address { + optional Ipv4Address v4 = 1; + optional Ipv6Address v6 = 2; +}; + +// +// An IP prefix, such as 10.1/16. +// We use the message below to represent both IPv4 and IPv6 prefixes. +message L3Prefix { + required uint32 length = 1; + required bytes bytes = 2; +}; + +// +// Something that identifies an interface on a machine. It can either +// be a name (for instance, 'eth0') or a number currently. +// +message IfIdentifier { + optional uint32 index = 1; + optional string name = 2; +}; + +enum Protocol { + UNKNOWN_PROTO = 0; + LOCAL = 1; + CONNECTED = 2; + KERNEL = 3; + STATIC = 4; + RIP = 5; + RIPNG = 6; + OSPF = 7; + ISIS = 8; + BGP = 9; + OTHER = 10; +}
\ No newline at end of file |