packet.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. #ifndef __NETPACKET_PACKET_H
  17. #define __NETPACKET_PACKET_H 1
  18. struct sockaddr_ll
  19. {
  20. unsigned short int sll_family;
  21. unsigned short int sll_protocol;
  22. int sll_ifindex;
  23. unsigned short int sll_hatype;
  24. unsigned char sll_pkttype;
  25. unsigned char sll_halen;
  26. unsigned char sll_addr[8];
  27. };
  28. /* Packet types. */
  29. #define PACKET_HOST 0 /* To us. */
  30. #define PACKET_BROADCAST 1 /* To all. */
  31. #define PACKET_MULTICAST 2 /* To group. */
  32. #define PACKET_OTHERHOST 3 /* To someone else. */
  33. #define PACKET_OUTGOING 4 /* Originated by us . */
  34. #define PACKET_LOOPBACK 5
  35. #define PACKET_FASTROUTE 6
  36. /* Packet socket options. */
  37. #define PACKET_ADD_MEMBERSHIP 1
  38. #define PACKET_DROP_MEMBERSHIP 2
  39. #define PACKET_RECV_OUTPUT 3
  40. #define PACKET_RX_RING 5
  41. #define PACKET_STATISTICS 6
  42. struct packet_mreq
  43. {
  44. int mr_ifindex;
  45. unsigned short int mr_type;
  46. unsigned short int mr_alen;
  47. unsigned char mr_address[8];
  48. };
  49. #define PACKET_MR_MULTICAST 0
  50. #define PACKET_MR_PROMISC 1
  51. #define PACKET_MR_ALLMULTI 2
  52. #endif /* netpacket/packet.h */