/*
 * 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;
}