Changeset a9d0e40 for lib/libtrace_int.h


Ignore:
Timestamp:
11/28/17 17:37:51 (3 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, dpdk-ndag, etsilive, master, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
Children:
6452c2c
Parents:
9726d0e
git-author:
Shane Alcock <salcock@…> (11/28/17 17:34:41)
git-committer:
Shane Alcock <salcock@…> (11/28/17 17:37:51)
Message:

trace_prepare_packet is now an external API function

Previously it was for internal use only, but I now have a use
case where it makes sense to have access to it externally
(specifically: "casting" DAG buffer pointers to libtrace packets
so I can dynamically snap them without having the overhead of
the whole of libtrace).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace_int.h

    rea75ec2 ra9d0e40  
    427427void trace_clear_cache(libtrace_packet_t *packet);
    428428
    429 /** Converts the data provided in buffer into a valid libtrace packet
    430  *
    431  * @param trace         An input trace of the same format as the "packet"
    432  *                      contained in the buffer
    433  * @param packet        The libtrace packet to prepare
    434  * @param buffer        A buffer containing the packet data, including the
    435  *                      capture format header
    436  * @param rt_type       The RT type for the packet that is being prepared
    437  * @param flags         Used to specify options for the preparation function,
    438  *                      e.g. who owns the packet buffer
    439  *
    440  * @return -1 if an error occurs, 0 otherwise
    441  *
    442  * Packet preparation is a tricky concept - the idea is to take the data
    443  * pointed to by 'buffer' and treat it as a packet record of the same capture
    444  * format as that used by the input trace. The provided libtrace packet then
    445  * has its internal pointers and values set to describe the packet record in
    446  * the buffer.
    447  *
    448  * The primary use of this function is to allow the RT packet reader to
    449  * easily and safely convert packets from the RT format back into the format
    450  * that they were originally captured with., essentially removing the RT
    451  * encapsulation.
    452  *
    453  * We've decided not to make this function available via the exported API
    454  * because there are several issues that can arise if it is not used very
    455  * carefully and it is not very useful outside of internal contexts anyway.
    456  */
    457 int trace_prepare_packet(libtrace_t *trace, libtrace_packet_t *packet,
    458                 void *buffer, libtrace_rt_types_t rt_type, uint32_t flags);
    459 
    460 /** Flags for prepare_packet functions */
    461 enum {
    462         /** The buffer memory has been allocated by libtrace and should be
    463          * freed when the packet is destroyed. */
    464         TRACE_PREP_OWN_BUFFER           =1,
    465        
    466         /** The buffer memory is externally-owned and must not be freed by
    467          * libtrace when the packet is destroyed. */
    468         TRACE_PREP_DO_NOT_OWN_BUFFER    =0
    469 };
    470 
    471429
    472430#ifndef PF_RULESET_NAME_SIZE
Note: See TracChangeset for help on using the changeset viewer.