packet.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* Definitions for use with Linux AF_PACKET sockets.
  2. Copyright (C) 1998, 1999 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef __NETPACKET_PACKET_H
  16. #define __NETPACKET_PACKET_H 1
  17. struct sockaddr_ll
  18. {
  19. unsigned short int sll_family;
  20. unsigned short int sll_protocol;
  21. int sll_ifindex;
  22. unsigned short int sll_hatype;
  23. unsigned char sll_pkttype;
  24. unsigned char sll_halen;
  25. unsigned char sll_addr[8];
  26. };
  27. /* Packet types. */
  28. #define PACKET_HOST 0 /* To us. */
  29. #define PACKET_BROADCAST 1 /* To all. */
  30. #define PACKET_MULTICAST 2 /* To group. */
  31. #define PACKET_OTHERHOST 3 /* To someone else. */
  32. #define PACKET_OUTGOING 4 /* Originated by us . */
  33. #define PACKET_LOOPBACK 5
  34. #define PACKET_FASTROUTE 6
  35. /* Packet socket options. */
  36. #define PACKET_ADD_MEMBERSHIP 1
  37. #define PACKET_DROP_MEMBERSHIP 2
  38. #define PACKET_RECV_OUTPUT 3
  39. #define PACKET_RX_RING 5
  40. #define PACKET_STATISTICS 6
  41. struct packet_mreq
  42. {
  43. int mr_ifindex;
  44. unsigned short int mr_type;
  45. unsigned short int mr_alen;
  46. unsigned char mr_address[8];
  47. };
  48. #define PACKET_MR_MULTICAST 0
  49. #define PACKET_MR_PROMISC 1
  50. #define PACKET_MR_ALLMULTI 2
  51. #endif /* netpacket/packet.h */