Sin descripción

ip_hdr.h 1.4KB

1234567891011121314151617181920212223242526
  1. #ifndef IP_HDR_H
  2. #define IP_HDR_H
  3. /* IP header */
  4. ///
  5. /// \brief The sniff_ip struct defines the packet header of a
  6. /// tcp internet packet. Used to extract IP layer information from a packet.
  7. struct sniff_ip {
  8. u_char ip_vhl; /**< version << 4 | header length >> 2 */
  9. u_char ip_tos; /**< type of service / tipo de servicio*/
  10. u_short ip_len; /**< total length / largo total*/
  11. u_short ip_id; /**< identification / identificacion */
  12. u_short ip_off; /**< fragment offset field / offset del campo de fragmento*/
  13. #define IP_RF 0x8000 /**< reserved fragment flag / bandera de fragmento reservada*/
  14. #define IP_DF 0x4000 /**< dont fragment flag / bander de no fragmentar */
  15. #define IP_MF 0x2000 /**< more fragments flag / mas banderas de framentos*/
  16. #define IP_OFFMASK 0x1fff /**< mask for fragmenting bits / mascara para bits de fragmentacion */
  17. u_char ip_ttl; /**< time to live / tiempo de vida*/
  18. u_char ip_p; /**< protocol / protocolo */
  19. u_short ip_sum; /**< checksum */
  20. struct in_addr ip_src,ip_dst; /**< source and dest address / direccion fuente y destino */
  21. };
  22. #define IP_HL(ip) (((ip)->ip_vhl) & 0x0f)
  23. #define IP_V(ip) (((ip)->ip_vhl) >> 4)
  24. #endif // IP_HDR_H