Changeset b9af56e for lib/libtrace.h.in


Ignore:
Timestamp:
02/13/19 15:44:52 (2 years ago)
Author:
Jacob van Walraven <jacobvw@…>
Branches:
develop
Children:
5325ff0
Parents:
5e5b6ca (diff), 67fdca0 (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.
git-author:
Jacob van Walraven <jacobvw@…> (02/13/19 15:43:10)
git-committer:
Jacob van Walraven <jacobvw@…> (02/13/19 15:44:52)
Message:

Fix merge conflict

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h.in

    rc876f29 rb9af56e  
    471471        TRACE_RT_DUCK_5_0       =19,/**< Dag 5.0 Duck */
    472472        TRACE_RT_PCAPNG_META    =20,/**< Metadata for a PCAP NG input source */
     473        TRACE_RT_ERF_META       =21,/**< Metadata for a ERF input source */
    473474
    474475        /** Not actually used - all DATA types begin from this value */
     
    613614};
    614615
     616/** Enumeration of datatype returned inside libtrace_meta_item_t structure */
     617typedef enum {
     618        TRACE_META_UINT8        = 1,
     619        TRACE_META_UINT32       = 2,       
     620        TRACE_META_UINT64       = 3,
     621        TRACE_META_STRING       = 4,
     622        TRACE_META_UNKNOWN      = 5,
     623        TRACE_META_IPV4         = 6,
     624        TRACE_META_IPV6         = 7,
     625        TRACE_META_MAC          = 8,
     626} libtrace_meta_datatype_t;
     627
     628typedef struct libtrace_meta_item {
     629        uint16_t option;
     630        char *option_name;
     631        uint16_t len;
     632        libtrace_meta_datatype_t datatype;
     633        void *data;
     634} libtrace_meta_item_t;
     635
     636typedef struct libtrace_meta_section {
     637        uint16_t section;
     638        uint16_t num;
     639        libtrace_meta_item_t *items;
     640} libtrace_meta_t;
     641
    615642typedef struct libtrace_packet_cache {
    616643        int capture_length;             /**< Cached capture length */
     
    649676        int refcount;                 /**< Reference counter */
    650677        int which_trace_start;          /**< Used to match packet to a started instance of the parent trace */
    651 
    652678} libtrace_packet_t;
    653679
     
    14101436         *  trying to calculate it from the packet type. */
    14111437        TRACE_OPTION_CONSTANT_ERF_FRAMING,
     1438
     1439        /** If enabled all meta packet will be discarded */
     1440        TRACE_OPTION_DISCARD_META,
    14121441} trace_option_t;
    14131442
     
    37753804/*@}*/
    37763805
     3806/* Destroy libtrace_meta_t structure
     3807 *
     3808 * @params libtrace_meta_t structure
     3809 * returns 1 on success, -1 on failure
     3810 */
     3811DLLEXPORT int trace_destroy_meta(libtrace_meta_t *result);
     3812
     3813/* Get the interface name/s for a meta packet.
     3814 * Must be destroyed with trace_destroy_meta().
     3815 *
     3816 * @params libtrace_packet_t meta packet.
     3817 * @returns Pointer to libtrace_meta_t structure containing all found interface names
     3818 * or NULL.
     3819 */
     3820DLLEXPORT libtrace_meta_t *trace_get_interface_name_meta(libtrace_packet_t *packet);
     3821
     3822/* Get the interface name for a meta packet.
     3823 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3824 * specify the interface index.
     3825 *
     3826 * @params libtrace_packet_t meta packet to extract the interface name from.
     3827 * @params A pointer to a character buffer to store the interface name in.
     3828 * @params The size of the buffer passed in.
     3829 * @params The interface index within the meta packet.
     3830 * @returns Pointer to the character buffer containing the interface name or NULL.
     3831 */
     3832DLLEXPORT char *trace_get_interface_name(libtrace_packet_t *packet, char *space, int spacelen,
     3833        int index);
     3834
     3835/* Get the interface MAC address/s for a meta packet.
     3836 * Must be destroyed with trace_destroy_meta().
     3837 *
     3838 * @params libtrace_packet_t meta packet.
     3839 * @returns Pointer to libtrace_meta_t structure containing all found interface mac
     3840 * addresses or NULL.
     3841 */
     3842DLLEXPORT libtrace_meta_t *trace_get_interface_mac_meta(libtrace_packet_t *packet);
     3843
     3844/* Get the interface MAC address for a meta packet.
     3845 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3846 * specify the interface index.
     3847 *
     3848 * @params libtrace_packet_t meta packet to extract the MAC address from.
     3849 * @params A pointer to a character buffer to store the MAC address in.
     3850 * @params The size of the buffer passed in.
     3851 * @params The interface index within the meta packet.
     3852 * @returns Pointer to the character buffer containing the MAC address or NULL.
     3853 */
     3854DLLEXPORT char *trace_get_interface_mac(libtrace_packet_t *packet, char *space, int spacelen,
     3855        int index);
     3856
     3857/* Get the interface speed/s from a meta packet.
     3858 * Must be destroyed with trace_destroy_meta().
     3859 *
     3860 * @params libtrace_packet_t packet.
     3861 * @returns Pointer to libtrace_meta_t structure containing all found interface
     3862 * speeds or NULL.
     3863 */
     3864DLLEXPORT libtrace_meta_t *trace_get_interface_speed_meta(libtrace_packet_t *packet);
     3865
     3866/* Get the interface speed for a meta packet.
     3867 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3868 * specify the interface index.
     3869 *
     3870 * @params libtrace_packet_t meta packet to extract the interface speed from.
     3871 * @params The interface index within the meta packet.
     3872 * @returns uint64_t interface speed or NULL.
     3873 */
     3874DLLEXPORT uint64_t trace_get_interface_speed(libtrace_packet_t *packet, int index);
     3875
     3876/* Get the interface ipv4 address/s for a meta packet.
     3877 * Must be destroyed with trace_destroy_meta().
     3878 *
     3879 * @params libtrace_packet_t meta packet.
     3880 * @returns Pointer to libtrace_meta_t structure containing all found ipv4 addresses
     3881 * or NULL
     3882 */
     3883DLLEXPORT libtrace_meta_t *trace_get_interface_ipv4_meta(libtrace_packet_t *packet);
     3884
     3885/* Get the interface ipv4 address for a meta packet.
     3886 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3887 * specify the interface index.
     3888 *
     3889 * @params libtrace_packet_t meta packet to extract the ipv4 address from.
     3890 * @params The interface index within the meta packet.
     3891 * @returns uint32_t ipv4 address or 0.
     3892 */
     3893DLLEXPORT uint32_t trace_get_interface_ipv4(libtrace_packet_t *packet, int index);
     3894
     3895/* Get the interface ipv4 address string for a meta packet.
     3896 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3897 * specify the interface index.
     3898 *
     3899 * @params libtrace_packet_t meta packet to extract the ipv4 address from.
     3900 * @params A pointer to a character buffer to store the ipv4 address string in.
     3901 * @params The size of the buffer passed in.
     3902 * @params The interface index within the meta packet.
     3903 * @returns Pointer to the character buffer containing the ipv4 address string or NULL.
     3904 */
     3905DLLEXPORT char *trace_get_interface_ipv4_string(libtrace_packet_t *packet, char* space, int spacelen,
     3906        int index);
     3907
     3908/* Get the interface ipv6 address/s for a meta packet.
     3909 * Must be destroyed with trace_destroy_meta().
     3910 *
     3911 * @params libtrace_packet_t meta packet.
     3912 * @returns Pointer to libtrace_meta_t structure containing all found ipv6 addresses
     3913 * or NULL.
     3914 */
     3915DLLEXPORT libtrace_meta_t *trace_get_interface_ipv6_meta(libtrace_packet_t *packet);
     3916
     3917/* Get the interface ipv6 address for a meta packet.
     3918 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3919 * specify the interface index.
     3920 *
     3921 * @params libtrace_packet_t meta packet to extract the ipv6 address from.
     3922 * @params A pointer to a character buffer to store the ipv6 address in.
     3923 * @params The size of the buffer passed in.
     3924 * @params The interface index within the meta packet.
     3925 * @returns Pointer to the buffer containing the ipv6 address or NULL.
     3926 */
     3927DLLEXPORT void *trace_get_interface_ipv6(libtrace_packet_t *packet, void *space, int spacelen,
     3928        int index);
     3929
     3930/* Get the interface ipv6 address string for a meta packet.
     3931 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3932 * specify the interface index.
     3933 *
     3934 * @params libtrace_packet_t meta packet to extract the ipv6 address from.
     3935 * @params A pointer to a character buffer to store the ipv6 address in.
     3936 * @params The size of the buffer passed in.
     3937 * @params The interface index within the meta packet.
     3938 * @returns Pointer to the character buffer containing the ipv6 address string or NULL.
     3939 */
     3940DLLEXPORT char *trace_get_interface_ipv6_string(libtrace_packet_t *packet, char *space, int spacelen,
     3941        int index);
     3942
     3943/* Get the interface description/s for a meta packet.
     3944 * Must be destroyed with trace_destroy_meta().
     3945 *
     3946 * @params libtrace_packet_t meta packet.
     3947 * @returns Pointer to libtrace_meta_t structure containing all found interface
     3948 * descriptions or NULL.
     3949 */
     3950DLLEXPORT libtrace_meta_t *trace_get_interface_description_meta(libtrace_packet_t *packet);
     3951
     3952/* Get the interface description for a meta packet.
     3953 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3954 * specify the interface index.
     3955 *
     3956 * @params libtrace_packet_t meta packet to extract the interface description from.
     3957 * @params A pointer to a character buffer to store the interface description in.
     3958 * @params The size of the buffer passed in.
     3959 * @params The interface index within the meta packet.
     3960 * @returns Pointer to the character buffer containing the interface description or NULL.
     3961 */
     3962DLLEXPORT char *trace_get_interface_description(libtrace_packet_t *packet, char *space, int spacelen,
     3963        int index);
     3964
     3965/* Get the host OS for a meta packet.
     3966 * Must be destroyed with trace_destroy_meta().
     3967 *
     3968 * @params libtrace_packet_t meta packet.
     3969 * @returns Pointer to libtrace_meta_t structure containing the host OS or NULL.
     3970 */
     3971DLLEXPORT libtrace_meta_t *trace_get_host_os_meta(libtrace_packet_t *packet);
     3972
     3973/* Get the host OS for a meta packet.
     3974 *
     3975 * @params libtrace_packet_t meta packet to extract the host OS from.
     3976 * @params A pointer to a character buffer to store the host OS in.
     3977 * @params The size of the buffer passed in.
     3978 * @returns Pointer to the character buffer containing the host OS or NULL.
     3979 */
     3980DLLEXPORT char *trace_get_host_os(libtrace_packet_t *packet, char *space, int spacelen);
     3981
     3982/* Get the interface frame check sequence length for a meta packet.
     3983 * Must be destroyed with trace_destroy_meta().
     3984 *
     3985 * @params libtrace_packet_t meta packet.
     3986 * @returns Pointer to libtrace_meta_t structure containing all found frame check
     3987 * sequence lengths or NULL.
     3988 */
     3989DLLEXPORT libtrace_meta_t *trace_get_interface_fcslen_meta(libtrace_packet_t *packet);
     3990
     3991/* Get the interface frame check sequence length for a meta packet.
     3992 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3993 * specify the interface index.
     3994 *
     3995 * @params libtrace_packet_t meta packet to extract the interface fcslen from.
     3996 * @params The interface index within the meta packet.
     3997 * @returns uint32_t frame check sequence length or 0.
     3998 */
     3999DLLEXPORT uint32_t trace_get_interface_fcslen(libtrace_packet_t *packet, int index);
     4000
     4001/* Get any interface comments for a meta packet
     4002 * Must be destroyed with trace_destroy_meta()
     4003 *
     4004 * @params libtrace_packet_t packet
     4005 * @returns Pointer to libtrace_meta_t structure or NULL
     4006 */
     4007DLLEXPORT libtrace_meta_t *trace_get_interface_comment_meta(libtrace_packet_t *packet);
     4008
     4009/* Get the interface comment for a meta packet.
     4010 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     4011 * specify the interface ID.
     4012 *
     4013 * @params libtrace_packet_t meta packet to extract the interface comment from.
     4014 * @params A pointer to a character buffer to store the interface description in.
     4015 * @params The size of the buffer passed in.
     4016 * @params The interface number within the meta packet.
     4017 * @returns Pointer to the character buffer containing the hardware description or NULL.
     4018 */
     4019DLLEXPORT char *trace_get_interface_comment(libtrace_packet_t *packet, char *space, int spacelen,
     4020        int index);
     4021
     4022/* Get the capture application for a meta packet
     4023 * Must be destroyed with trace_destroy_meta()
     4024 *
     4025 * @params libtrace_packet_t packet
     4026 * @returns Pointer to libtrace_meta_t structure or NULL
     4027 */
     4028DLLEXPORT libtrace_meta_t *trace_get_capture_application_meta(libtrace_packet_t *packet);
     4029
     4030/* Get the capture application for a meta packet.
     4031 *
     4032 * @params libtrace_packet_t meta packet to extract the application name from.
     4033 * @params A pointer to a character buffer to store the application name in.
     4034 * @params The size of the buffer passed in.
     4035 * @returns Pointer to the character buffer containing the application name or NULL.
     4036 */
     4037DLLEXPORT char *trace_get_capture_application(libtrace_packet_t *packet, char *space, int spacelen);
     4038
     4039/* Get a meta section option from a meta packet
     4040 * Must be destroyed with trace_destroy_meta()
     4041 *
     4042 * @params libtrace_packet_t packet
     4043 * @params Section code
     4044 * @params Option code
     4045 * @returns Pointer to libtrace_meta_t structure or NULL
     4046 */
     4047DLLEXPORT libtrace_meta_t *trace_get_section_option(libtrace_packet_t *packet, uint32_t section_code,
     4048        uint16_t option_code);
     4049
     4050/* Get a section from a meta packet
     4051 * Must be destroyed with trace_destroy_meta()
     4052 *
     4053 * @params libtrace_packet_t packet
     4054 * @params Section code
     4055 * @returns Pointer to libtrace_meta_t structure or NULL
     4056 */
     4057DLLEXPORT libtrace_meta_t *trace_get_section(libtrace_packet_t *packet, uint32_t section_code);
     4058
     4059/* Get the DAG card model from a meta packet.
     4060 *
     4061 * @params libtrace_packet_t meta packet to extract the DAG model from.
     4062 * @params A pointer to a character buffer to store the DAG model in.
     4063 * @params The size of the buffer passed in.
     4064 * @returns Pointer to the character buffer containing the DAG model or NULL.
     4065 */
     4066DLLEXPORT char *trace_get_erf_dag_card_model(libtrace_packet_t *packet, char *space,
     4067        int spacelen);
     4068
     4069/* Get the host DAG software version for a meta packet.
     4070 *
     4071 * @params libtrace_packet_t meta packet to extract the hosts DAG verion from.
     4072 * @params A pointer to a character buffer to store the DAG version in.
     4073 * @params The size of the buffer passed in.
     4074 * @returns Pointer to the character buffer containing the DAG version or NULL.
     4075 */
     4076DLLEXPORT char *trace_get_erf_dag_version(libtrace_packet_t *packet, char *space,
     4077        int spacelen);
     4078
     4079/* Get the firmware version for a DAG module from a meta packet.
     4080 *
     4081 * @params libtrace_packet_t meta packet to extract the FW version from.
     4082 * @params A pointer to a character buffer to store the FW version in.
     4083 * @params The size of the buffer passed in.
     4084 * @returns Pointer to the character buffer containing the FW version or NULL.
     4085 */
     4086DLLEXPORT char *trace_get_erf_dag_fw_version(libtrace_packet_t *packet, char *space,
     4087        int spacelen);
     4088
    37774089#ifdef __cplusplus
    37784090} /* extern "C" */
    37794091#endif /* #ifdef __cplusplus */
     4092
    37804093#endif /* LIBTRACE_H_ */
Note: See TracChangeset for help on using the changeset viewer.