packet.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* Definitions for use with Linux AF_PACKET sockets.
  2. Copyright (C) 1998-2020 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. <https://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. #define PACKET_COPY_THRESH 7
  42. #define PACKET_AUXDATA 8
  43. #define PACKET_ORIGDEV 9
  44. #define PACKET_VERSION 10
  45. #define PACKET_HDRLEN 11
  46. #define PACKET_RESERVE 12
  47. #define PACKET_TX_RING 13
  48. #define PACKET_LOSS 14
  49. #define PACKET_VNET_HDR 15
  50. #define PACKET_TX_TIMESTAMP 16
  51. #define PACKET_TIMESTAMP 17
  52. #define PACKET_FANOUT 18
  53. #define PACKET_TX_HAS_OFF 19
  54. #define PACKET_QDISC_BYPASS 20
  55. #define PACKET_ROLLOVER_STATS 21
  56. #define PACKET_FANOUT_DATA 22
  57. #define PACKET_IGNORE_OUTGOING 23
  58. struct packet_mreq
  59. {
  60. int mr_ifindex;
  61. unsigned short int mr_type;
  62. unsigned short int mr_alen;
  63. unsigned char mr_address[8];
  64. };
  65. #define PACKET_MR_MULTICAST 0
  66. #define PACKET_MR_PROMISC 1
  67. #define PACKET_MR_ALLMULTI 2
  68. #define PACKET_MR_UNICAST 3
  69. #endif /* netpacket/packet.h */