<commit_before>/*
 * Copyright (C) 2017 Joyent Inc.
 * All rights reserved.
 *
 * Written by: <NAME> <<EMAIL>>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *   1. Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *   2. Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#ifndef UVXBRIDGE_H_
#define UVXBRIDGE_H_

#include <netinet/in.h>
/*  
 * VERB command set
 * 
 *   Add per-VNI forwarding table entry map destination host mac to remote ip
 * - UPDATE_FTE:<seqno> mac: 6 bytes
 *                vxlanid: 3 byte value
 *                vlanid: 2 byte value
 *                raddr: <4-tuple| v6addr w/ no symbolic>
 *             expire: 8 bytes - useconds
 *         (result:seqno error:<errstr> (gen: 4 byte)?)
 *
 *  Get forwarding entry details
 * - GET_FTE:<seqno> mac: 6 bytes
 *               vxlanid: 3 byte value
*                 vlanid: 2 byte value
 *       (result:<seqno> error:<errstr> (raddr: <4-tuple| v6addr w/ no symbolic>
 *              expire: 8 bytes - useconds
 *                 gen: 4 byte)?)
 * 
 * - REMOVE_FTE:<seqno> mac: 6 bytes
 *                  vxlanid: 3 byte value
 *       (result:<seqno> error:<errstr>)
 *
 * - GET_ALL_FTE:<seqno>
 *         (result: error:<errstr>
 *                  (mac: 6 bytes
 *               vxlanid: 3 byte value
 *                vlanid: 2 byte value
 *                 raddr: <4-tuple| v6addr w/ no symbolic>
 *                expire: 8 bytes - useconds
 *                   gen: 4 byte)*)  
 *
 *
 *   manage physical L2 table entries for remote IP
 * - SET_PHYS_ND:<seqno> mac: big-endian 6 bytes raddr: <4-tuple| v6addr w/ no symbolic>
 *   (result:<seqno> error:<errstr>)
 *
 * - DEL_PHYS_ND:<seqno> mac: big-endian 6 bytes | raddr: <4-tuple| v6addr w/ no symbolic>
 *   (result:<seqno> error:<errstr>)
 *
 * - GET_PHYS_ND:<seqno> raddr: <4-tuple| v6addr w/ no symbolic>
 *      (result:<seqno>  error:<errstr> (mac: big-endian 6 bytes)?)
 *
 * - GET_ALL_PHYS_ND:<seqno>
 *       (result:<seqno> error:<errstr> (mac: big-endian 6 bytes
 *               raddr: <4-tuple| v6addr w/ no symbolic>)*)
 *
 *
 *   manage vxlan L2 table entries for remote IP
 * - SET_VX_ND:<seqno> mac: big-endian 6 bytes raddr: <4-tuple| v6addr w/ no symbolic>
 *   (result:<seqno> error:<errstr>)
 *
 * - DEL_VX_ND:<seqno> mac: big-endian 6 bytes |
 *             raddr: <4-tuple| v6addr w/ no symbolic>
 *   (result:<seqno> error:<errstr>)
 *
 * - GET_VX_ND:<seqno> raddr: <4-tuple| v6addr w/ no symbolic>
 *      (result:<seqno> error:<errstr> (mac: big-endian 6 bytes)?)
 *
 * - GET_ALL_VX_ND:<seqno>
 *       (result:<seqno> error:<errstr> (mac: big-endian 6 bytes
 *               raddr: <4-tuple| v6addr w/ no symbolic>)*)
 *
 *
 * - UPDATE_ROUTE:<seqno> raddr: <4-tuple| v6addr w/ no symbolic>
 *                       subnet: <4-tuple| v6addr w/ no symbolic>
 *                      netmask: hex string
 *                      [default:<true|false>]?
 *       (result:<seqno> error:<errstr> (gen: 4 bytes)?)
 *
 * - REMOVE_ROUTE:<seqno> raddr: <4-tuple| v6addr w/ no symbolic>
 *       (result:<seqno> error:<errstr>)
 *
 * - GET_ALL_ROUTE:<seqno>
 *       (result:<seqno> error:<errstr>
 *               (raddr: <4-tuple| v6addr w/ no symbolic>
 *                       subnet: <4-tuple| v6addr w/ no symbolic>
 *                      netmask: hex string
 *                      default:<true|false>)*)
 *
 *
 *  Stop forwarding packets
 * - SUSPEND:<seqno>
 *       (result:<seqno> error:<errstr>)
 *
 *  Resume forwarding packets
 * - RESUME:<seqno>
 *       (result:<seqno> error:<errstr>)
 *
 *
 *  Signal that all seqno prior have completed, error value is the
 *  first error encountered since the last BARRIER issued, if any.
 * - BARRIER:<seqno>
 *       (result:<seqno> error:<errstr>)
 *
 *   Syntactic sugar for BARRIER+SUSPEND
 * - BEGIN_UPDATE:<seqno>
 *       (result:<seqno> error:<errstr>)
 *
 *   Syntactic sugar for BARRIER+RESUME
 * - COMMIT_UPDATE:<seqno>
 *       (result:<seqno> error:<errstr>)
 *
 *
 * Sample syntax - with the command shown in C syntax to indicate literal quotes
 *                 and newlines:
 * client -> server: "VERB_UPDATE_ROUTE:0x1 raddr:\"192.168.0.1\" default:\"true\" subnet:\"192.168.0.0\" netmask:\"ffff0000\"\n"
 * server -> client: "(result:0x1 error:\"ERR_SUCCESS\" (gen:0x0))\n"
 * client -> server: "VERB_SET_PHYS_ND:0x2 raddr:\"192.168.0.1\" mac:0xbabecafebeef\n"
 * server -> client: "(result:0x2 error:\"ERR_SUCCESS\")"
 * client -> server: "VERB_GET_PHYS_ND_ALL:0x3\n"
 * server -> client: "(result:0x3 error:\"ERR_SUCCESS\" (raddr:\"192.168.0.1\" mac:0xbabecafebeef))\n"
 */

enum verb {
	VERB_BAD = 0x0,
	VERB_BARRIER = 0x1,

	VERB_UPDATE_FTE = 0x10,
	VERB_REMOVE_FTE = 0x11,
	VERB_GET_FTE = 0x12,
	VERB_GET_ALL_FTE = 0x13,

	VERB_SET_PHYS_ND = 0x20,
	VERB_GET_PHYS_ND = 0x21,<commit_msg>update protocol for consistency<commit_after>/*
 * Copyright (C) 2017 Joyent Inc.
 * All rights reserved.
 *
 * Written by: <NAME> <<EMAIL>>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *   1. Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *   2. Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#ifndef UVXBRIDGE_H_
#define UVXBRIDGE_H_

#include <netinet/in.h>
/*  
 * VERB command set
 * 
 *   Add per-VNI forwarding table entry map destination host mac to remote ip
 * - UPDATE_FTE:<seqno> mac: 6 bytes
 *                vxlanid: 3 byte value
 *                vlanid: 2 byte value
 *                raddr: <4-tuple| v6addr w/ no symbolic>
 *             expire: 8 bytes - useconds
 *         (result:seqno error:<errstr> (gen: 4 byte)?)
 *
 *  Get forwarding entry details
 * - GET_FTE:<seqno> mac: 6 bytes
 *               vxlanid: 3 byte value
*                 vlanid: 2 byte value
 *       (result:<seqno> error:<errstr> (raddr: <4-tuple| v6addr w/ no symbolic>
 *              expire: 8 bytes - useconds
 *                 gen: 4 byte)?)
 * 
 * - REMOVE_FTE:<seqno> mac: 6 bytes
 *                  vxlanid: 3 byte value
 *       (result:<seqno> error:<errstr>)
 *
 * - GET_ALL_FTE:<seqno>
 *         (result: error:<errstr>
 *                  (mac: 6 bytes
 *               vxlanid: 3 byte value
 *                vlanid: 2 byte value
 *                 raddr: <4-tuple| v6addr w/ no symbolic>
 *                expire: 8 bytes - useconds
 *                   gen: 4 byte)*)  
 *
 *
 *   manage physical L2 table entries for remote IP
 * - SET_PHYS_ND:<seqno> mac: big-endian 6 bytes raddr: <4-tuple| v6addr w/ no symbolic>
 *   (result:<seqno> error:<errstr>)
 *
 * - DEL_PHYS_ND:<seqno> mac: big-endian 6 bytes | raddr: <4-tuple| v6addr w/ no symbolic>
 *   (result:<seqno> error:<errstr>)
 *
 * - GET_PHYS_ND:<seqno> raddr: <4-tuple| v6addr w/ no symbolic>
 *      (result:<seqno>  error:<errstr> (mac: big-endian 6 bytes)?)
 *
 * - GET_ALL_PHYS_ND:<seqno>
 *       (result:<seqno> error:<errstr> (mac: big-endian 6 bytes
 *               raddr: <4-tuple| v6addr w/ no symbolic>)*)
 *
 *
 *   manage vxlan L2 table entries for remote IP
 * - SET_VX_ND:<seqno> mac: big-endian 6 bytes raddr: <4-tuple| v6addr w/ no symbolic>
 *   (result:<seqno> error:<errstr>)
 *
 * - DEL_VX_ND:<seqno> mac: big-endian 6 bytes |
 *             raddr: <4-tuple| v6addr w/ no symbolic>
 *   (result:<seqno> error:<errstr>)
 *
 * - GET_VX_ND:<seqno> raddr: <4-tuple| v6addr w/ no symbolic>
 *      (result:<seqno> error:<errstr> (mac: big-endian 6 bytes)?)
 *
 * - GET_ALL_VX_ND:<seqno>
 *       (result:<seqno> error:<errstr> (mac: big-endian 6 bytes
 *               raddr: <4-tuple| v6addr w/ no symbolic>)*)
 *
 *
 * - UPDATE_ROUTE:<seqno> raddr: <4-tuple| v6addr w/ no symbolic>
 *                       subnet: <4-tuple| v6addr w/ no symbolic>
 *                    prefixlen: 2 byte value
 *                      [default:<true|false>]?
 *       (result:<seqno> error:<errstr> (gen: 4 bytes)?)
 *
 * - REMOVE_ROUTE:<seqno> raddr: <4-tuple| v6addr w/ no symbolic>
 *       (result:<seqno> error:<errstr>)
 *
 * - GET_ALL_ROUTE:<seqno>
 *       (result:<seqno> error:<errstr>
 *               (raddr: <4-tuple| v6addr w/ no symbolic>
 *                       subnet: <4-tuple| v6addr w/ no symbolic>
 *                    prefixlen: 2 byte value
 *                      default:<true|false>)*)
 *
 *
 *  Stop forwarding packets
 * - SUSPEND:<seqno>
 *       (result:<seqno> error:<errstr>)
 *
 *  Resume forwarding packets
 * - RESUME:<seqno>
 *       (result:<seqno> error:<errstr>)
 *
 *
 *  Signal that all seqno prior have completed, error value is the
 *  first error encountered since the last BARRIER issued, if any.
 * - BARRIER:<seqno>
 *       (result:<seqno> error:<errstr>)
 *
 *   Syntactic sugar for BARRIER+SUSPEND
 * - BEGIN_UPDATE:<seqno>
 *       (result:<seqno> error:<errstr>)
 *
 *   Syntactic sugar for BARRIER+RESUME
 * - COMMIT_UPDATE:<seqno>
 *       (result:<seqno> error:<errstr>)
 *
 *
 * Sample syntax - with the command shown in C syntax to indicate literal quotes
 *                 and newlines:
 * client -> server: "VERB_UPDATE_ROUTE:0x1 raddr:\"192.168.0.1\" default:\"true\" subnet:\"192.168.0.0\" prefixlen:0x10\n"
 * server -> client: "(result:0x1 error:\"ERR_SUCCESS\" (gen:0x0))\n"
 * client -> server: "VERB_SET_PHYS_ND:0x2 raddr:\"192.168.0.1\" mac:0xbabecafebeef\n"
 * server -> client: "(result:0x2 error:\"ERR_SUCCESS\")"
 * client -> server: "VERB_GET_PHYS_ND_ALL:0x3\n"
 * server -> client: "(result:0x3 error:\"ERR_SUCCESS\" (raddr:\"192.168.0.1\" mac:0xbabecafebeef))\n"
 */

enum verb {
	VERB_BAD = 0x0,
	VERB_BARRIER = 0x1,

	VERB_UPDATE_FTE = 0x10,
	VERB_REMOVE_FTE = 0x11,
	VERB_GET_FTE = 0x12,
	VERB_GET_ALL_FTE = 0x13,

	VERB_SET_PHYS_ND = 0x20,
	VERB_GET_PHYS_ND = 0x21,
{'fraction_non_alphanumeric': 0.12537713711029166, 'fraction_numerical': 0.023550117331545425, 'mean_word_length': 2.6830246913580247, 'pattern_counts': {'":': 0, '<': 163, '<?xml version=': 0, '>': 175, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2590246', 'n_tokens_mistral': 4435, 'n_tokens_neox': 4110, 'n_words': 1194}