Changeset c909fad for lib/libtrace.h.in


Ignore:
Timestamp:
03/06/13 13:28:51 (8 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
68b7f29
Parents:
af27241
Message:
  • Added checksumming functions for both the IP and transport layer. The functions will calculate the correct checksum for that packet and also return a pointer to the checksum field in the appropriate header so that the caller can either evaluate whether the checksum is correct, replace the existing checksum, or do whatever they want.
  • Also managed to fix a bunch of broken Revision svn tags
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h.in

    r5699389 rc909fad  
    16731673                uint16_t *ethertype, uint32_t *remaining);
    16741674
     1675/** Calculates the expected IP checksum for a packet.
     1676 * @param packet        The libtrace packet to calculate the checksum for
     1677 * @param[out] csum     The checksum that is calculated by this function. This
     1678 *                      may not be NULL.
     1679 *
     1680 * @return A pointer to the original checksum field within the IP
     1681 * header. If the checksum field is not present in the packet, NULL is returned.
     1682 *
     1683 * @note The return value points to the checksum that exists within the current
     1684 * packet. The value in csum is the value that the checksum should be, given
     1685 * the current packet contents. 
     1686 *
     1687 * @note This function involves the use of a memcpy, so be careful about
     1688 * calling it excessively if performance is a concern for you.
     1689 *
     1690 * New in libtrace 3.0.17
     1691 */
     1692DLLEXPORT uint16_t *trace_checksum_layer3(libtrace_packet_t *packet,
     1693                uint16_t *csum);
     1694
     1695/** Calculates the expected checksum for the transport header in a packet.
     1696 * @param packet        The libtrace packet to calculate the checksum for
     1697 * @param[out] csum     The checksum that is calculated by this function. This
     1698 *                      may not be NULL.
     1699 *
     1700 * @return A pointer to the original checksum field within the transport
     1701 * header. If the checksum field is not present in the packet, NULL is returned.
     1702 *
     1703 * @note The return value points to the checksum that exists within the current
     1704 * packet. The value in csum is the value that the checksum should be, given
     1705 * the current packet contents. 
     1706 *
     1707 * @note This function involves the use of a memcpy, so be careful about
     1708 * calling it excessively if performance is a concern for you.
     1709 *
     1710 * @note Because transport checksums are calculated across the entire payload,
     1711 * truncated packets will result in NULL being returned.
     1712 *
     1713 * This function will determine the appropriate checksum for whatever transport
     1714 * layer header is present in the provided packet. At this stage, this only
     1715 * currently works for TCP, UDP and ICMP packets.
     1716 *
     1717 * Be wary of TCP checksum offloading if you are examining the checksum of
     1718 * packets captured on the same host that generated them!
     1719 *
     1720 * New in libtrace 3.0.17
     1721 */
     1722DLLEXPORT uint16_t *trace_checksum_transport(libtrace_packet_t *packet,
     1723                uint16_t *csum);
     1724
    16751725/** Gets a pointer to the transport layer header (if any)
    16761726 * @param packet   The libtrace packet to find the transport header for
Note: See TracChangeset for help on using the changeset viewer.