1
0

NetDev.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 "util/platform/Sockaddr.h"
  18. #include "util/Linker.h"
  19. Linker_require("util/platform/netdev/NetDev.c")
  20. /**
  21. * Set an address on an interface, if the interface is down (linux) bring it up,
  22. * and if the interface requires an explicit route (Illumos), configure it.
  23. *
  24. * @param ifName the name of the interface to alter.
  25. * @param sa the ip address to set.
  26. * @param prefixLen the number of bits netmask to include in the route.
  27. * @param logger
  28. * @param eh an exception handler.
  29. */
  30. void NetDev_addAddress(const char* ifName,
  31. struct Sockaddr* sa,
  32. int prefixLen,
  33. struct Log* logger,
  34. struct Except* eh);
  35. /**
  36. * Set the MTU of an interface.
  37. *
  38. * @param interfaceName the name of the interface to set the MTU for.
  39. * @param mtu the desired MTU.
  40. * @param logger where to write information.
  41. * @param eh an exception handler.
  42. */
  43. void NetDev_setMTU(const char* interfaceName,
  44. uint32_t mtu,
  45. struct Log* logger,
  46. struct Except* eh);
  47. void NetDev_flushAddresses(const char* deviceName, struct Except* eh);
  48. #endif