Changeset faf16af for lib/libtrace.h.in


Ignore:
Timestamp:
07/07/14 14:25:36 (7 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, 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:
262a093, ce7153d, ea602cd
Parents:
1ca603b (diff), 17f954f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'develop'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h.in

    rf7bcbfb r17f954f  
    8080#if defined(LITTLE_ENDIAN) && !defined(__LITTLE_ENDIAN)
    8181#define __LITTLE_ENDIAN LITTLE_ENDIAN
    82 #endif
    83 
    84 #ifdef _MSC_VER
    85     /* define the following from MSVC's internal types */
    86     typedef             __int8  int8_t;
    87     typedef             __int16 int16_t;
    88     typedef             __int32 int32_t;
    89     typedef             __int64 int64_t;
    90     typedef unsigned    __int8  uint8_t;
    91     typedef unsigned    __int16 uint16_t;
    92     typedef unsigned    __int32 uint32_t;
    93     typedef unsigned    __int64 uint64_t;
    94     #ifdef LT_BUILDING_DLL
    95         #define DLLEXPORT __declspec(dllexport)
    96     #else
    97         #define DLLEXPORT __declspec(dllimport)
    98     #endif
    99     #define DLLLOCAL
    100     /* Windows pads bitfields out to to the size of their parent type
    101      * however gcc warns that this doesn't meet with the iso C specification
    102      * so produces warnings for this behaviour.  sigh.
    103      */
    104     #define LT_BITFIELD8        uint8_t
    105     #define LT_BITFIELD16       uint16_t
    106     #define LT_BITFIELD32       uint32_t
    107     #define LT_BITFIELD64       uint64_t
    108 #else
    109     #ifdef HAVE_STDINT_H
    110         #   include <stdint.h>
    111     #endif
    112     #if __GNUC__ >= 4
    113         #ifdef LT_BUILDING_DLL
    114                 #define DLLEXPORT __attribute__ ((visibility("default")))
    115                 #define DLLLOCAL __attribute__ ((visibility("hidden")))
    116         #else
    117                 #define DLLEXPORT
    118                 #define DLLLOCAL
    119         #endif
    120     #else
    121         #define DLLEXPORT
    122         #define DLLLOCAL
    123     #endif
    124     /* GCC warns if the bitfield type is not "unsigned int", however windows
    125      * generates incorrect code for this (see above), so we define these
    126      * macros.  How Hideous.  So much for C's portability.
    127      */
    128     #define LT_BITFIELD8        unsigned int
    129     #define LT_BITFIELD16       unsigned int
    130     #define LT_BITFIELD32       unsigned int
    131     #define LT_BITFIELD64       unsigned int
    13282#endif
    13383
     
    170120#endif
    171121
    172 /* Function does not depend on anything but its
    173  * parameters, used to hint gcc's optimisations
    174  */
    175 #if __GNUC__ >= 3
     122#ifdef _MSC_VER
     123    /* define the following from MSVC's internal types */
     124    typedef             __int8  int8_t;
     125    typedef             __int16 int16_t;
     126    typedef             __int32 int32_t;
     127    typedef             __int64 int64_t;
     128    typedef unsigned    __int8  uint8_t;
     129    typedef unsigned    __int16 uint16_t;
     130    typedef unsigned    __int32 uint32_t;
     131    typedef unsigned    __int64 uint64_t;
     132   
     133    /* Windows pads bitfields out to to the size of their parent type
     134     * however gcc warns that this doesn't meet with the iso C specification
     135     * so produces warnings for this behaviour.  sigh.
     136     */
     137    #define LT_BITFIELD8        uint8_t
     138    #define LT_BITFIELD16       uint16_t
     139    #define LT_BITFIELD32       uint32_t
     140    #define LT_BITFIELD64       uint64_t
     141#else
     142    #ifdef HAVE_STDINT_H
     143        #   include <stdint.h>
     144    #endif
     145    /* GCC warns if the bitfield type is not "unsigned int", however windows
     146     * generates incorrect code for this (see above), so we define these
     147     * macros.  How Hideous.  So much for C's portability.
     148     */
     149    #define LT_BITFIELD8        unsigned int
     150    #define LT_BITFIELD16       unsigned int
     151    #define LT_BITFIELD32       unsigned int
     152    #define LT_BITFIELD64       unsigned int
     153#endif
     154
     155/* Ensure these gcc optimisation attributes are defined consistently,
     156 * without requiring users to need to have access to the config.h
     157 * generated by running configure.
     158 */
     159
     160#define LT_USE_PACKED @HAVE_ATTRIBUTE_PACKED@
     161#define LT_USE_UNUSED @HAVE_ATTRIBUTE_UNUSED@
     162#define LT_USE_DEPRECATED @HAVE_ATTRIBUTE_DEPRECATED@
     163#define LT_USE_PURE @HAVE_ATTRIBUTE_PURE@
     164#define LT_USE_PRINTF @HAVE_ATTRIBUTE_FORMAT@
     165#define LT_USE_VISIBILITY @HAVE_VISIBILITY@
     166
     167#if LT_USE_PACKED
     168#  define PACKED __attribute__((packed))
     169#else
     170#  define PACKED
     171#endif
     172
     173#if LT_USE_UNUSED
     174#  define UNUSED __attribute__((unused))
     175#else
     176#  define UNUSED
     177#endif
     178
     179#if LT_USE_DEPRECATED
    176180#  define DEPRECATED __attribute__((deprecated))
    177 #  define SIMPLE_FUNCTION __attribute__((pure))
    178 #  define UNUSED __attribute__((unused))
    179 #  define PACKED __attribute__((packed))
    180 #  define PRINTF(formatpos,argpos) __attribute__((format(printf,formatpos,argpos)))
    181181#else
    182182#  define DEPRECATED
     183#endif
     184
     185#if LT_USE_PURE
     186#  define SIMPLE_FUNCTION __attribute__((pure))
     187#else
    183188#  define SIMPLE_FUNCTION
    184 #  define UNUSED
    185 #  define PACKED
    186 #  define PRINTF(formatpos,argpos)
    187189#endif
     190
     191#if LT_USE_PRINTF
     192#  define PRINTF(formatpos, argpos) __attribute__((format(printf,formatpos, argpos)))
     193#else
     194#  define PRINTF(formatpos, argpos)
     195#endif
     196
     197#ifdef _MSC_VER
     198    #ifdef LT_BUILDING_DLL
     199        #define DLLEXPORT __declspec(dllexport)
     200    #else
     201        #define DLLEXPORT __declspec(dllimport)
     202    #endif
     203    #define DLLLOCAL
     204#else
     205    #ifndef DLLEXPORT
     206        #if LT_USE_VISIBILITY && LT_BUILDING_DLL
     207            #define DLLEXPORT __attribute__ ((visibility("default")))
     208            #define DLLLOCAL __attribute__ ((visibility("hidden")))
     209        #else
     210            #define DLLEXPORT
     211            #define DLLLOCAL
     212        #endif
     213    #endif
     214#endif
     215
    188216       
    189217/** Opaque structure holding information about an output trace */
     
    839867        uint8_t ospf_v;         /**< OSPF Version, should be 2 */
    840868        uint8_t type;           /**< OSPF Packet Type */
    841         uint16_t len;           /**< Packet length, including OSPF header */
     869        uint16_t ospf_len;      /**< Packet length, including OSPF header */
    842870        struct in_addr router;  /**< Router ID of the packet source */
    843871        struct in_addr area;    /**< Area the packet belongs to */
     
    12101238        TRACE_OPTION_COMPRESSTYPE_ZLIB = 1, /**< GZip Compression */
    12111239        TRACE_OPTION_COMPRESSTYPE_BZ2  = 2, /**< BZip2 Compression */
    1212         TRACE_OPTION_COMPRESSTYPE_LZO  = 3  /**< LZO Compression */
     1240        TRACE_OPTION_COMPRESSTYPE_LZO  = 3,  /**< LZO Compression */
     1241        TRACE_OPTION_COMPRESSTYPE_LZMA  = 4,  /**< LZO Compression */
     1242        TRACE_OPTION_COMPRESSTYPE_LAST
    12131243} trace_option_compresstype_t;
    12141244
     
    17501780DLLEXPORT uint16_t *trace_checksum_transport(libtrace_packet_t *packet,
    17511781                uint16_t *csum);
     1782
     1783/** Calculates the fragment offset in bytes for an IP packet
     1784 * @param packet        The libtrace packet to calculate the offset for
     1785 * @param[out] more     A boolean flag to indicate whether there are more
     1786 *                      fragments after the current packet.
     1787 * @return The fragment offset for the packet in bytes. If the packet is not
     1788 * an IP packet or the fragment offset is not present in packet, the return
     1789 * value will be 0.
     1790 *
     1791 * @note The value returned is in bytes, not 8-octet units as it is stored
     1792 * in the fragment offset field in the headers. In other words, libtrace
     1793 * automatically does the multiplication for you.
     1794 *
     1795 * The value passed in for 'more' does not matter; it will be overwritten
     1796 * with the value of the More Fragments flag from the IP header.
     1797 *
     1798 * New in libtrace 3.0.20
     1799 */
     1800DLLEXPORT uint16_t trace_get_fragment_offset(const libtrace_packet_t *packet,
     1801                uint8_t *more);
    17521802
    17531803/** Gets a pointer to the transport layer header (if any)
Note: See TracChangeset for help on using the changeset viewer.