Changeset 58c226e


Ignore:
Timestamp:
02/05/19 15:12:49 (20 months ago)
Author:
Jacob Van Walraven <jcv9@…>
Branches:
develop
Children:
4e5a51f
Parents:
7b4f5e2
Message:

Move function descriptions to the correct header file, Revert trace_get_interface_ipv4 changes

Location:
lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lib/format_pktmeta.c

    r7b4f5e2 r58c226e  
    2121}
    2222
    23 /* API functions to retrieve interface related packet data */
    24 
    25 /* Destroy libtrace_meta_t structure
    26  *
    27  * @params libtrace_meta_t structure
    28  * returns 1 on success, -1 on failure
    29  */
    30 int trace_destroy_meta(libtrace_meta_t *result) {
    31         int i;
    32         if (!result) { return -1; }
    33 
    34         for (i=0;i<result->num;i++) {
    35                 if(result->items[i].data != NULL) {
    36                         free(result->items[i].data);
    37                 }
    38         }
    39         if (result->items) {
    40                 free(result->items);
    41         }
    42         if (result) {
    43                 free(result);
    44         }
    45 
    46         return 1;
    47 }
    48 
    49 libtrace_meta_t *trace_get_meta_option(libtrace_packet_t *packet, uint32_t section,
     23static libtrace_meta_t *trace_get_meta_option(libtrace_packet_t *packet, uint32_t section,
    5024        uint32_t option) {
    5125
     
    12094}
    12195
    122 /* Get the interface name/s for a meta packet.
    123  * Must be destroyed with trace_destroy_meta().
    124  *
    125  * @params libtrace_packet_t meta packet.
    126  * @returns Pointer to libtrace_meta_t structure containing all found interface names
    127  * or NULL.
    128  */
     96
     97/* API FUNCTIONS */
     98
     99int trace_destroy_meta(libtrace_meta_t *result) {
     100        int i;
     101        if (!result) { return -1; }
     102
     103        for (i=0;i<result->num;i++) {
     104                if(result->items[i].data != NULL) {
     105                        free(result->items[i].data);
     106                }
     107        }
     108        if (result->items) {
     109                free(result->items);
     110        }
     111        if (result) {
     112                free(result);
     113        }
     114
     115        return 1;
     116}
     117
    129118libtrace_meta_t *trace_get_interface_name_meta(libtrace_packet_t *packet) {
    130119        if (trace_meta_check_input(packet, "trace_get_interface_name()")<0) {
     
    144133        return r;
    145134}
    146 /* Get the interface name for a meta packet.
    147  * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
    148  * specify the interface index.
    149  *
    150  * @params libtrace_packet_t meta packet to extract the interface name from.
    151  * @params A pointer to a character buffer to store the interface name in.
    152  * @params The size of the buffer passed in.
    153  * @params The interface index within the meta packet.
    154  * @returns Pointer to the character buffer containing the interface name or NULL.
    155  */
     135
    156136char *trace_get_interface_name(libtrace_packet_t *packet, char *space, int spacelen,
    157137        int index) {
     
    177157}
    178158
    179 /* Get the interface MAC address/s for a meta packet.
    180  * Must be destroyed with trace_destroy_meta().
    181  *
    182  * @params libtrace_packet_t meta packet.
    183  * @returns Pointer to libtrace_meta_t structure containing all found interface mac
    184  * addresses or NULL.
    185  */
    186159libtrace_meta_t *trace_get_interface_mac_meta(libtrace_packet_t *packet) {
    187160        if (trace_meta_check_input(packet, "trace_get_interface_mac()")<0) {
     
    200173        return r;
    201174}
    202 /* Get the interface MAC address for a meta packet.
    203  * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
    204  * specify the interface index.
    205  *
    206  * @params libtrace_packet_t meta packet to extract the MAC address from.
    207  * @params A pointer to a character buffer to store the MAC address in.
    208  * @params The size of the buffer passed in.
    209  * @params The interface index within the meta packet.
    210  * @returns Pointer to the character buffer containing the MAC address or NULL.
    211  */
     175
    212176char *trace_get_interface_mac(libtrace_packet_t *packet, char *space, int spacelen,
    213177        int index) {
     
    230194}
    231195
    232 /* Get the interface speed/s from a meta packet.
    233  * Must be destroyed with trace_destroy_meta().
    234  *
    235  * @params libtrace_packet_t packet.
    236  * @returns Pointer to libtrace_meta_t structure containing all found interface
    237  * speeds or NULL.
    238  */
    239196libtrace_meta_t *trace_get_interface_speed_meta(libtrace_packet_t *packet) {
    240197        if (trace_meta_check_input(packet, "trace_get_interface_speed()")<0) {
     
    253210        return r;
    254211}
    255 /* Get the interface speed for a meta packet.
    256  * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
    257  * specify the interface index.
    258  *
    259  * @params libtrace_packet_t meta packet to extract the interface speed from.
    260  * @params The interface index within the meta packet.
    261  * @returns uint64_t interface speed or NULL.
    262  */
     212
    263213uint64_t trace_get_interface_speed(libtrace_packet_t *packet, int index) {
    264214        libtrace_meta_t *r = trace_get_interface_speed_meta(packet);
     
    275225}
    276226
    277 /* Get the interface ipv4 address/s for a meta packet.
    278  * Must be destroyed with trace_destroy_meta().
    279  *
    280  * @params libtrace_packet_t meta packet.
    281  * @returns Pointer to libtrace_meta_t structure containing all found ipv4 addresses
    282  * or NULL
    283  */
    284227libtrace_meta_t *trace_get_interface_ipv4_meta(libtrace_packet_t *packet) {
    285228        if (trace_meta_check_input(packet, "trace_get_interface_ip4()")<0) {
     
    298241        return r;
    299242}
    300 /* Get the interface ipv4 address for a meta packet.
    301  * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
    302  * specify the interface index.
    303  *
    304  * @params libtrace_packet_t meta packet to extract the ipv4 address from.
    305  * @params The interface index within the meta packet.
    306  * @returns uint32_t ipv4 address or 0.
    307  */
     243
    308244uint32_t trace_get_interface_ipv4(libtrace_packet_t *packet, int index) {
    309245        libtrace_meta_t *r = trace_get_interface_ipv4_meta(packet);
     
    317253        return data;
    318254}
    319 /* Get the interface ipv4 address string for a meta packet.
    320  * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
    321  * specify the interface index.
    322  *
    323  * @params libtrace_packet_t meta packet to extract the ipv4 address from.
    324  * @params The interface index within the meta packet.
    325  * @returns Pointer to the character buffer containing the ipv4 address string or NULL.
    326  */
     255
    327256/* UNTESTED */
    328 char *trace_get_interface_ipv4_string(libtrace_packet_t *packet, int index) {
    329         struct in_addr ip;
    330         uint32_t addr;
    331 
    332         addr = trace_get_interface_ipv4(packet, index);
    333         if (addr == 0) { return NULL; }
    334 
    335         ip.s_addr = addr;
    336 
    337         return inet_ntoa(ip);
    338 }
    339 
    340 /* Get the interface ipv6 address/s for a meta packet.
    341  * Must be destroyed with trace_destroy_meta().
    342  *
    343  * @params libtrace_packet_t meta packet.
    344  * @returns Pointer to libtrace_meta_t structure containing all found ipv6 addresses
    345  * or NULL.
    346  */
     257char *trace_get_interface_ipv4_string(libtrace_packet_t *packet, char *space, int spacelen,
     258        int index) {
     259
     260        if (spacelen < INET_ADDRSTRLEN) {
     261                return NULL;
     262        }
     263
     264        uint32_t addr = trace_get_interface_ipv4(packet, index);
     265        if (addr == 0) {
     266                return NULL;
     267        }
     268
     269        /* get the string representation, store in space */
     270        inet_ntop(AF_INET, &addr, space, INET_ADDRSTRLEN);
     271
     272        return space;
     273}
     274
    347275libtrace_meta_t *trace_get_interface_ipv6_meta(libtrace_packet_t *packet) {
    348276        if (trace_meta_check_input(packet, "trace_get_interface_ip6()")<0) {
     
    361289        return r;
    362290}
    363 /* Get the interface ipv6 address for a meta packet.
    364  * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
    365  * specify the interface index.
    366  *
    367  * @params libtrace_packet_t meta packet to extract the ipv6 address from.
    368  * @params A pointer to a character buffer to store the ipv6 address in.
    369  * @params The size of the buffer passed in.
    370  * @params The interface index within the meta packet.
    371  * @returns Pointer to the buffer containing the ipv6 address or NULL.
    372  */
     291
    373292void *trace_get_interface_ipv6(libtrace_packet_t *packet, void *space, int spacelen,
    374293        int index) {
     
    388307        return space;
    389308}
    390 /* Get the interface ipv6 address string for a meta packet.
    391  * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
    392  * specify the interface index.
    393  *
    394  * @params libtrace_packet_t meta packet to extract the ipv6 address from.
    395  * @params A pointer to a character buffer to store the ipv6 address in.
    396  * @params The size of the buffer passed in.
    397  * @params The interface index within the meta packet.
    398  * @returns Pointer to the character buffer containing the ipv6 address string or NULL.
    399  */
     309
    400310/* UNTESTED */
    401311char *trace_get_interface_ipv6_string(libtrace_packet_t *packet, char *space, int spacelen,
     
    414324        }
    415325
    416         /* get the string representation */
     326        /* get the string representation, store in space */
    417327        inet_ntop(AF_INET6, &(sa.sin6_addr), space, INET6_ADDRSTRLEN);
    418328
     
    420330}
    421331
    422 
    423 /* Get the interface description/s for a meta packet.
    424  * Must be destroyed with trace_destroy_meta().
    425  *
    426  * @params libtrace_packet_t meta packet.
    427  * @returns Pointer to libtrace_meta_t structure containing all found interface
    428  * descriptions or NULL.
    429  */
    430332libtrace_meta_t *trace_get_interface_description_meta(libtrace_packet_t *packet) {
    431333        if (trace_meta_check_input(packet, "trace_get_interface_description()")<0) {
     
    444346        return r;
    445347}
    446 /* Get the interface description for a meta packet.
    447  * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
    448  * specify the interface index.
    449  *
    450  * @params libtrace_packet_t meta packet to extract the interface description from.
    451  * @params A pointer to a character buffer to store the interface description in.
    452  * @params The size of the buffer passed in.
    453  * @params The interface index within the meta packet.
    454  * @returns Pointer to the character buffer containing the interface description or NULL.
    455  */
     348
    456349char *trace_get_interface_description(libtrace_packet_t *packet, char *space, int spacelen,
    457350        int index) {
     
    474367}
    475368
    476 
    477 /* Get the host OS for a meta packet.
    478  * Must be destroyed with trace_destroy_meta().
    479  *
    480  * @params libtrace_packet_t meta packet.
    481  * @returns Pointer to libtrace_meta_t structure containing the host OS or NULL.
    482  */
    483369libtrace_meta_t *trace_get_host_os_meta(libtrace_packet_t *packet) {
    484370        if (trace_meta_check_input(packet, "trace_get_host_os()")<0) {
     
    497383        return r;
    498384}
    499 /* Get the host OS for a meta packet.
    500  *
    501  * @params libtrace_packet_t meta packet to extract the host OS from.
    502  * @params A pointer to a character buffer to store the host OS in.
    503  * @params The size of the buffer passed in.
    504  * @returns Pointer to the character buffer containing the host OS or NULL.
    505  */
     385
    506386char *trace_get_host_os(libtrace_packet_t *packet, char *space, int spacelen) {
    507387        libtrace_meta_t *r = trace_get_host_os_meta(packet);
     
    518398}
    519399
    520 /* Get the interface frame check sequence length for a meta packet.
    521  * Must be destroyed with trace_destroy_meta().
    522  *
    523  * @params libtrace_packet_t meta packet.
    524  * @returns Pointer to libtrace_meta_t structure containing all found frame check
    525  * sequence lengths or NULL.
    526  */
    527400libtrace_meta_t *trace_get_interface_fcslen_meta(libtrace_packet_t *packet) {
    528401        if (trace_meta_check_input(packet, "trace_get_interface_frame_check_sequence_length()")<0) {
     
    541414        return r;
    542415}
    543 /* Get the interface frame check sequence length for a meta packet.
    544  * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
    545  * specify the interface index.
    546  *
    547  * @params libtrace_packet_t meta packet to extract the interface fcslen from.
    548  * @params The interface index within the meta packet.
    549  * @returns uint32_t frame check sequence length or 0.
    550  */
     416
    551417uint32_t trace_get_interface_fcslen(libtrace_packet_t *packet, int index) {
    552418        libtrace_meta_t *r = trace_get_interface_fcslen_meta(packet);
     
    561427}
    562428
    563 /* Get any interface comments for a meta packet
    564  * Must be destroyed with trace_destroy_meta()
    565  *
    566  * @params libtrace_packet_t packet
    567  * @returns Pointer to libtrace_meta_t structure or NULL
    568  */
    569429libtrace_meta_t *trace_get_interface_comment_meta(libtrace_packet_t *packet) {
    570430        if (trace_meta_check_input(packet, "trace_get_interface_comment()")<0) {
     
    583443        return r;
    584444}
    585 /* Get the interface comment for a meta packet.
    586  * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
    587  * specify the interface ID.
    588  *
    589  * @params libtrace_packet_t meta packet to extract the interface comment from.
    590  * @params A pointer to a character buffer to store the interface description in.
    591  * @params The size of the buffer passed in.
    592  * @params The interface number within the meta packet.
    593  * @returns Pointer to the character buffer containing the hardware description or NULL.
    594  */
     445
    595446char *trace_get_interface_comment(libtrace_packet_t *packet, char *space, int spacelen,
    596447        int index) {
     
    613464}
    614465
    615 /* Get the capture application for a meta packet
    616  * Must be destroyed with trace_destroy_meta()
    617  *
    618  * @params libtrace_packet_t packet
    619  * @returns Pointer to libtrace_meta_t structure or NULL
    620  */
    621466libtrace_meta_t *trace_get_capture_application_meta(libtrace_packet_t *packet) {
    622467        if (trace_meta_check_input(packet, "trace_get_interface_comment()")<0) {
     
    635480        return r;
    636481}
    637 /* Get the capture application for a meta packet.
    638  *
    639  * @params libtrace_packet_t meta packet to extract the application name from.
    640  * @params A pointer to a character buffer to store the application name in.
    641  * @params The size of the buffer passed in.
    642  * @returns Pointer to the character buffer containing the application name or NULL.
    643  */
     482
    644483char *trace_get_capture_application(libtrace_packet_t *packet, char *space, int spacelen) {
    645484        libtrace_meta_t *r = trace_get_capture_application_meta(packet);
     
    656495}
    657496
    658 /* Get a meta section option from a meta packet
    659  * Must be destroyed with trace_destroy_meta()
    660  *
    661  * @params libtrace_packet_t packet
    662  * @params Section code
    663  * @params Option code
    664  * @returns Pointer to libtrace_meta_t structure or NULL
    665  */
    666497libtrace_meta_t *trace_get_section_option(libtrace_packet_t *packet, uint32_t section_code,
    667498        uint16_t option_code) {
     
    674505}
    675506
    676 /* Get a section from a meta packet
    677  * Must be destroyed with trace_destroy_meta()
    678  *
    679  * @params libtrace_packet_t packet
    680  * @params Section code
    681  * @returns Pointer to libtrace_meta_t structure or NULL
    682  */
    683507libtrace_meta_t *trace_get_section(libtrace_packet_t *packet, uint32_t section_code) {
    684508        if (trace_meta_check_input(packet, "trace_get_section()")<0) {
     
    689513}
    690514
    691 /* ERF specific function */
    692 /* Get the DAG card model from a meta packet.
    693  *
    694  * @params libtrace_packet_t meta packet to extract the DAG model from.
    695  * @params A pointer to a character buffer to store the DAG model in.
    696  * @params The size of the buffer passed in.
    697  * @returns Pointer to the character buffer containing the DAG model or NULL.
    698  */
    699515char *trace_get_erf_dag_card_model(libtrace_packet_t *packet, char *space, int spacelen) {
    700516        libtrace_meta_t *r = trace_get_section_option(packet, ERF_PROV_SECTION_MODULE,
     
    712528        return space;
    713529}
    714 /* Get the host DAG software version for a meta packet.
    715  *
    716  * @params libtrace_packet_t meta packet to extract the hosts DAG verion from.
    717  * @params A pointer to a character buffer to store the DAG version in.
    718  * @params The size of the buffer passed in.
    719  * @returns Pointer to the character buffer containing the DAG version or NULL.
    720  */
     530
    721531char *trace_get_erf_dag_version(libtrace_packet_t *packet, char *space, int spacelen) {
    722532        libtrace_meta_t *r = trace_get_section_option(packet, ERF_PROV_SECTION_MODULE,
     
    735545        return space;
    736546}
    737 /* Get the firmware version for a DAG module from a meta packet.
    738  *
    739  * @params libtrace_packet_t meta packet to extract the FW version from.
    740  * @params A pointer to a character buffer to store the FW version in.
    741  * @params The size of the buffer passed in.
    742  * @returns Pointer to the character buffer containing the FW version or NULL.
    743  */
     547
    744548char *trace_get_erf_dag_fw_version(libtrace_packet_t *packet, char *space, int spacelen) {
    745549        libtrace_meta_t *r = trace_get_section_option(packet, ERF_PROV_SECTION_MODULE,
  • lib/libtrace.h.in

    r7b4f5e2 r58c226e  
    37253725/*@}*/
    37263726
     3727/* Destroy libtrace_meta_t structure
     3728 *
     3729 * @params libtrace_meta_t structure
     3730 * returns 1 on success, -1 on failure
     3731 */
    37273732DLLEXPORT int trace_destroy_meta(libtrace_meta_t *result);
    37283733
    3729 DLLEXPORT libtrace_meta_t *trace_get_meta_option(libtrace_packet_t *packet, uint32_t section,
    3730         uint32_t option);
    3731 
     3734/* Get the interface name/s for a meta packet.
     3735 * Must be destroyed with trace_destroy_meta().
     3736 *
     3737 * @params libtrace_packet_t meta packet.
     3738 * @returns Pointer to libtrace_meta_t structure containing all found interface names
     3739 * or NULL.
     3740 */
    37323741DLLEXPORT libtrace_meta_t *trace_get_interface_name_meta(libtrace_packet_t *packet);
    37333742
     3743/* Get the interface name for a meta packet.
     3744 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3745 * specify the interface index.
     3746 *
     3747 * @params libtrace_packet_t meta packet to extract the interface name from.
     3748 * @params A pointer to a character buffer to store the interface name in.
     3749 * @params The size of the buffer passed in.
     3750 * @params The interface index within the meta packet.
     3751 * @returns Pointer to the character buffer containing the interface name or NULL.
     3752 */
    37343753DLLEXPORT char *trace_get_interface_name(libtrace_packet_t *packet, char *space, int spacelen,
    37353754        int index);
    37363755
     3756/* Get the interface MAC address/s for a meta packet.
     3757 * Must be destroyed with trace_destroy_meta().
     3758 *
     3759 * @params libtrace_packet_t meta packet.
     3760 * @returns Pointer to libtrace_meta_t structure containing all found interface mac
     3761 * addresses or NULL.
     3762 */
    37373763DLLEXPORT libtrace_meta_t *trace_get_interface_mac_meta(libtrace_packet_t *packet);
    37383764
     3765/* Get the interface MAC address for a meta packet.
     3766 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3767 * specify the interface index.
     3768 *
     3769 * @params libtrace_packet_t meta packet to extract the MAC address from.
     3770 * @params A pointer to a character buffer to store the MAC address in.
     3771 * @params The size of the buffer passed in.
     3772 * @params The interface index within the meta packet.
     3773 * @returns Pointer to the character buffer containing the MAC address or NULL.
     3774 */
    37393775DLLEXPORT char *trace_get_interface_mac(libtrace_packet_t *packet, char *space, int spacelen,
    37403776        int index);
    37413777
     3778/* Get the interface speed/s from a meta packet.
     3779 * Must be destroyed with trace_destroy_meta().
     3780 *
     3781 * @params libtrace_packet_t packet.
     3782 * @returns Pointer to libtrace_meta_t structure containing all found interface
     3783 * speeds or NULL.
     3784 */
    37423785DLLEXPORT libtrace_meta_t *trace_get_interface_speed_meta(libtrace_packet_t *packet);
    37433786
     3787/* Get the interface speed for a meta packet.
     3788 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3789 * specify the interface index.
     3790 *
     3791 * @params libtrace_packet_t meta packet to extract the interface speed from.
     3792 * @params The interface index within the meta packet.
     3793 * @returns uint64_t interface speed or NULL.
     3794 */
    37443795DLLEXPORT uint64_t trace_get_interface_speed(libtrace_packet_t *packet, int index);
    37453796
    3746 
     3797/* Get the interface ipv4 address/s for a meta packet.
     3798 * Must be destroyed with trace_destroy_meta().
     3799 *
     3800 * @params libtrace_packet_t meta packet.
     3801 * @returns Pointer to libtrace_meta_t structure containing all found ipv4 addresses
     3802 * or NULL
     3803 */
    37473804DLLEXPORT libtrace_meta_t *trace_get_interface_ipv4_meta(libtrace_packet_t *packet);
    37483805
     3806/* Get the interface ipv4 address for a meta packet.
     3807 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3808 * specify the interface index.
     3809 *
     3810 * @params libtrace_packet_t meta packet to extract the ipv4 address from.
     3811 * @params The interface index within the meta packet.
     3812 * @returns uint32_t ipv4 address or 0.
     3813 */
    37493814DLLEXPORT uint32_t trace_get_interface_ipv4(libtrace_packet_t *packet, int index);
    37503815
    3751 DLLEXPORT char *trace_get_interface_ipv4_string(libtrace_packet_t *packet, int index);
    3752 
     3816/* Get the interface ipv4 address string for a meta packet.
     3817 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3818 * specify the interface index.
     3819 *
     3820 * @params libtrace_packet_t meta packet to extract the ipv4 address from.
     3821 * @params A pointer to a character buffer to store the ipv4 address string in.
     3822 * @params The size of the buffer passed in.
     3823 * @params The interface index within the meta packet.
     3824 * @returns Pointer to the character buffer containing the ipv4 address string or NULL.
     3825 */
     3826DLLEXPORT char *trace_get_interface_ipv4_string(libtrace_packet_t *packet, char* space, int spacelen,
     3827        int index);
     3828
     3829/* Get the interface ipv6 address/s for a meta packet.
     3830 * Must be destroyed with trace_destroy_meta().
     3831 *
     3832 * @params libtrace_packet_t meta packet.
     3833 * @returns Pointer to libtrace_meta_t structure containing all found ipv6 addresses
     3834 * or NULL.
     3835 */
    37533836DLLEXPORT libtrace_meta_t *trace_get_interface_ipv6_meta(libtrace_packet_t *packet);
    37543837
     3838/* Get the interface ipv6 address for a meta packet.
     3839 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3840 * specify the interface index.
     3841 *
     3842 * @params libtrace_packet_t meta packet to extract the ipv6 address from.
     3843 * @params A pointer to a character buffer to store the ipv6 address in.
     3844 * @params The size of the buffer passed in.
     3845 * @params The interface index within the meta packet.
     3846 * @returns Pointer to the buffer containing the ipv6 address or NULL.
     3847 */
    37553848DLLEXPORT void *trace_get_interface_ipv6(libtrace_packet_t *packet, void *space, int spacelen,
    37563849        int index);
    37573850
     3851/* Get the interface ipv6 address string for a meta packet.
     3852 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3853 * specify the interface index.
     3854 *
     3855 * @params libtrace_packet_t meta packet to extract the ipv6 address from.
     3856 * @params A pointer to a character buffer to store the ipv6 address in.
     3857 * @params The size of the buffer passed in.
     3858 * @params The interface index within the meta packet.
     3859 * @returns Pointer to the character buffer containing the ipv6 address string or NULL.
     3860 */
    37583861DLLEXPORT char *trace_get_interface_ipv6_string(libtrace_packet_t *packet, char *space, int spacelen,
    37593862        int index);
    37603863
     3864/* Get the interface description/s for a meta packet.
     3865 * Must be destroyed with trace_destroy_meta().
     3866 *
     3867 * @params libtrace_packet_t meta packet.
     3868 * @returns Pointer to libtrace_meta_t structure containing all found interface
     3869 * descriptions or NULL.
     3870 */
    37613871DLLEXPORT libtrace_meta_t *trace_get_interface_description_meta(libtrace_packet_t *packet);
    37623872
     3873/* Get the interface description for a meta packet.
     3874 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3875 * specify the interface index.
     3876 *
     3877 * @params libtrace_packet_t meta packet to extract the interface description from.
     3878 * @params A pointer to a character buffer to store the interface description in.
     3879 * @params The size of the buffer passed in.
     3880 * @params The interface index within the meta packet.
     3881 * @returns Pointer to the character buffer containing the interface description or NULL.
     3882 */
    37633883DLLEXPORT char *trace_get_interface_description(libtrace_packet_t *packet, char *space, int spacelen,
    3764 
    37653884        int index);
    37663885
     3886/* Get the host OS for a meta packet.
     3887 * Must be destroyed with trace_destroy_meta().
     3888 *
     3889 * @params libtrace_packet_t meta packet.
     3890 * @returns Pointer to libtrace_meta_t structure containing the host OS or NULL.
     3891 */
    37673892DLLEXPORT libtrace_meta_t *trace_get_host_os_meta(libtrace_packet_t *packet);
    37683893
     3894/* Get the host OS for a meta packet.
     3895 *
     3896 * @params libtrace_packet_t meta packet to extract the host OS from.
     3897 * @params A pointer to a character buffer to store the host OS in.
     3898 * @params The size of the buffer passed in.
     3899 * @returns Pointer to the character buffer containing the host OS or NULL.
     3900 */
    37693901DLLEXPORT char *trace_get_host_os(libtrace_packet_t *packet, char *space, int spacelen);
    37703902
     3903/* Get the interface frame check sequence length for a meta packet.
     3904 * Must be destroyed with trace_destroy_meta().
     3905 *
     3906 * @params libtrace_packet_t meta packet.
     3907 * @returns Pointer to libtrace_meta_t structure containing all found frame check
     3908 * sequence lengths or NULL.
     3909 */
    37713910DLLEXPORT libtrace_meta_t *trace_get_interface_fcslen_meta(libtrace_packet_t *packet);
    37723911
     3912/* Get the interface frame check sequence length for a meta packet.
     3913 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3914 * specify the interface index.
     3915 *
     3916 * @params libtrace_packet_t meta packet to extract the interface fcslen from.
     3917 * @params The interface index within the meta packet.
     3918 * @returns uint32_t frame check sequence length or 0.
     3919 */
    37733920DLLEXPORT uint32_t trace_get_interface_fcslen(libtrace_packet_t *packet, int index);
    37743921
     3922/* Get any interface comments for a meta packet
     3923 * Must be destroyed with trace_destroy_meta()
     3924 *
     3925 * @params libtrace_packet_t packet
     3926 * @returns Pointer to libtrace_meta_t structure or NULL
     3927 */
    37753928DLLEXPORT libtrace_meta_t *trace_get_interface_comment_meta(libtrace_packet_t *packet);
    37763929
     3930/* Get the interface comment for a meta packet.
     3931 * Note: ERF packets can contain multiple interfaces per meta packet. Use index to
     3932 * specify the interface ID.
     3933 *
     3934 * @params libtrace_packet_t meta packet to extract the interface comment from.
     3935 * @params A pointer to a character buffer to store the interface description in.
     3936 * @params The size of the buffer passed in.
     3937 * @params The interface number within the meta packet.
     3938 * @returns Pointer to the character buffer containing the hardware description or NULL.
     3939 */
    37773940DLLEXPORT char *trace_get_interface_comment(libtrace_packet_t *packet, char *space, int spacelen,
    37783941        int index);
    37793942
     3943/* Get the capture application for a meta packet
     3944 * Must be destroyed with trace_destroy_meta()
     3945 *
     3946 * @params libtrace_packet_t packet
     3947 * @returns Pointer to libtrace_meta_t structure or NULL
     3948 */
    37803949DLLEXPORT libtrace_meta_t *trace_get_capture_application_meta(libtrace_packet_t *packet);
    37813950
     3951/* Get the capture application for a meta packet.
     3952 *
     3953 * @params libtrace_packet_t meta packet to extract the application name from.
     3954 * @params A pointer to a character buffer to store the application name in.
     3955 * @params The size of the buffer passed in.
     3956 * @returns Pointer to the character buffer containing the application name or NULL.
     3957 */
    37823958DLLEXPORT char *trace_get_capture_application(libtrace_packet_t *packet, char *space, int spacelen);
    37833959
     3960/* Get a meta section option from a meta packet
     3961 * Must be destroyed with trace_destroy_meta()
     3962 *
     3963 * @params libtrace_packet_t packet
     3964 * @params Section code
     3965 * @params Option code
     3966 * @returns Pointer to libtrace_meta_t structure or NULL
     3967 */
    37843968DLLEXPORT libtrace_meta_t *trace_get_section_option(libtrace_packet_t *packet, uint32_t section_code,
    37853969        uint16_t option_code);
    37863970
     3971/* Get a section from a meta packet
     3972 * Must be destroyed with trace_destroy_meta()
     3973 *
     3974 * @params libtrace_packet_t packet
     3975 * @params Section code
     3976 * @returns Pointer to libtrace_meta_t structure or NULL
     3977 */
    37873978DLLEXPORT libtrace_meta_t *trace_get_section(libtrace_packet_t *packet, uint32_t section_code);
    37883979
     3980/* Get the DAG card model from a meta packet.
     3981 *
     3982 * @params libtrace_packet_t meta packet to extract the DAG model from.
     3983 * @params A pointer to a character buffer to store the DAG model in.
     3984 * @params The size of the buffer passed in.
     3985 * @returns Pointer to the character buffer containing the DAG model or NULL.
     3986 */
    37893987DLLEXPORT char *trace_get_erf_dag_card_model(libtrace_packet_t *packet, char *space,
    37903988        int spacelen);
    37913989
     3990/* Get the host DAG software version for a meta packet.
     3991 *
     3992 * @params libtrace_packet_t meta packet to extract the hosts DAG verion from.
     3993 * @params A pointer to a character buffer to store the DAG version in.
     3994 * @params The size of the buffer passed in.
     3995 * @returns Pointer to the character buffer containing the DAG version or NULL.
     3996 */
    37923997DLLEXPORT char *trace_get_erf_dag_version(libtrace_packet_t *packet, char *space,
    37933998        int spacelen);
    37943999
     4000/* Get the firmware version for a DAG module from a meta packet.
     4001 *
     4002 * @params libtrace_packet_t meta packet to extract the FW version from.
     4003 * @params A pointer to a character buffer to store the FW version in.
     4004 * @params The size of the buffer passed in.
     4005 * @returns Pointer to the character buffer containing the FW version or NULL.
     4006 */
    37954007DLLEXPORT char *trace_get_erf_dag_fw_version(libtrace_packet_t *packet, char *space,
    37964008        int spacelen);
Note: See TracChangeset for help on using the changeset viewer.