// SPDX-License-Identifier: ISC
/*
 * qpb.proto
 *
 * @copyright Copyright (C) 2016 Sproute Networks, Inc.
 *
 * @author Avneesh Sachdev <avneesh@sproute.com>
 *
 * 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.
 */

syntax = "proto2";

/*
 * Protobuf definitions pertaining to the Quagga/FRR 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;
}
