/*
 * DO NOT EDIT THIS FILE. It was generated from linux/if_tun.h.
 *
 * Copyright (c) 2013 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/*
 *  Universal TUN/TAP device driver.
 *  Copyright (C) 1999-2000 Maxim Krasnyansky <max_mk@yahoo.com>
 *
 *  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.
 */

#include <Python.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <net/if.h>
#include <linux/if_tun.h>

void _init_linux_if_tun_h(PyObject *m) {
  /* Read queue size */
  PyModule_AddIntMacro(m, TUN_READQ_SIZE);
  /* TUN device type flags: deprecated. Use IFF_TUN/IFF_TAP instead. */
  PyModule_AddIntMacro(m, TUN_TUN_DEV);
  PyModule_AddIntMacro(m, TUN_TAP_DEV);
  PyModule_AddIntMacro(m, TUN_TYPE_MASK);

  /* Ioctl defines */
  PyModule_AddIntMacro(m, TUNSETNOCSUM);
  PyModule_AddIntMacro(m, TUNSETDEBUG);
  PyModule_AddIntMacro(m, TUNSETIFF);
  PyModule_AddIntMacro(m, TUNSETPERSIST);
  PyModule_AddIntMacro(m, TUNSETOWNER);
  PyModule_AddIntMacro(m, TUNSETLINK);
  PyModule_AddIntMacro(m, TUNSETGROUP);
  PyModule_AddIntMacro(m, TUNGETFEATURES);
  PyModule_AddIntMacro(m, TUNSETOFFLOAD);
  PyModule_AddIntMacro(m, TUNSETTXFILTER);
  PyModule_AddIntMacro(m, TUNGETIFF);
  PyModule_AddIntMacro(m, TUNGETSNDBUF);
  PyModule_AddIntMacro(m, TUNSETSNDBUF);
  PyModule_AddIntMacro(m, TUNATTACHFILTER);
  PyModule_AddIntMacro(m, TUNDETACHFILTER);
  PyModule_AddIntMacro(m, TUNGETVNETHDRSZ);
  PyModule_AddIntMacro(m, TUNSETVNETHDRSZ);
  PyModule_AddIntMacro(m, TUNSETQUEUE);
  PyModule_AddIntMacro(m, TUNSETIFINDEX);
  PyModule_AddIntMacro(m, TUNGETFILTER);
  PyModule_AddIntMacro(m, TUNSETVNETLE);
  PyModule_AddIntMacro(m, TUNGETVNETLE);

  /* TUNSETIFF ifr flags */
  PyModule_AddIntMacro(m, IFF_TUN);
  PyModule_AddIntMacro(m, IFF_TAP);
  PyModule_AddIntMacro(m, IFF_NO_PI);
  /* This flag has no real effect */
  PyModule_AddIntMacro(m, IFF_ONE_QUEUE);
  PyModule_AddIntMacro(m, IFF_VNET_HDR);
  PyModule_AddIntMacro(m, IFF_TUN_EXCL);
  PyModule_AddIntMacro(m, IFF_MULTI_QUEUE);
  PyModule_AddIntMacro(m, IFF_ATTACH_QUEUE);
  PyModule_AddIntMacro(m, IFF_DETACH_QUEUE);
  /* read-only flag */
  PyModule_AddIntMacro(m, IFF_PERSIST);
  PyModule_AddIntMacro(m, IFF_NOFILTER);

  /* Socket options */
  PyModule_AddIntMacro(m, TUN_TX_TIMESTAMP);

  /* Features for GSO (TUNSETOFFLOAD). */
  PyModule_AddIntMacro(m, TUN_F_CSUM);
  PyModule_AddIntMacro(m, TUN_F_TSO4);
  PyModule_AddIntMacro(m, TUN_F_TSO6);
  PyModule_AddIntMacro(m, TUN_F_TSO_ECN);
  PyModule_AddIntMacro(m, TUN_F_UFO);

  /* Protocol info prepended to the packets (when IFF_NO_PI is not set) */
  PyModule_AddIntMacro(m, TUN_PKT_STRIP);
}