C++程序  |  116行  |  3.92 KB

/*
 * DO NOT EDIT THIS FILE. It was generated from sys/ioctl.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.
 */

/* Copyright (C) 1996-2014 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library 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
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <http://www.gnu.org/licenses/>.  */

#include <Python.h>
#include <sys/ioctl.h>

void _init_sys_ioctl_h(PyObject *m) {
  /* Use the definitions from the kernel header files.  */

  /* Routing table calls.  */
  PyModule_AddIntMacro(m, SIOCADDRT);
  PyModule_AddIntMacro(m, SIOCDELRT);
  PyModule_AddIntMacro(m, SIOCRTMSG);

  /* Socket configuration controls. */
  PyModule_AddIntMacro(m, SIOCGIFNAME);
  PyModule_AddIntMacro(m, SIOCSIFLINK);
  PyModule_AddIntMacro(m, SIOCGIFCONF);
  PyModule_AddIntMacro(m, SIOCGIFFLAGS);
  PyModule_AddIntMacro(m, SIOCSIFFLAGS);
  PyModule_AddIntMacro(m, SIOCGIFADDR);
  PyModule_AddIntMacro(m, SIOCSIFADDR);
  PyModule_AddIntMacro(m, SIOCGIFDSTADDR);
  PyModule_AddIntMacro(m, SIOCSIFDSTADDR);
  PyModule_AddIntMacro(m, SIOCGIFBRDADDR);
  PyModule_AddIntMacro(m, SIOCSIFBRDADDR);
  PyModule_AddIntMacro(m, SIOCGIFNETMASK);
  PyModule_AddIntMacro(m, SIOCSIFNETMASK);
  PyModule_AddIntMacro(m, SIOCGIFMETRIC);
  PyModule_AddIntMacro(m, SIOCSIFMETRIC);
  PyModule_AddIntMacro(m, SIOCGIFMEM);
  PyModule_AddIntMacro(m, SIOCSIFMEM);
  PyModule_AddIntMacro(m, SIOCGIFMTU);
  PyModule_AddIntMacro(m, SIOCSIFMTU);
  PyModule_AddIntMacro(m, SIOCSIFNAME);
  PyModule_AddIntMacro(m, SIOCSIFHWADDR);
  PyModule_AddIntMacro(m, SIOCGIFENCAP);
  PyModule_AddIntMacro(m, SIOCSIFENCAP);
  PyModule_AddIntMacro(m, SIOCGIFHWADDR);
  PyModule_AddIntMacro(m, SIOCGIFSLAVE);
  PyModule_AddIntMacro(m, SIOCSIFSLAVE);
  PyModule_AddIntMacro(m, SIOCADDMULTI);
  PyModule_AddIntMacro(m, SIOCDELMULTI);
  PyModule_AddIntMacro(m, SIOCGIFINDEX);
  PyModule_AddIntMacro(m, SIOGIFINDEX);
  PyModule_AddIntMacro(m, SIOCSIFPFLAGS);
  PyModule_AddIntMacro(m, SIOCGIFPFLAGS);
  PyModule_AddIntMacro(m, SIOCDIFADDR);
  PyModule_AddIntMacro(m, SIOCSIFHWBROADCAST);
  PyModule_AddIntMacro(m, SIOCGIFCOUNT);

  PyModule_AddIntMacro(m, SIOCGIFBR);
  PyModule_AddIntMacro(m, SIOCSIFBR);

  PyModule_AddIntMacro(m, SIOCGIFTXQLEN);
  PyModule_AddIntMacro(m, SIOCSIFTXQLEN);

  /* ARP cache control calls. */
  /*  0x8950 - 0x8952  * obsolete calls, don't re-use */
  PyModule_AddIntMacro(m, SIOCDARP);
  PyModule_AddIntMacro(m, SIOCGARP);
  PyModule_AddIntMacro(m, SIOCSARP);

  /* RARP cache control calls. */
  PyModule_AddIntMacro(m, SIOCDRARP);
  PyModule_AddIntMacro(m, SIOCGRARP);
  PyModule_AddIntMacro(m, SIOCSRARP);

  /* Driver configuration calls */

  PyModule_AddIntMacro(m, SIOCGIFMAP);
  PyModule_AddIntMacro(m, SIOCSIFMAP);

  /* DLCI configuration calls */

  PyModule_AddIntMacro(m, SIOCADDDLCI);
  PyModule_AddIntMacro(m, SIOCDELDLCI);

  /* Device private ioctl calls.  */

  /* These 16 ioctls are available to devices via the do_ioctl() device
     vector.  Each device should include this file and redefine these
     names as their own. Because these are device dependent it is a good
     idea _NOT_ to issue them to random objects and hope.  */

  PyModule_AddIntMacro(m, SIOCDEVPRIVATE);

  /*
   *      These 16 ioctl calls are protocol private
   */

  PyModule_AddIntMacro(m, SIOCPROTOPRIVATE);
}