pcap_freenameindex.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*====================================================================*
  2. *
  3. * Copyright (c) 2013 Qualcomm Atheros, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. *====================================================================*/
  8. /*====================================================================*
  9. *
  10. * void pcap_freenameindex (struct if_nameindex *)
  11. *
  12. * ether.h
  13. *
  14. * a WinPcap version of POSIX if_freenameindex function;
  15. *
  16. * see The Open Group Base Specifications Issue 6 IEEE Std 1003.1,
  17. * 2004 Edition for a description of this function;
  18. *
  19. *--------------------------------------------------------------------*/
  20. #ifndef PCAP_FREENAMEINDEX_SOURCE
  21. #define PCAP_FREENAMEINDEX_SOURCE
  22. #include <pcap.h>
  23. #include <stdlib.h>
  24. #include "../ether/ether.h"
  25. void pcap_freenameindex (struct if_nameindex * if_nameindex)
  26. {
  27. #if defined (WINPCAP) || defined (LIBPCAP)
  28. struct if_nameindex * ifp = if_nameindex;
  29. while (ifp->if_index)
  30. {
  31. free (ifp->if_name);
  32. }
  33. free (if_nameindex);
  34. #endif
  35. return;
  36. }
  37. #endif