Няма описание

ethernet_packet.h 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef ETHERNET_PACKET_H
  2. #define ETHERNET_PACKET_H
  3. #include "ethernet_hdr.h"
  4. #include <string>
  5. using namespace std ;
  6. ///
  7. /// \brief The ethernet_packet class contains function to
  8. /// change the ethernet information in bytes from the ethernet packet
  9. /// header to human readable data types (strings)
  10. ///
  11. class ethernet_packet
  12. {
  13. sniff_ethernet ethernet ; /**< Ethernet header / encabezado Ethernet */
  14. /// \fn string ethernet_packet::mac2string(u_char srcmac[])
  15. /// \~English
  16. /// \brief Function to change the array of bytes representing a Hardware Address
  17. /// to its standard string representation.
  18. /// \param srcmac array with an Ethernet address
  19. /// \return Ethernet address in string format
  20. /// \~Spanish
  21. /// \brief Funcion para cambiar el arreglo de bytes que representa una direccion de hardware
  22. /// a su representacion estándar de caracteres.
  23. /// \param srcmac arreglo con una direccion Ethernet
  24. string mac2string(u_char []) ;
  25. public:
  26. /// \fn ethernet_packet::ethernet_packet()
  27. /// \~English
  28. /// \brief Constructor, does nothing
  29. /// \~Spanish
  30. /// \brief Constructor, no hace nada
  31. ethernet_packet();
  32. /// \fn void ethernet_packet::setEtherDHost(u_char dhost[])
  33. /// \~English
  34. /// \brief Receives the array of 6 bytes of a destination host
  35. /// \param dhost destination host Ethernet address
  36. /// \~Spanish
  37. /// \brief Recibe el arreglo de 6 bytes de un computadora destino
  38. /// \param dhost direccion Ethernet de computadora destino
  39. void setEtherDHost(u_char []) ;
  40. /// \fn void ethernet_packet::setEtherSHost(u_char shost[])
  41. /// \~English
  42. /// \brief Receives the array of 6 bytes of a source host
  43. /// \param shost source host Ethernet address
  44. /// \~Spanish
  45. /// \brief Recibe el arreglo de 6 bytes de la computadora de origen
  46. /// \param shost direccion de Ethernet de computadora de origen
  47. void setEtherSHost(u_char []) ;
  48. /// \fn void ethernet_packet::setEtherType(u_short type)
  49. /// \~English
  50. /// \brief Set the Ethernet type
  51. /// \param type Ethernet type
  52. /// \~Spanish
  53. /// \brief Ajusta el tipo de Ethernet
  54. /// \param type tipo de Ethernet
  55. void setEtherType(u_short) ;
  56. /// \fn string ethernet_packet::getEtherDHost()
  57. /// \~English
  58. /// \brief Returns the destination HA in string format
  59. /// \return the destination HA in string format
  60. /// \~Spanish
  61. /// \brief Devuelve la direccion de hardware destino en formato de caracteres
  62. /// \return la direccion de hardware destino en formato de caracteres
  63. string getEtherDHost() ;
  64. /// \fn string ethernet_packet::getEtherSHost()
  65. /// \~English
  66. /// \brief Returns the source HA in string format
  67. /// \return the source HA in string format
  68. /// \~Spanish
  69. /// \brief Devuelve la direccion de hardware fuente en formato de caracteres
  70. /// \return la direccion de hardware fuente en formato de caracteres
  71. string getEtherSHost() ;
  72. /// \fn u_short ethernet_packet::getEtherType()
  73. /// \~English
  74. /// \brief Returns the Ethernet type
  75. /// \return the Ethernet type.
  76. /// \~Spanish
  77. /// \brief Devuelve el tipo de Ethernet
  78. /// \return el tipo de Ethernet
  79. u_short getEtherType() ;
  80. };
  81. #endif // ETHERNET_PACKET_H