NetDev.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* vim: set expandtab ts=4 sw=4: */
  2. /*
  3. * You may redistribute this program and/or modify it under the terms of
  4. * the GNU General Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #ifndef NetDev_H
  16. #define NetDev_H
  17. #include "exception/Except.h"
  18. #include "util/log/Log.h"
  19. #include "util/platform/Sockaddr.h"
  20. #include "util/Linker.h"
  21. Linker_require("util/platform/netdev/NetDev.c")
  22. /**
  23. * Set an address on an interface, if the interface is down (linux) bring it up,
  24. * and if the interface requires an explicit route (Illumos), configure it.
  25. *
  26. * @param ifName the name of the interface to alter.
  27. * @param sa the ip address to set.
  28. * @param prefixLen the number of bits netmask to include in the route.
  29. * @param logger
  30. * @param eh an exception handler.
  31. */
  32. void NetDev_addAddress(const char* ifName,
  33. struct Sockaddr* sa,
  34. int prefixLen,
  35. struct Log* logger,
  36. struct Except* eh);
  37. /**
  38. * Set the MTU of an interface.
  39. *
  40. * @param interfaceName the name of the interface to set the MTU for.
  41. * @param mtu the desired MTU.
  42. * @param logger where to write information.
  43. * @param eh an exception handler.
  44. */
  45. void NetDev_setMTU(const char* interfaceName,
  46. uint32_t mtu,
  47. struct Log* logger,
  48. struct Except* eh);
  49. void NetDev_flushAddresses(const char* deviceName, struct Except* eh);
  50. #endif